Skip to content

Commit

Permalink
Merge pull request #724 from tempesta-tech/rb-fix-flacky-tests
Browse files Browse the repository at this point in the history
fix unstable tests
  • Loading branch information
RomanBelozerov authored Oct 31, 2024
2 parents 4890154 + 4879a54 commit dbf0706
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions http2_general/test_h2_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
__license__ = "GPL2"


class H2ResponsesTestCase(tester.TempestaTest):
class TestH2Responses(tester.TempestaTest):
clients = [
{
"id": "curl",
Expand Down Expand Up @@ -169,7 +169,7 @@ def setup_and_start(self, pipelined):
)


class H2ResponsesPipelined(H2ResponsesPipelinedBase):
class TestH2ResponsesPipelined(H2ResponsesPipelinedBase):
tempesta = {
"config": """
listen 443 proto=h2;
Expand Down Expand Up @@ -210,19 +210,20 @@ def test_success_pipelined(self):

self.assertEqual(len(srv.requests), 3)
for client in clients:
self.assertTrue(client.wait_for_response())
self.assertEqual(client.last_response.status, "200")

@marks.Parameterize.expand(
[
marks.Param(
name="first_fail",
response_list=[bad_response, response, response],
expected_response_statuses=["502"],
expected_response_statuses=["502", None, None],
),
marks.Param(
name="second_fail",
response_list=[response, bad_response, response],
expected_response_statuses=["200", "502"],
expected_response_statuses=["200", "502", None],
),
marks.Param(
name="third_fail",
Expand All @@ -236,7 +237,6 @@ def test_bad_pipelined(self, name, response_list, expected_response_statuses):
srv = self.setup_and_start(requests_n)
# The next connection will be not pipelined
self.disable_deproxy_auto_parser()

clients = self.get_clients()
for client, response, i in zip(clients, response_list, list(range(1, 4))):
srv.set_response(response)
Expand All @@ -261,7 +261,7 @@ def test_bad_pipelined(self, name, response_list, expected_response_statuses):
for client, expected_status in zip(clients, expected_response_statuses):
if not expected_status:
i = i + 1
self.assertTrue(srv.wait_for_requests(req_count + j))
self.assertTrue(srv.wait_for_requests(req_count + i))
srv.flush()
self.assertTrue(client.wait_for_response())
self.assertEqual(client._last_response.status, "200")

0 comments on commit dbf0706

Please sign in to comment.