Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reworked long body tests #304

Merged
merged 12 commits into from
Nov 14, 2022
Merged

Conversation

RomanBelozerov
Copy link
Contributor

@RomanBelozerov RomanBelozerov commented Sep 12, 2022

long_body tests is separated to t_long_body, t_wrong_body_length and t_stress.

I reworked old tests for new framework, and also added tests:

  1. for values 'Content-Length' header: negative, decimal, empty, longer.
  2. stress tests for http/https/h2 requests.
  3. tests for big data in http/https/h2 request/response.

Copy link
Contributor

@const-t const-t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests looks good, but need some changes in request parsing and error handling

long_body/test_request_wrong_length.py Outdated Show resolved Hide resolved
framework/deproxy_client.py Outdated Show resolved Hide resolved
framework/deproxy_client.py Outdated Show resolved Hide resolved
@krizhanovsky krizhanovsky requested a review from b3b September 16, 2022 16:05
@RomanBelozerov RomanBelozerov force-pushed the rb-56-redesigned-long-body-tests branch from edd7b6c to c5a9e67 Compare October 5, 2022 09:51
@const-t
Copy link
Contributor

const-t commented Oct 11, 2022

Need to develop tests to verify tempesta-tech/tempesta#1418. Tests must include:

  1. Sending non-chunked response to HTTP1 client which has body length over 16384 bytes.
  2. Sending non-chunked response to HTTP2 client which has body length over 16384 bytes.
  3. Sending chunked response to HTTP1 client which has multiple chunks with length over 16384 bytes.
  4. Sending chunked response to HTTP2 client which has multiple chunks with length over 16384 bytes.

Also need to make version of each test with enabled tempesta caching. In case of chunked, response returned from cache must contain Content-Length, instead of chunked body.

@RomanBelozerov RomanBelozerov force-pushed the rb-56-redesigned-long-body-tests branch from c5a9e67 to 49f4df5 Compare October 21, 2022 15:51
@RomanBelozerov RomanBelozerov force-pushed the rb-56-redesigned-long-body-tests branch from 49f4df5 to 1ff9428 Compare October 28, 2022 09:58
Copy link
Contributor

@b3b b3b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got errors when running with the default config.

./run_tests.py t_long_body t_wrong_body_length t_stress

