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

Tests for #1061 and #1535 issue #195

Merged
merged 81 commits into from
Feb 14, 2022
Merged

Tests for #1061 and #1535 issue #195

merged 81 commits into from
Feb 14, 2022

Conversation

Dmitry-Gouriev
Copy link
Contributor

@Dmitry-Gouriev Dmitry-Gouriev commented Dec 8, 2021

The tests include:

  1. Tests for #1061 issue in accordance with the comment:
  • a single request with many CRLFs is blocked
  • a singled request with one CRLF or just LF is passed and both the CRLF or LF are not presented in proxied request
  • a pipelined request after another request with many CRLFs is blocked
  • a pipelined request after another request with one CRLF or just LF is passed and both the CRLF or LF are not presented in proxied request
  • all the tests above with heavily chunked CRLFs
  1. Heavy chunked test for ss_skb_chop_head_tail() in context of refriting PURGE request as GET. The test detects a bug
    decribed there

It seems that the tests partialy covers issue #115.

Copy link
Contributor

@krizhanovsky krizhanovsky left a comment

Choose a reason for hiding this comment

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

Good job, but some more work is required

framework/deproxy_client.py Show resolved Hide resolved
framework/deproxy_client.py Outdated Show resolved Hide resolved
framework/deproxy_client.py Outdated Show resolved Hide resolved
framework/deproxy_client.py Show resolved Hide resolved
framework/deproxy_server.py Show resolved Hide resolved
malformed/test_purge_hch.py Outdated Show resolved Hide resolved
malformed/test_malformed_crlfs.py Outdated Show resolved Hide resolved
helpers/tistream.py Outdated Show resolved Hide resolved
malformed/test_malformed_crlfs.py Show resolved Hide resolved
malformed/test_purge_hch.py Outdated Show resolved Hide resolved
@krizhanovsky krizhanovsky requested a review from a user December 8, 2021 19:58
malformed/test_purge_hch.py Outdated Show resolved Hide resolved
@Dmitry-Gouriev
Copy link
Contributor Author

Dmitry-Gouriev commented Feb 10, 2022

At this point I have finished all subtasks and known comments.

Except this one:

However @byko3y promised to help with it.

Copy link
Contributor

@byko3y byko3y left a comment

Choose a reason for hiding this comment

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

Found the cause of exception.

self.connections.append(forward_conn)
forward_conn.create_socket(socket.AF_INET, socket.SOCK_STREAM)
forward_conn.bind((self.listen_host, 0))
forward_conn.connect((self.forward_host, self.forward_port))
Copy link
Contributor

Choose a reason for hiding this comment

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

When testing suite and Tempesta FW are on different hosts, so following thing happens:

forward_conn.bind(('127.0.0.1', 0))
forward_conn.connect(('192.168.122.160', 443))

Which fails with EINVAL on my setup. Manually hardcoding the forward_conn.bind(('192.168.122.1', 0)) fixes the problem.
Also, for some reason the problematic code is triggered by very few tests, particulary malformed.test_chunking_example.CorrectHeadersTest.test_ssl.

Copy link
Contributor Author

@Dmitry-Gouriev Dmitry-Gouriev Feb 10, 2022

Choose a reason for hiding this comment

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

@byko3y
Thank you very much!

Also, for some reason the problematic code is triggered by very few tests

Because it is too new tool

@Dmitry-Gouriev
Copy link
Contributor Author

@byko3y
Can you please run the test in question at your machine with the latest update?

@Dmitry-Gouriev
Copy link
Contributor Author

@krizhanovsky
It seems everything has finished.

There is some problem with example test malformed/test_chunking_example.py.
With it chunking nature it runs about 4 minutes.
In the same time it does not check smth important.
And also examples dedicated to tls/ tests are created by subclassing and so repeate some tests from tls/.
May be make it test normally disabled with tests_disabled.json ?

@byko3y
Copy link
Contributor

byko3y commented Feb 10, 2022

Revision 3cdc3b2:

test_csel_chunking (malformed.test_chunking_example.CertSelectChunkingExpampleTest) ... Node Server is available
Node Tempesta is available
Node Server is available
Node Tempesta is available
FAIL
^C
======================================================================
FAIL: test_csel_chunking (malformed.test_chunking_example.CertSelectChunkingExpampleTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/user/shared/tempesta-test/malformed/test_chunking_example.py", line 294, in test_csel_chunking
    self.iterate_test(self.inner_test_csel_chunking, 127)
  File "/home/user/shared/tempesta-test/malformed/test_chunking_example.py", line 49, in iterate_test
    test_func(CHUNK_SIZES[i], *args, **kwargs)
  File "/home/user/shared/tempesta-test/malformed/test_chunking_example.py", line 291, in inner_test_csel_chunking
    self.test_vhost_cert_selection()
  File "/home/user/shared/tempesta-test/tls/test_tls_cert.py", line 399, in test_vhost_cert_selection
    "Cannot start Tempesta")
