-
Notifications
You must be signed in to change notification settings - Fork 852
Remove netcat from bigobj test #10866
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -28,11 +28,6 @@ | |||
| Condition.HasCurlFeature('http2') | ||||
| ) | ||||
|
|
||||
| # push_request and check_ramp are built via `make`. Here we copy the built binary down to the test | ||||
| # directory so that the test runs in this file can use it. | ||||
| Test.Setup.Copy(os.path.join(Test.Variables.AtsBuildGoldTestsDir, 'bigobj', 'push_request')) | ||||
| Test.Setup.Copy(os.path.join(Test.Variables.AtsBuildGoldTestsDir, 'bigobj', 'check_ramp')) | ||||
|
|
||||
| ts = Test.MakeATSProcess("ts1", enable_tls=True) | ||||
| ts.addDefaultSSLFiles() | ||||
|
|
||||
|
|
@@ -52,65 +47,88 @@ | |||
| ) | ||||
|
|
||||
| ts.Disk.remap_config.AddLine( | ||||
| 'map https://localhost http://localhost' | ||||
| f'map https://localhost:{ts.Variables.ssl_port} http://localhost:{ts.Variables.port}' | ||||
| ) | ||||
| ts.Disk.remap_config.AddLine( | ||||
| f'map https://localhost:{ts.Variables.ssl_portv6} http://localhost:{ts.Variables.port}' | ||||
| ) | ||||
|
|
||||
| # Set up to check the output after the tests have run. | ||||
| # | ||||
| log_id = Test.Disk.File("log2.txt") | ||||
| log_id.Content = "log2.gold" | ||||
|
|
||||
| # Size of object to get. (NOTE: If you increase this significantly you may also have to increase cache | ||||
| # capacity in tests/gold_tests/autest-size/min_cfg/storage.config. Also, for very large objects, if | ||||
| # proxy.config.diags.debug.enabled is 1, the PUSH request will timeout and fail.) | ||||
| # | ||||
| obj_kilobytes = 10 * 1024 | ||||
| obj_bytes = obj_kilobytes * 10 | ||||
| header = "HTTP/1.1 200 OK\r\nContent-length: {}\r\n\r\n".format(obj_bytes) | ||||
|
|
||||
|
|
||||
| def create_pushfile(): | ||||
| f = open(Test.RunDirectory + "/objfile", "w") | ||||
| f.write(header) | ||||
| f.write("x" * obj_bytes) | ||||
| f.close() | ||||
| return True | ||||
|
|
||||
|
|
||||
| tr = Test.AddTestRun("PUSH an object to the cache") | ||||
| # Delay on readiness of TS IPv4 ssl port | ||||
| tr.Processes.Default.StartBefore(ts) | ||||
| # | ||||
| tr.Processes.Default.StartBefore(ts, ready=lambda: create_pushfile()) | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this augment or replace the default ready test?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This augments the default port ready test as far as I can tell @dragon512 can you verify that? It looks like there is an obj ready test which I assume includes the port ready for ts as well as the explicitly specified ready function. |
||||
| # Put object with URL http://localhost/bigobj in cache using PUSH request. | ||||
| tr.Processes.Default.Command = ( | ||||
| f'./push_request {obj_kilobytes} | nc localhost {ts.Variables.port}' | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This runs netcat with no arguments. But there's still some incompatibility with Ubuntu retro netcat?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since curl does support PUSH, that seems more reliable and maintainable than relying on netcat. The specific failure I was seeing on u22 was with the last testcase
Specifically the stream.stdout.txt file was empty. I assume there is a connection close difference or something between the distros. Rather than debugging that, since nc isn't really needed, I felt it would be easier to deal with by using curl instead.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I only get this far: The failure is here:
I'll approve this, but I feel like we're whistling past the graveyard a bit. Ideally, our black box regression testing should be robust on all supported platforms. |
||||
| ) | ||||
| tr.Processes.Default.Command = "curl -v -H 'Content-Type: application/octet-stream' --data-binary @{}/objfile -X PUSH http://localhost:{}/bigobj -H 'Content-Length:{}'".format( | ||||
| Test.RunDirectory, ts.Variables.port, len(header) + obj_bytes) | ||||
| tr.Processes.Default.ReturnCode = 0 | ||||
| tr.Processes.Default.Streams.All = Testers.ContainsExpression( | ||||
| "HTTP/1.1 201 Created", | ||||
| "The PUSH request should have succeeded" | ||||
| ) | ||||
|
|
||||
| tr = Test.AddTestRun("GET bigobj: cleartext, HTTP/1.1, IPv4") | ||||
| tr.Processes.Default.Command = ( | ||||
| 'curl --verbose --ipv4 --http1.1 --header "Host: localhost"' | ||||
| f' http://localhost:{ts.Variables.port}/bigobj 2>> log.txt |' | ||||
| f' ./check_ramp {obj_kilobytes}' | ||||
| ) | ||||
| tr.Processes.Default.Command = f'curl --verbose --ipv4 --http1.1 http://localhost:{ts.Variables.port}/bigobj' | ||||
| tr.Processes.Default.ReturnCode = 0 | ||||
| tr.Processes.Default.Streams.All = Testers.ContainsExpression( | ||||
| "HTTP/1.1 200 OK", | ||||
| "Should fetch pushed object" | ||||
| ) | ||||
| tr.Processes.Default.Streams.All = Testers.ContainsExpression( | ||||
| "Content-length: 102400", | ||||
| "Content size should be accurate" | ||||
| ) | ||||
|
|
||||
| tr = Test.AddTestRun("GET bigobj: TLS, HTTP/1.1, IPv4") | ||||
| tr.Processes.Default.Command = ( | ||||
| 'curl --verbose --ipv4 --http1.1 --insecure --header "Host: localhost"' | ||||
| f' https://localhost:{ts.Variables.ssl_port}/bigobj 2>> log.txt |' | ||||
| f' ./check_ramp {obj_kilobytes}' | ||||
| ) | ||||
| tr.Processes.Default.Command = f'curl --verbose --ipv4 --http1.1 --insecure https://localhost:{ts.Variables.ssl_port}/bigobj' | ||||
| tr.Processes.Default.ReturnCode = 0 | ||||
| tr.Processes.Default.Streams.All = Testers.ContainsExpression( | ||||
| "HTTP/1.1 200 OK", | ||||
| "Should fetch pushed object" | ||||
| ) | ||||
| tr.Processes.Default.Streams.All = Testers.ContainsExpression( | ||||
| "Content-length: 102400", | ||||
| "Content size should be accurate" | ||||
| ) | ||||
|
|
||||
| tr = Test.AddTestRun("GET bigobj: TLS, HTTP/2, IPv4") | ||||
| tr.Processes.Default.Command = ( | ||||
| 'curl --verbose --ipv4 --http2 --insecure --header "Host: localhost"' | ||||
| f' https://localhost:{ts.Variables.ssl_port}/bigobj 2>> log.txt |' | ||||
| f' ./check_ramp {obj_kilobytes}' | ||||
| ) | ||||
| tr.Processes.Default.Command = f'curl --verbose --ipv4 --http2 --insecure https://localhost:{ts.Variables.ssl_port}/bigobj' | ||||
| tr.Processes.Default.ReturnCode = 0 | ||||
|
|
||||
| tr = Test.AddTestRun("GET bigobj: TLS, HTTP/2, IPv6") | ||||
| tr.Processes.Default.Command = ( | ||||
| 'curl --verbose --ipv6 --http2 --insecure --header "Host: localhost"' | ||||
| f' https://localhost:{ts.Variables.ssl_portv6}/bigobj 2>> log.txt |' | ||||
| f' ./check_ramp {obj_kilobytes}' | ||||
| tr.Processes.Default.Streams.All = Testers.ContainsExpression( | ||||
| "HTTP/2 200", | ||||
| "Should fetch pushed object" | ||||
| ) | ||||
| tr.Processes.Default.Streams.All = Testers.ContainsExpression( | ||||
| "content-length: 102400", | ||||
| "Content size should be accurate" | ||||
| ) | ||||
| tr.Processes.Default.ReturnCode = 0 | ||||
|
|
||||
| tr = Test.AddTestRun() | ||||
| tr.Processes.Default.Command = "sed 's/0</0\\\n</' log.txt | grep -F 200 | grep -F HTTP > log2.txt" | ||||
| tr = Test.AddTestRun("GET bigobj: TLS, HTTP/2, IPv6") | ||||
| tr.Processes.Default.Command = f'curl --verbose --ipv6 --http2 --insecure https://localhost:{ts.Variables.ssl_portv6}/bigobj' | ||||
| tr.Processes.Default.ReturnCode = 0 | ||||
| tr.Processes.Default.Streams.All = Testers.ContainsExpression( | ||||
| "HTTP/2 200", | ||||
| "Should fetch pushed object" | ||||
| ) | ||||
| tr.Processes.Default.Streams.All = Testers.ContainsExpression( | ||||
| "content-length: 102400", | ||||
| "Content size should be accurate" | ||||
| ) | ||||
|
|
||||
| # Verify that PUSH requests are rejected when push_method_enabled is 0 (the | ||||
| # default configuration). | ||||
|
|
@@ -132,16 +150,18 @@ | |||
| ) | ||||
|
|
||||
| ts.Disk.remap_config.AddLine( | ||||
| 'map https://localhost http://localhost' | ||||
| f'map https://localhost:{ts.Variables.ssl_port} http://localhost:{ts.Variables.port}' | ||||
| ) | ||||
| ts.Disk.remap_config.AddLine( | ||||
| f'map https://localhost:{ts.Variables.ssl_portv6} http://localhost:{ts.Variables.port}' | ||||
| ) | ||||
|
|
||||
| tr = Test.AddTestRun("PUSH request is rejected when push_method_enabled is 0") | ||||
| tr.Processes.Default.StartBefore(ts) | ||||
| tr.Processes.Default.Command = ( | ||||
| f'./push_request {obj_kilobytes} | nc localhost {ts.Variables.port}' | ||||
| ) | ||||
| tr.Processes.Default.ReturnCode = 1 | ||||
| tr.Processes.Default.Streams.stdout = Testers.ContainsExpression( | ||||
| tr.Processes.Default.Command = "curl -v -H 'Content-Type: application/octet-stream' --data-binary @{}/objfile -X PUSH http://localhost:{}/bigobj -H 'Content-Length:{}'".format( | ||||
| Test.RunDirectory, ts.Variables.port, len(header) + obj_bytes) | ||||
| tr.Processes.Default.ReturnCode = 0 | ||||
| tr.Processes.Default.Streams.All = Testers.ContainsExpression( | ||||
| "403 Access Denied", | ||||
| "The PUSH request should have received a 403 response." | ||||
| ) | ||||
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there' s some value in having a ramping pattern, rather than a constant value for all bytes in the file. For example, if somehow ATS swapped the order of two IOBuffers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable