Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ function(ADD_AUTEST_PLUGIN _NAME)
endfunction()

add_subdirectory(tools/plugins)
add_subdirectory(gold_tests/bigobj)
add_subdirectory(gold_tests/chunked_encoding)
add_subdirectory(gold_tests/continuations/plugins)
add_subdirectory(gold_tests/jsonrpc/plugins)
Expand Down
19 changes: 0 additions & 19 deletions tests/gold_tests/bigobj/CMakeLists.txt

This file was deleted.

112 changes: 66 additions & 46 deletions tests/gold_tests/bigobj/bigobj.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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)
Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Seems reasonable

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())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does this augment or replace the default ready test?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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}'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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

file /home/ubuntu/ats10/build-mydev/tests/_sandbox/bigobj/_output/6-tr-Default/stream.stdout.txt : The PUSH request should have received a 403 response. - ^[[0m^[[31mFailed^[[0m^[[1m
Reason: Contents of /home/ubuntu/ats10/build-mydev/tests/_sandbox/bigobj/_output/6-tr-Default/stream.stdout.txt did not contains expression: "403 Access Denied"

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.

Copy link
Copy Markdown
Contributor

@ywkaras ywkaras Nov 29, 2023

Choose a reason for hiding this comment

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

I only get this far:

   Run: GET bigobj: TLS, HTTP/2, IPv6: Failed
     Starting TestRun 4-tr : No Issues found - Passed
        Reason: Started!
     Process: Default: Failed
       Test : Checking that ReturnCode == 0 - Failed
          Reason: Returned Value 1 != 0

The failure is here:

fprintf(stderr, "error in standard input\n");

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).
Expand All @@ -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."
)
57 changes: 0 additions & 57 deletions tests/gold_tests/bigobj/check_ramp.c

This file was deleted.

4 changes: 0 additions & 4 deletions tests/gold_tests/bigobj/log2.gold

This file was deleted.

79 changes: 0 additions & 79 deletions tests/gold_tests/bigobj/push_request.c

This file was deleted.