AssertionError: Cannot start Tempesta

----------------------------------------------------------------------

@Dmitry-Gouriev
Copy link
Contributor Author

Dmitry-Gouriev commented Feb 10, 2022

@byko3y Thank you!
It seems this is a new error in newly added code.
It seems I am to fix the only this thing for now.

@byko3y
Copy link
Contributor

byko3y commented Feb 11, 2022

Seems like TLS-related failures were already existing in master branch:

./run_tests.py tls.test_tls_cert

test (tls.test_tls_cert.ECDSA_SHA256_SECP192) ... ok
test (tls.test_tls_cert.ECDSA_SHA256_SECP256) ... FAIL
test (tls.test_tls_cert.ECDSA_SHA384_SECP521) ... ok
test (tls.test_tls_cert.InvalidHash) ... ok
test (tls.test_tls_cert.RSA1024_SHA384) ... FAIL
test (tls.test_tls_cert.RSA2048_SHA512) ... FAIL
test (tls.test_tls_cert.RSA4096_SHA512) ... FAIL
test (tls.test_tls_cert.RSA512_SHA256) ... ok
test (tls.test_tls_cert.StaleCert) ... FAIL
test_vhost_cert_selection (tls.test_tls_cert.TlsCertSelect) ... FAIL

======================================================================
FAIL: test (tls.test_tls_cert.ECDSA_SHA256_SECP256)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/user/shared/tempesta-test/tls/test_tls_cert.py", line 243, in test
    self.check_good_cert()
  File "/home/user/shared/tempesta-test/tls/test_tls_cert.py", line 72, in check_good_cert
    "Cannot start Tempesta")
AssertionError: Cannot start Tempesta

======================================================================
FAIL: test (tls.test_tls_cert.RSA1024_SHA384)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/user/shared/tempesta-test/tls/test_tls_cert.py", line 180, in test
    self.check_good_cert()
  File "/home/user/shared/tempesta-test/tls/test_tls_cert.py", line 72, in check_good_cert
    "Cannot start Tempesta")
AssertionError: Cannot start Tempesta

======================================================================
FAIL: test (tls.test_tls_cert.RSA2048_SHA512)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/user/shared/tempesta-test/tls/test_tls_cert.py", line 160, in test
    self.check_good_cert()
  File "/home/user/shared/tempesta-test/tls/test_tls_cert.py", line 72, in check_good_cert
    "Cannot start Tempesta")
AssertionError: Cannot start Tempesta

======================================================================
FAIL: test (tls.test_tls_cert.RSA4096_SHA512)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/user/shared/tempesta-test/tls/test_tls_cert.py", line 140, in test
    self.check_good_cert()
  File "/home/user/shared/tempesta-test/tls/test_tls_cert.py", line 72, in check_good_cert
    "Cannot start Tempesta")
AssertionError: Cannot start Tempesta

======================================================================
FAIL: test (tls.test_tls_cert.StaleCert)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/user/shared/tempesta-test/tls/test_tls_cert.py", line 311, in test
    self.check_good_cert()
  File "/home/user/shared/tempesta-test/tls/test_tls_cert.py", line 72, in check_good_cert
    "Cannot start Tempesta")
AssertionError: Cannot start Tempesta

======================================================================
FAIL: test_vhost_cert_selection (tls.test_tls_cert.TlsCertSelect)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/user/shared/tempesta-test/tls/test_tls_cert.py", line 394, in test_vhost_cert_selection
    "Cannot start Tempesta")
AssertionError: Cannot start Tempesta

----------------------------------------------------------------------
Ran 10 tests in 22.538s

FAILED (failures=6)

@Dmitry-Gouriev
Copy link
Contributor Author

Dmitry-Gouriev commented Feb 11, 2022

So the fault was inherited rather than introduced, and shuold not prevent to merge the PR.

@Dmitry-Gouriev
Copy link
Contributor Author

The fault #195 (comment) #195 (comment) moved into issue #204

# to None to check that request is missing
deproxy_srv = self.get_server('deproxy')
deproxy_srv.segment_size = chunksize
#print (deproxy_srv.response)
Copy link
Contributor

Choose a reason for hiding this comment

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

There is still a commented out print() :) Why don't you use the standard debug printing from the framework?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Print produces more focused informaion than huge debug printing from framework :)
This print is not needed more, I'll delete it.

malformed/test_chunking_example.py Show resolved Hide resolved
Copy link
Contributor

@krizhanovsky krizhanovsky left a comment

Choose a reason for hiding this comment

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

Good and huge work! Finally it's good to merge.

@Dmitry-Gouriev Dmitry-Gouriev merged commit 656fcb1 into master Feb 14, 2022
@Dmitry-Gouriev
Copy link
Contributor Author

This commit closes issue #115

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