Skip to content

Commit bfbc349

Browse files
cmcfarlenbneradt
andauthored
autest updates for recent curl and nghttp2 versions (#12165) (#12301)
* autest updates for recent curl and nghttp2 versions (#12165) * number_of_redirects.test.py: curl verbosity change Change curl verbosity of number_of_redirects.test.py to -v from -vvv since in later versions of curl, the output of -vvv no longer matches the gold file. * chunked_encoding_h2: make content-length search specific Later versions of nghttp2 now include content-length headers in the request generated by chunked_encoding_h2. Therefore the search strings for the responses have to be more specific to look in server responses only otherwise they see the content-length in the request and incorrectly fail. * compress.test.py: update for recent curl output Recent versions of curl add a 'using HTTP/2' string to the output that the compress.test.py test has to filter out. * connect.test.py: accommodate curl output order changes Recent versions of curl switch the order of the "Connected to" CONNECT information with respect to the rest of the verbose output content. This updates the test expectations to accommodate that. * cripts autests updates This allows the cripts.test.py file to work in generic environments rather than just those that install into /tmp/ats. * polite_hook_wait.test.py: update for recent curl output Update the polite_hook_wait.test.py so that it can handle recent curl output that adds a 'using HTTP/1.x' or similar strings to the output. * test_TSHttpSsnInfo.test.py: accommodate nghttp The latest version of nghttp2 has different output that the test_TSHttpSsnInfo.test.py gold file has to be updated to accommodate. This updates it so that it can work for newer and older versions of the tool. (cherry picked from commit 73670a3) * fix number_of_redirects --------- Co-authored-by: Brian Neradt <brian.neradt@gmail.com>
1 parent 0808666 commit bfbc349

9 files changed

Lines changed: 25 additions & 30 deletions

File tree

tests/gold_tests/chunked_encoding/chunked_encoding_h2.test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
tr.Processes.Default.StartBefore(Test.Processes.ts)
7272
tr.Processes.Default.StartBefore(delay_server)
7373
tr.Processes.Default.Streams.All = Testers.ExcludesExpression("RST_STREAM", "Delayed chunk close should not cause reset")
74-
tr.Processes.Default.Streams.All += Testers.ExcludesExpression("content-length", "Should return chunked")
74+
tr.Processes.Default.Streams.All += Testers.ExcludesExpression("< content-length", "Should return chunked")
7575
tr.Processes.Default.Streams.All += Testers.ContainsExpression(":status: 200", "Should get successful response")
7676
tr.StillRunningAfter = ts
7777
# No resets in the output
@@ -85,7 +85,7 @@
8585
ts.Variables.ssl_port)
8686
tr.Processes.Default.ReturnCode = 0
8787
tr.Processes.Default.Streams.All = Testers.ContainsExpression("HTTP/2 200", "Request should succeed")
88-
tr.Processes.Default.Streams.All += Testers.ContainsExpression("content-length:", "Response should include content length")
88+
tr.Processes.Default.Streams.All += Testers.ContainsExpression("< content-length:", "Response should include content length")
8989
server2_out = Testers.ContainsExpression("Transfer-Encoding: chunked", "Request should be chunked encoded")
9090
# No content-length in header
9191
# Transfer encoding to origin, but no content-length
@@ -99,7 +99,7 @@
9999
ts.Variables.ssl_port)
100100
tr.Processes.Default.ReturnCode = 0
101101
tr.Processes.Default.Streams.All = Testers.ContainsExpression("HTTP/2 200", "Request should succeed")
102-
tr.Processes.Default.Streams.All += Testers.ExcludesExpression("content-length:", "Response should not include content length")
102+
tr.Processes.Default.Streams.All += Testers.ExcludesExpression("< content-length:", "Response should not include content length")
103103
server3_out = Testers.ContainsExpression("Transfer-Encoding: chunked", "Request should be chunked encoded")
104104
# No content length in header
105105
# Transfer encoding to origin, but no content-length

tests/gold_tests/connect/connect.test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ def __testCase0(self):
8787
tr.Processes.Default.Command = f"curl -v --fail -s -p -x 127.0.0.1:{self.ts.Variables.port} 'http://foo.com/get'"
8888
tr.Processes.Default.ReturnCode = 0
8989
tr.Processes.Default.Streams.stderr = "gold/connect_0_stderr.gold"
90+
tr.Processes.Default.Streams.stderr = Testers.ContainsExpression(
91+
f'Connected to 127.0.0.1.*{self.ts.Variables.port}', 'Curl should connect through the ATS proxy port.')
9092
tr.Processes.Default.TimeOut = 3
9193
self.__checkProcessAfter(tr)
9294

tests/gold_tests/connect/gold/connect_0_stderr.gold

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
``
2-
* Connected to `` (127.0.0.1) port ``
3-
``
42
* Establish HTTP proxy tunnel to foo.com:80
53
> CONNECT foo.com:80 HTTP/1.1
64
> Host: foo.com:80

tests/gold_tests/pluginTest/compress/compress.test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,8 @@ def get_verify_command(out_path, decrompressor):
261261
tr = Test.AddTestRun()
262262
tr.Processes.Default.ReturnCode = 0
263263
tr.Processes.Default.Command = (
264-
r"tr -d '\r' < compress_long.log | sed 's/\(..*\)\([<>]\)/\1\n\2/' | {0}/greplog.sh > compress_short.log").format(
265-
Test.TestDirectory)
264+
r"tr -d '\r' < compress_long.log | sed 's/\(..*\)\([<>]\)/\1\n\2/' | {0}/greplog.sh > compress_short.log".format(
265+
Test.TestDirectory))
266266
f = tr.Disk.File("compress_short.log")
267267
f.Content = "compress.gold"
268268

tests/gold_tests/pluginTest/compress/greplog.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
# limitations under the License.
1616

1717
grep --text \
18-
-e 'HTTP/' \
18+
-e '< HTTP/' \
19+
-e '> GET' \
20+
-e '> POST' \
1921
-e '^> X-Ats-Compress-Test:' \
2022
-e '^> Accept-Encoding:' \
2123
-e '^< Content-' \

tests/gold_tests/pluginTest/polite_hook_wait/polite_hook_wait.test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060
tr.Processes.Default.ReturnCode = 0
6161

6262
tr = Test.AddTestRun()
63-
tr.Processes.Default.Command = "grep -F HTTP/ curl.txt"
63+
# Later versions of curl add a "using HTTP" line to the output, so we filter it
64+
# out to keep this test compatible with old and new versions.
65+
tr.Processes.Default.Command = "grep -F HTTP/ curl.txt | grep -v 'using HTTP'"
6466
tr.Processes.Default.Streams.stdout = "curl.gold"
6567
tr.Processes.Default.ReturnCode = 0

tests/gold_tests/pluginTest/tsapi/test_TSHttpSsnInfo.test.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,11 @@
7171
# ----
7272

7373
# H2 SETTINGS, PRIORITY, HEADERS, CONTINUATION, DATA, GOAWAY
74-
tr = Test.AddTestRun()
74+
tr = Test.AddTestRun('HTTP/2 Test')
7575
tr.TimeOut = 10
76-
tr.Processes.Default.Command = f"nghttp -vn --continuation 'https://localhost:{ts.Variables.ssl_port}/httpbin/post' -d 'post_body'"
76+
# grep out the continuation lines because that significantly reduces the output
77+
# size which exponentially reduces the gold file processing time.
78+
tr.Processes.Default.Command = f"nghttp -vn --continuation 'https://localhost:{ts.Variables.ssl_port}/httpbin/post' -d 'post_body' | grep -v 'continuation-test'"
7779
tr.Processes.Default.ReturnCode = 0
7880
tr.Processes.Default.StartBefore(httpbin, ready=When.PortOpen(httpbin.Variables.Port))
7981
tr.Processes.Default.StartBefore(Test.Processes.ts)
@@ -83,21 +85,21 @@
8385

