pytests: parametrize test_prefix_trailing_garbage

parent 53389342
......@@ -51,6 +51,22 @@ def sock_family(request):
return request.param
@pytest.fixture(params=[
True,
False
])
def single_buffer(request): # whether to send all data in a single buffer
return request.param
@pytest.fixture(params=[
True,
False
])
def query_before(request): # whether to send an initial query
return request.param
@pytest.mark.optionalhook
def pytest_metadata(metadata): # filter potentially sensitive data from GitLab CI
keys_to_delete = []
......
......@@ -9,22 +9,6 @@ import pytest
import utils
@pytest.fixture(params=[
True,
False
])
def single_buffer(request): # whether to send all data in a single buffer
return request.param
@pytest.fixture(params=[
True,
False
])
def query_before(request): # whether to send an initial query
return request.param
@pytest.mark.parametrize('garbage_lengths', [
(1,),
(1024,),
......
......@@ -105,11 +105,22 @@ def test_prefix_cuts_message(kresd_sock, send_query_before):
send_invalid_repeatedly(kresd_sock, invalid_buff)
def test_trailing_garbage(kresd_sock):
@pytest.mark.parametrize('glength', [
0,
1,
8,
1024,
4096,
20000,
])
def test_prefix_trailing_garbage(kresd_sock, glength, query_before):
"""Send messages with trailing garbage (its length included in prefix)."""
if query_before:
utils.ping_alive(kresd_sock)
for _ in range(10):
wire, msgid = utils.prepare_wire()
wire += utils.get_garbage(8)
wire += utils.get_garbage(glength)
buff = utils.prepare_buffer(wire)
kresd_sock.sendall(buff)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment