Skip to content

Commit

Permalink
Fix for vlts-846-exceptions rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
vladtcvs committed Feb 19, 2018
1 parent 8d3582c commit dbe0da0
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 33 deletions.
25 changes: 13 additions & 12 deletions tempesta_fw/t/functional/long_body/test_request_wrong_length.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ class RequestCorrectBodyLength(functional.FunctionalTest):
def create_client(self):
self.client = tester.ClientMultipleResponses()

def create_tester(self, message_chain):
self.tester = TesterCorrectBodyLength(message_chain, self.client, self.servers)
def create_tester(self):
self.tester = TesterCorrectBodyLength(self.client, self.servers)

def test(self):
""" Test """
Expand All @@ -128,8 +128,8 @@ def test(self):
class RequestMissingBodyLength(RequestCorrectBodyLength):
""" Wrong body length """

def create_tester(self, message_chain):
self.tester = TesterMissingBodyLength(message_chain, self.client, self.servers)
def create_tester(self):
self.tester = TesterMissingBodyLength(self.client, self.servers)

def assert_tempesta(self):
msg = 'Tempesta have errors in processing HTTP %s.'
Expand All @@ -144,17 +144,17 @@ def assert_tempesta(self):

class RequestSmallBodyLength(RequestMissingBodyLength):
""" Wrong body length """
def create_tester(self, message_chain):
self.tester = TesterSmallBodyLength(message_chain, self.client, self.servers)
def create_tester(self):
self.tester = TesterSmallBodyLength(self.client, self.servers)

class RequestDuplicateBodyLength(functional.FunctionalTest):
config = 'cache 0;\nblock_action error reply;\nblock_action attack reply;\n'

def create_client(self):
self.client = deproxy.Client()

def create_tester(self, message_chain):
self.tester = TesterDuplicateBodyLength(message_chain, self.client, self.servers)
def create_tester(self):
self.tester = TesterDuplicateBodyLength(self.client, self.servers)

def test(self):
""" Test """
Expand All @@ -172,8 +172,9 @@ def assert_tempesta(self):
msg=(msg % 'responses'))

class RequestSecondBodyLength(RequestDuplicateBodyLength):
def create_tester(self, message_chain):
self.tester = TesterSecondBodyLength(message_chain, self.client, self.servers)
def create_tester(self):
self.tester = TesterSecondBodyLength(self.client, self.servers)

def assert_tempesta(self):
msg = 'Tempesta have errors in processing HTTP %s.'
self.assertEqual(self.tempesta.stats.cl_msg_parsing_errors, 1,
Expand All @@ -186,5 +187,5 @@ def assert_tempesta(self):
msg=(msg % 'responses'))

class RequestInvalidBodyLength(RequestSecondBodyLength):
def create_tester(self, message_chain):
self.tester = TesterInvalidBodyLength(message_chain, self.client, self.servers)
def create_tester(self):
self.tester = TesterInvalidBodyLength(self.client, self.servers)
41 changes: 21 additions & 20 deletions tempesta_fw/t/functional/long_body/test_response_wrong_length.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ class ResponseCorrectEmptyBodyLength(functional.FunctionalTest):
def create_client(self):
self.client = deproxy.Client()

def create_tester(self, message_chain):
self.tester = TesterCorrectEmptyBodyLength(message_chain, self.client, self.servers)
def create_tester(self):
self.tester = TesterCorrectEmptyBodyLength(self.client, self.servers)

def test(self):
""" Test """
Expand All @@ -190,8 +190,8 @@ def test(self):
class ResponseCorrectBodyLength(ResponseCorrectEmptyBodyLength):
""" Correct body length """

def create_tester(self, message_chain):
self.tester = TesterCorrectBodyLength(message_chain, self.client, self.servers)
def create_tester(self):
self.tester = TesterCorrectBodyLength(self.client, self.servers)

class ResponseMissingEmptyBodyLength(ResponseCorrectEmptyBodyLength):
""" Missing body length """
Expand All @@ -200,20 +200,20 @@ def create_servers(self):
port = tempesta.upstream_port_start_from()
self.servers = [deproxy.Server(port=port, keep_alive=1)]

def create_tester(self, message_chain):
self.tester = TesterMissingEmptyBodyLength(message_chain, self.client, self.servers)
def create_tester(self):
self.tester = TesterMissingEmptyBodyLength(self.client, self.servers)

class ResponseMissingBodyLength(ResponseMissingEmptyBodyLength):
""" Missing body length """

def create_tester(self, message_chain):
self.tester = TesterMissingBodyLength(message_chain, self.client, self.servers)
def create_tester(self):
self.tester = TesterMissingBodyLength(self.client, self.servers)

class ResponseSmallBodyLength(ResponseCorrectEmptyBodyLength):
""" Small body length """

def create_tester(self, message_chain):
self.tester = TesterSmallBodyLength(message_chain, self.client, self.servers)
def create_tester(self):
self.tester = TesterSmallBodyLength(self.client, self.servers)

def assert_tempesta(self):
msg = 'Tempesta have errors in processing HTTP %s.'
Expand All @@ -229,8 +229,8 @@ def assert_tempesta(self):
class ResponseForbiddenZeroBodyLength(ResponseCorrectEmptyBodyLength):
""" Forbidden body length """

def create_tester(self, message_chain):
self.tester = TesterForbiddenZeroBodyLength(message_chain, self.client, self.servers)
def create_tester(self):
self.tester = TesterForbiddenZeroBodyLength(self.client, self.servers)

def assert_tempesta(self):
msg = 'Tempesta have errors in processing HTTP %s.'
Expand All @@ -247,12 +247,13 @@ def assert_tempesta(self):
class ResponseForbiddenPositiveBodyLength(ResponseForbiddenZeroBodyLength):
""" Forbidden body length """

def create_tester(self, message_chain):
self.tester = TesterForbiddenPositiveBodyLength(message_chain, self.client, self.servers)
def create_tester(self):
self.tester = TesterForbiddenPositiveBodyLength(self.client, self.servers)

class ResponseDuplicateBodyLength(ResponseCorrectEmptyBodyLength):
def create_tester(self, message_chain):
self.tester = TesterDuplicateBodyLength(message_chain, self.client, self.servers)
def create_tester(self):
self.tester = TesterDuplicateBodyLength(self.client, self.servers)

def assert_tempesta(self):
msg = 'Tempesta have errors in processing HTTP %s.'
self.assertEqual(self.tempesta.stats.cl_msg_parsing_errors, 0,
Expand All @@ -265,9 +266,9 @@ def assert_tempesta(self):
msg=(msg % 'responses'))

class ResponseSecondBodyLength(ResponseDuplicateBodyLength):
def create_tester(self, message_chain):
self.tester = TesterSecondBodyLength(message_chain, self.client, self.servers)
def create_tester(self):
self.tester = TesterSecondBodyLength(self.client, self.servers)

class ResponseInvalidBodyLength(ResponseDuplicateBodyLength):
def create_tester(self, message_chain):
self.tester = TesterInvalidBodyLength(message_chain, self.client, self.servers)
def create_tester(self):
self.tester = TesterInvalidBodyLength(self.client, self.servers)
2 changes: 1 addition & 1 deletion tempesta_fw/t/functional/sched/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def configure(self, chain_n):

self.recieved_chain = deproxy.MessageChain.empty()
self.client.clear()
self.client.set_request(self.current_chain.request)
self.client.set_request(self.current_chain)

def recieved_response(self, response):
# A lot of clients running, dont raise asyncore.ExitNow directly
Expand Down

0 comments on commit dbe0da0

Please sign in to comment.