8486
# H3
8587
if Condition.HasATSFeature('TS_USE_QUIC') and Condition.HasCurlFeature('http3'):
86-
tr = Test.AddTestRun()
88+
tr = Test.AddTestRun('HTTP/3 Test')
8789
tr.TimeOut = 10
8890
tr.Processes.Default.Command = f"curl -k --http3 'https://localhost:{ts.Variables.ssl_port}/httpbin/post' -d 'post_body'"
8991
tr.Processes.Default.ReturnCode = 0
9092
tr.Processes.Default.Streams.stdout = "test_TSHttpSsnInfo_curl0.gold"
9193
tr.StillRunningAfter = httpbin
9294
tr.StillRunningAfter = ts
9395

94-
tr = Test.AddTestRun()
96+
tr = Test.AddTestRun('Check the log output')
9597
tr.Processes.Default.Command = "echo check log"
9698
tr.Processes.Default.ReturnCode = 0
9799
f = tr.Disk.File(log_path)
98100
f.Content = "test_TSHttpSsnInfo_plugin_log.gold"
99101
f.Content += Testers.ContainsExpression(
100-
"H2 Frames Received:D1,H1,PR5,RS0,S2,PP0,P0,G1,WU0,C1,U0", "Expected numbers of frames should be received")
102+
"H2 Frames Received:D1,H1,PR.,RS0,S2,PP0,P0,G1,WU0,C1,U0", "Expected numbers of frames should be received")
101103
# We cannot test this on H3 now because the test plugin does not work on H3 sessions
102104
# f.Content += Testers.ContainsExpression("H3 Frames Received:D1,H1,Ra0,CP0,S1,PP0,Rb0,G0,Rc0,Rd0,UND0,UND0,UND0,MPI0,U0",
103105
# "Expected numbers of frames should be received")
Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
``
2-
[``] send PRIORITY frame <length=5, flags=0x00, stream_id=3>
3-
(dep_stream_id=0, weight=201, exclusive=0)
4-
[``] send PRIORITY frame <length=5, flags=0x00, stream_id=5>
5-
(dep_stream_id=0, weight=101, exclusive=0)
6-
[``] send PRIORITY frame <length=5, flags=0x00, stream_id=7>
7-
(dep_stream_id=0, weight=1, exclusive=0)
8-
[``] send PRIORITY frame <length=5, flags=0x00, stream_id=9>
9-
(dep_stream_id=7, weight=1, exclusive=0)
10-
[``] send PRIORITY frame <length=5, flags=0x00, stream_id=11>
11-
(dep_stream_id=3, weight=1, exclusive=0)
12-
[``] send HEADERS frame <length=``, flags=0x24, stream_id=13>
13-
; END_HEADERS | PRIORITY
2+
[``] send HEADERS frame <length=``, flags=0x``, stream_id=``>
3+
; END_HEADER``
144
``
15-
[``] send DATA frame <length=``, flags=0x01, stream_id=13>
5+
[``] send DATA frame <length=``, flags=0x``, stream_id=``>
166
``; END_STREAM
177
``
18-
[``] recv (stream_id=13) :status: 431
8+
[``] recv (stream_id=``) :status: 431
199
``
2010
``; END_STREAM
2111
``

tests/gold_tests/redirect/number_of_redirects.test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ def run(self):
8383
self._tr.Processes.Default.StartBefore(self._srv3)
8484
self._tr.Processes.Default.StartBefore(self._dns)
8585
self._tr.Processes.Default.StartBefore(self._ts)
86-
self._tr.Command = "curl -L -vvv a.test/ping --proxy 127.0.0.1:{0} -H 'uuid: redirect_test_1'".format(
87-
self._ts.Variables.port)
86+
self._tr.Command = "curl -L -v a.test/ping --proxy 127.0.0.1:{0} -H 'uuid: redirect_test_1'".format(self._ts.Variables.port)
8887
self._tr.Processes.Default.Streams.All = f"gold/number_of_redirections_{self._numberOfRedirections}.gold"
8988
self._tr.ReturnCode = 0
9089
self._tr.StillRunningAfter = self._ts

0 commit comments

Comments
 (0)