======================================================================
FAIL: test_http (t_long_body.test_long_request.LongBodyInRequest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/tempesta-test2/t_long_body/test_long_request.py", line 158, in test_http
    self._test(
  File "/root/tempesta-test2/t_long_body/test_long_request.py", line 134, in _test
    client.send_request(
  File "/root/tempesta-test2/framework/deproxy_client.py", line 319, in send_request
    assert curr_responses + 1 == len(self.responses), "Deproxy client has lost response."
AssertionError: Deproxy client has lost response.

======================================================================
FAIL: test_https (t_long_body.test_long_request.LongBodyInRequest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/tempesta-test2/t_long_body/test_long_request.py", line 163, in test_https
    self._test(
  File "/root/tempesta-test2/t_long_body/test_long_request.py", line 134, in _test
    client.send_request(
  File "/root/tempesta-test2/framework/deproxy_client.py", line 319, in send_request
    assert curr_responses + 1 == len(self.responses), "Deproxy client has lost response."
AssertionError: Deproxy client has lost response.

======================================================================
FAIL: test_many_big_chunks_in_request_http (t_long_body.test_long_request.LongBodyInRequest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/tempesta-test2/t_long_body/test_long_request.py", line 185, in test_many_big_chunks_in_request_http
    self._test(
  File "/root/tempesta-test2/t_long_body/test_long_request.py", line 134, in _test
    client.send_request(
  File "/root/tempesta-test2/framework/deproxy_client.py", line 319, in send_request
    assert curr_responses + 1 == len(self.responses), "Deproxy client has lost response."
AssertionError: Deproxy client has lost response.

======================================================================
FAIL: test_many_big_chunks_in_request_https (t_long_body.test_long_request.LongBodyInRequest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/tempesta-test2/t_long_body/test_long_request.py", line 192, in test_many_big_chunks_in_request_https
    self._test(
  File "/root/tempesta-test2/t_long_body/test_long_request.py", line 134, in _test
    client.send_request(
  File "/root/tempesta-test2/framework/deproxy_client.py", line 319, in send_request
    assert curr_responses + 1 == len(self.responses), "Deproxy client has lost response."
AssertionError: Deproxy client has lost response.

======================================================================
FAIL: test_one_big_chunk_in_request_http (t_long_body.test_long_request.LongBodyInRequest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/tempesta-test2/t_long_body/test_long_request.py", line 171, in test_one_big_chunk_in_request_http
    self._test(
  File "/root/tempesta-test2/t_long_body/test_long_request.py", line 134, in _test
    client.send_request(
  File "/root/tempesta-test2/framework/deproxy_client.py", line 319, in send_request
    assert curr_responses + 1 == len(self.responses), "Deproxy client has lost response."
AssertionError: Deproxy client has lost response.

======================================================================
FAIL: test_one_big_chunk_in_request_https (t_long_body.test_long_request.LongBodyInRequest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/tempesta-test2/t_long_body/test_long_request.py", line 178, in test_one_big_chunk_in_request_https
    self._test(
  File "/root/tempesta-test2/t_long_body/test_long_request.py", line 134, in _test
    client.send_request(
  File "/root/tempesta-test2/framework/deproxy_client.py", line 319, in send_request
    assert curr_responses + 1 == len(self.responses), "Deproxy client has lost response."
AssertionError: Deproxy client has lost response.

----------------------------------------------------------------------
Ran 77 tests in 499.843s

FAILED (failures=6, skipped=11)

@b3b
Copy link
Contributor

b3b commented Nov 1, 2022

t_long_body tests take up a lot of memory. Is this the expected behavior?
On machine with low memory test can't finish:

        Waiting for Server node
        Attempt to access node
Node Server is available
        Waiting for Tempesta node
        Attempt to access node
Node Tempesta is available
        Waiting for Server node
        Attempt to access node
Node Server is available
        Waiting for Tempesta node
        Attempt to access node
Node Tempesta is available
        Starting Nginx on nginx
        Starting TempestaFW on node1.tp
Running deproxy
Running deproxy server manager
        Starting deproxy client
Request parsing is running.
Request parsing is complete.
Error while polling:    Deproxy: Client: The operation did not complete (write) (_ssl.c:2396) (SSLWantWriteError: The operation did not complete (write) (_ssl.c:2396))
Finished deproxy manager
        Teardown
Not started
Not started
        Stopping TempestaFW on node1.tp
        Stopping Nginx on nginx
        Removing Nginx config for nginx
Stopping deproxy
Removing interfaces
FAIL
test_one_big_chunk_in_request_http (t_long_body.test_long_request.LongBodyInRequest) ...        Init test case...
        Waiting for Server node
        Attempt to access node
Node Server is available
        Waiting for Tempesta node
        Attempt to access node
Node Tempesta is available
        Waiting for Server node
        Attempt to access node
Node Server is available
        Waiting for Tempesta node
        Attempt to access node
Node Tempesta is available
        Starting Nginx on nginx
        Starting TempestaFW on node1.tp
Running deproxy
Running deproxy server manager
        Starting deproxy client
Request parsing is running.
Killed

@b3b
Copy link
Contributor

b3b commented Nov 10, 2022

Checked how t_long_body.test_long_request.LongBodyInRequest performs on my setup:

  • long_body_size=500, no errors
  • long_body_size=2000, сurl can't perform request: curl: option --data-binary: out of memory
  • long_body_size=900, sometimes OK and sometimes : curl: (55) OpenSSL SSL_write: Connection reset by peer, errno 104
    dmesg: Cannot grow HTTP data string

@RomanBelozerov
Copy link
Contributor Author

Checked how t_long_body.test_long_request.LongBodyInRequest performs on my setup:

* long_body_size=500, no errors

* long_body_size=2000, сurl can't perform request: `curl: option --data-binary: out of memory`

* long_body_size=900, sometimes OK and sometimes : `curl: (55) OpenSSL SSL_write: Connection reset by peer, errno 104`
  dmesg: `Cannot grow HTTP data string`

I checked this branch on CI machine and it works with 500 MB body.

@RomanBelozerov RomanBelozerov requested a review from b3b November 14, 2022 08:16
Copy link
Contributor

@b3b b3b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@const-t const-t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@RomanBelozerov RomanBelozerov merged commit a58db54 into master Nov 14, 2022
@RomanBelozerov RomanBelozerov deleted the rb-56-redesigned-long-body-tests branch November 14, 2022 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants