Fix flaky send buffer test
import pytest
-from configuration import available_ports, PROTOCOLS, ALL_TEST_CIPHERS, MINIMAL_TEST_CERTS, Certificates
+from configuration import available_ports, PROTOCOLS, ALL_TEST_CIPHERS, MINIMAL_TEST_CERTS
from common import ProviderOptions, data_bytes
from fixtures import managed_process # lgtm [py/unused-import]
from providers import Provider, S2N, OpenSSL, GnuTLS
@@ -42,22 +42,19 @@ def test_SEND_BUFFER_SIZE_MIN_is_s2ns_min_buffer_size(managed_process):
s2n_options = ProviderOptions(mode=Provider.ServerMode,
port=port,
data_to_send="test",
- extra_flags=['--buffered-send', SEND_BUFFER_SIZE_MIN-1])
+ extra_flags=['--buffered-send', SEND_BUFFER_SIZE_MIN])
s2nd = managed_process(S2N, s2n_options)
s2n_options.mode = Provider.ClientMode
-
+ s2n_options.extra_flags = ['--buffered-send', SEND_BUFFER_SIZE_MIN - 1]
s2nc = managed_process(S2N, s2n_options)
- error_string = "Error setting send buffer size"
-
- for results in s2nd.get_results():
- assert error_string in str(results.stderr)
+ for results in s2nc.get_results():
+ assert "Error setting send buffer size" in str(results.stderr)
assert results.exit_code != 0
- for results in s2nc.get_results():
- assert error_string in str(results.stderr)
+ for results in s2nd.get_results():
assert results.exit_code != 0
@@ -68,7 +65,8 @@ def test_SEND_BUFFER_SIZE_MIN_is_s2ns_min_buffer_size(managed_process):
@pytest.mark.parametrize("certificate", MINIMAL_TEST_CERTS, ids=get_parameter_name)
@pytest.mark.parametrize("buffer_size", SEND_BUFFER_SIZES, ids=get_parameter_name)
@pytest.mark.parametrize("fragment_preference", FRAGMENT_PREFERENCE, ids=get_parameter_name)
-def test_s2n_server_buffered_send(managed_process, cipher, provider, protocol, certificate, buffer_size, fragment_preference):
+def test_s2n_server_buffered_send(managed_process, cipher, provider, protocol, certificate, buffer_size,
+ fragment_preference):
# Communication Timeline
# Client [S2N|OpenSSL|GnuTLS] | Server [S2N]
# Handshake | Handshake
@@ -120,7 +118,8 @@ def test_s2n_server_buffered_send(managed_process, cipher, provider, protocol, c
@pytest.mark.parametrize("certificate", MINIMAL_TEST_CERTS, ids=get_parameter_name)
@pytest.mark.parametrize("buffer_size", SEND_BUFFER_SIZES, ids=get_parameter_name)
@pytest.mark.parametrize("fragment_preference", FRAGMENT_PREFERENCE, ids=get_parameter_name)
-def test_s2n_client_buffered_send(managed_process, cipher, provider, protocol, certificate, buffer_size, fragment_preference):
+def test_s2n_client_buffered_send(managed_process, cipher, provider, protocol, certificate, buffer_size,
+ fragment_preference):
# Communication Timeline
# Client [S2N] | Server [S2N|OpenSSL]
# Handshake | Handshake
