Skip to content

Commit 062a5cf

Browse files
author
Serris Lew
committed
add uds path to curl command
1 parent 746bcb5 commit 062a5cf

File tree

84 files changed

+361
-422
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+361
-422
lines changed

tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ if(ENABLE_AUTEST_UDS)
5151
PATTERN "*"
5252
PATTERN "h2" EXCLUDE
5353
PATTERN "tls*" EXCLUDE
54+
PATTERN "tls/ssl/**"
5455
)
5556
else()
5657
# Copy everything except autest_uds tests that are only for curl uds option

tests/gold_tests/basic/basic.test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@
2525
t.StillRunningAfter = Test.Processes.ts
2626

2727
p = t.Processes.Default
28-
t.MakeCurlCommand("http://127.0.0.1:{0}".format(ts.Variables.port))
28+
t.MakeCurlCommand("http://127.0.0.1:{0}".format(ts.Variables.port), uds_path=ts.Variables.uds_path)
2929
p.ReturnCode = 0
3030
p.StartBefore(Test.Processes.ts)

tests/gold_tests/basic/config.test.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@
2121

2222
ts = Test.MakeATSProcess("ts", select_ports=False)
2323
ts.Variables.port = 8090
24-
uds_path = os.path.join(Test.RunDirectory, 'uds.socket')
2524
ts.Disk.records_config.update({
26-
'proxy.config.http.server_ports': str(ts.Variables.port) + f" {uds_path}",
25+
'proxy.config.http.server_ports': str(ts.Variables.port) + f" {ts.Variables.uds_path}",
2726
})
2827
ts.Ready = When.PortOpen(ts.Variables.port)
2928
t = Test.AddTestRun("Test traffic server started properly")
3029
t.Processes.Default.StartBefore(ts)
31-
t.MakeCurlCommand("127.0.0.1:{port}".format(port=ts.Variables.port))
30+
t.MakeCurlCommand("127.0.0.1:{port}".format(port=ts.Variables.port), uds_path=ts.Variables.uds_path)
3231
t.ReturnCode = 0
3332
t.StillRunningAfter = ts

tests/gold_tests/basic/copy_config.test.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@
2222
# set up some ATS processes
2323
ts1 = Test.MakeATSProcess("ts1", select_ports=False)
2424
ts1.Variables.port = 8090
25-
uds_path = os.path.join(Test.RunDirectory, 'uds.socket')
2625
ts1.Disk.records_config.update({
27-
'proxy.config.http.server_ports': str(ts1.Variables.port) + f" {uds_path}",
26+
'proxy.config.http.server_ports': str(ts1.Variables.port) + f" {ts1.Variables.uds_path}",
2827
})
2928
ts1.Ready = When.PortOpen(ts1.Variables.port)
3029

@@ -39,14 +38,14 @@
3938
t = Test.AddTestRun("Talk to ts1")
4039
t.Processes.Default.StartBefore(ts1)
4140
t.Processes.Default.StartBefore(ts2)
42-
t.MakeCurlCommand("127.0.0.1:{port}".format(port=ts1.Variables.port), uds_path=ts.Variables.uds_path)
41+
t.MakeCurlCommand("127.0.0.1:{port}".format(port=ts1.Variables.port), uds_path=ts1.Variables.uds_path)
4342
t.ReturnCode = 0
4443
t.StillRunningAfter = ts1
4544
t.StillRunningAfter += ts2
4645

4746
# setup a testrun
4847
t = Test.AddTestRun("Talk to ts2")
49-
t.MakeCurlCommandMulti("{{curl_base}} 127.0.0.1:{port}".format(port=ts2.Variables.port), uds_path=ts.Variables.uds_path)
48+
t.MakeCurlCommandMulti("{{curl_base}} 127.0.0.1:{port}".format(port=ts2.Variables.port))
5049
t.ReturnCode = 0
5150
t.StillRunningAfter = ts1
5251
t.StillRunningAfter += ts2

tests/gold_tests/basic/copy_config2.test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
t.StillRunningAfter = ts1
2828
t.StillRunningAfter += ts2
2929
p = t.Processes.Default
30-
t.MakeCurlCommand("127.0.0.1:{0}".format(ts1.Variables.port))
30+
t.MakeCurlCommand("127.0.0.1:{0}".format(ts1.Variables.port), uds_path=ts1.Variables.uds_path)
3131
p.ReturnCode = 0
3232
p.StartBefore(Test.Processes.ts1)
3333
p.StartBefore(Test.Processes.ts2)
@@ -39,5 +39,5 @@
3939
t.StillRunningAfter = ts1
4040
t.StillRunningAfter += ts2
4141
p = t.Processes.Default
42-
t.MakeCurlCommand("127.0.0.1:{0}".format(ts2.Variables.port))
42+
t.MakeCurlCommand("127.0.0.1:{0}".format(ts2.Variables.port), uds_path=ts2.Variables.uds_path)
4343
p.ReturnCode = 0

tests/gold_tests/cache/cache-generation-disjoint.test.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@
5050
tr = Test.AddTestRun()
5151
tr.MakeCurlCommand(
5252
'"http://127.0.0.1:{0}/default/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose'.format(
53-
ts.Variables.port, objectid))
53+
ts.Variables.port, objectid),
54+
uds_path=ts.Variables.uds_path)
5455
tr.Processes.Default.ReturnCode = 0
5556
tr.Processes.Default.StartBefore(Test.Processes.ts)
5657
tr.Processes.Default.Streams.All = "gold/miss_default-1.gold"
@@ -59,38 +60,43 @@
5960
tr = Test.AddTestRun()
6061
tr.MakeCurlCommand(
6162
'"http://127.0.0.1:{0}/generation1/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose'.format(
62-
ts.Variables.port, objectid))
63+
ts.Variables.port, objectid),
64+
uds_path=ts.Variables.uds_path)
6365
tr.Processes.Default.ReturnCode = 0
6466
tr.Processes.Default.Streams.All = "gold/miss_gen1.gold"
6567

6668
# Same URL in generation 2 is still a MISS.
6769
tr = Test.AddTestRun()
6870
tr.MakeCurlCommand(
6971
'"http://127.0.0.1:{0}/generation2/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose'.format(
70-
ts.Variables.port, objectid))
72+
ts.Variables.port, objectid),
73+
uds_path=ts.Variables.uds_path)
7174
tr.Processes.Default.ReturnCode = 0
7275
tr.Processes.Default.Streams.All = "gold/miss_gen2.gold"
7376

7477
# Second touch is a HIT for default.
7578
tr = Test.AddTestRun()
7679
tr.MakeCurlCommand(
7780
'"http://127.0.0.1:{0}/default/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose'.format(
78-
ts.Variables.port, objectid))
81+
ts.Variables.port, objectid),
82+
uds_path=ts.Variables.uds_path)
7983
tr.Processes.Default.ReturnCode = 0
8084
tr.Processes.Default.Streams.All = "gold/hit_default-1.gold"
8185

8286
# Second touch is a HIT for generation1.
8387
tr = Test.AddTestRun()
8488
tr.MakeCurlCommand(
8589
'"http://127.0.0.1:{0}/generation1/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose'.format(
86-
ts.Variables.port, objectid))
90+
ts.Variables.port, objectid),
91+
uds_path=ts.Variables.uds_path)
8792
tr.Processes.Default.ReturnCode = 0
8893
tr.Processes.Default.Streams.All = "gold/hit_gen1.gold"
8994

9095
# Second touch is a HIT for generation2.
9196
tr = Test.AddTestRun()
9297
tr.MakeCurlCommand(
9398
'"http://127.0.0.1:{0}/generation2/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose'.format(
94-
ts.Variables.port, objectid))
99+
ts.Variables.port, objectid),
100+
uds_path=ts.Variables.uds_path)
95101
tr.Processes.Default.ReturnCode = 0
96102
tr.Processes.Default.Streams.All = "gold/hit_gen2.gold"

tests/gold_tests/cache/disjoint-wait-for-cache.test.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@
5353
tr = Test.AddTestRun()
5454
tr.MakeCurlCommand(
5555
'"http://127.0.0.1:{0}/default/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose'.format(
56-
ts.Variables.port, objectid))
56+
ts.Variables.port, objectid),
57+
uds_path=ts.Variables.uds_path)
5758
tr.Processes.Default.ReturnCode = 0
5859
tr.Processes.Default.StartBefore(Test.Processes.ts)
5960
tr.Processes.Default.Streams.All = "gold/miss_default-1.gold"
@@ -62,38 +63,43 @@
6263
tr = Test.AddTestRun()
6364
tr.MakeCurlCommand(
6465
'"http://127.0.0.1:{0}/generation1/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose -o /dev/null'
65-
.format(ts.Variables.port, objectid))
66+
.format(ts.Variables.port, objectid),
67+
uds_path=ts.Variables.uds_path)
6668
tr.Processes.Default.ReturnCode = 0
6769
tr.Processes.Default.Streams.All = "gold/miss_gen1.gold"
6870

6971
# Same URL in generation 2 is still a MISS.
7072
tr = Test.AddTestRun()
7173
tr.MakeCurlCommand(
7274
'"http://127.0.0.1:{0}/generation2/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose -o /dev/null'
73-
.format(ts.Variables.port, objectid))
75+
.format(ts.Variables.port, objectid),
76+
uds_path=ts.Variables.uds_path)
7477
tr.Processes.Default.ReturnCode = 0
7578
tr.Processes.Default.Streams.All = "gold/miss_gen2.gold"
7679

7780
# Second touch is a HIT for default.
7881
tr = Test.AddTestRun()
7982
tr.MakeCurlCommand(
8083
'"http://127.0.0.1:{0}/default/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose -o /dev/null'
81-
.format(ts.Variables.port, objectid))
84+
.format(ts.Variables.port, objectid),
85+
uds_path=ts.Variables.uds_path)
8286
tr.Processes.Default.ReturnCode = 0
8387
tr.Processes.Default.Streams.All = "gold/hit_default-1.gold"
8488

8589
# Second touch is a HIT for generation1.
8690
tr = Test.AddTestRun()
8791
tr.MakeCurlCommand(
8892
'"http://127.0.0.1:{0}/generation1/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose -o /dev/null'
89-
.format(ts.Variables.port, objectid))
93+
.format(ts.Variables.port, objectid),
94+
uds_path=ts.Variables.uds_path)
9095
tr.Processes.Default.ReturnCode = 0
9196
tr.Processes.Default.Streams.All = "gold/hit_gen1.gold"
9297

9398
# Second touch is a HIT for generation2.
9499
tr = Test.AddTestRun()
95100
tr.MakeCurlCommand(
96101
'"http://127.0.0.1:{0}/generation2/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose -o /dev/null'
97-
.format(ts.Variables.port, objectid))
102+
.format(ts.Variables.port, objectid),
103+
uds_path=ts.Variables.uds_path)
98104
tr.Processes.Default.ReturnCode = 0
99105
tr.Processes.Default.Streams.All = "gold/hit_gen2.gold"

tests/gold_tests/chunked_encoding/bad_chunked_encoding.test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
tr.TimeOut = 5
5252
tr.MakeCurlCommand(
5353
'-H "host: example.com" -H "transfer-encoding: gzip" -d "stuff" http://127.0.0.1:{0}/case1 --verbose'.format(
54-
ts.Variables.port))
54+
ts.Variables.port),
55+
uds_path=ts.Variables.uds_path)
5556
tr.Processes.Default.ReturnCode = 0
5657
tr.Processes.Default.StartBefore(server)
5758
tr.Processes.Default.StartBefore(ts)
@@ -65,7 +66,8 @@
6566
tr.TimeOut = 5
6667
tr.MakeCurlCommand(
6768
'-H "host: example.com" -H "transfer-encoding: gzip" -H "transfer-encoding: chunked" -d "stuff" http://127.0.0.1:{0}/case1 --verbose'
68-
.format(ts.Variables.port))
69+
.format(ts.Variables.port),
70+
uds_path=ts.Variables.uds_path)
6971
tr.Processes.Default.ReturnCode = 0
7072
tr.Processes.Default.Streams.All = Testers.ContainsExpression("501 Field not implemented", "Should fail")
7173
tr.Processes.Default.Streams.All = Testers.ExcludesExpression("200 OK", "Should not succeed")

tests/gold_tests/connect/connect.test.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,16 @@ def __checkProcessAfter(self, tr):
8484
def __testCase0(self):
8585
tr = Test.AddTestRun()
8686
self.__checkProcessBefore(tr)
87-
tr.MakeCurlCommand(f"-v --fail -s -p -x 127.0.0.1:{self.ts.Variables.port} 'http://foo.com/get'")
88-
tr.Processes.Default.ReturnCode = 0
8987
if Condition.CurlUsingUnixDomainSocket():
88+
tr.MakeCurlCommand(
89+
f"-v --fail -s -X CONNECT -p -x 127.0.0.1:{self.ts.Variables.port} 'http://foo.com/get'",
90+
uds_path=self.ts.Variables.uds_path)
9091
tr.Processes.Default.Streams.stderr = "gold/connect_0_stderr_uds.gold"
9192
else:
93+
tr.MakeCurlCommand(
94+
f"-v --fail -s -p -x 127.0.0.1:{self.ts.Variables.port} 'http://foo.com/get'", uds_path=self.ts.Variables.uds_path)
9295
tr.Processes.Default.Streams.stderr = "gold/connect_0_stderr.gold"
96+
tr.Processes.Default.ReturnCode = 0
9397
tr.Processes.Default.TimeOut = 3
9498
self.__checkProcessAfter(tr)
9599

tests/gold_tests/continuations/double.test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
# Create a bunch of curl commands to be executed in parallel. Default.Process is set in SpawnCurlCommands.
6969
# On Fedora 28/29, it seems that curl will occasionally timeout after a couple seconds and return exitcode 2
7070
# Examining the packet capture shows that Traffic Server dutifully sends the response
71-
ps = tr.SpawnCurlCommands(cmdstr=cmd, count=numberOfRequests, retcode=Any(0, 2))
71+
ps = tr.SpawnCurlCommands(cmdstr=cmd, count=numberOfRequests, retcode=Any(0, 2), uds_path=ts.Variables.uds_path)
7272
tr.Processes.Default.Env = ts.Env
7373
tr.Processes.Default.ReturnCode = Any(0, 2)
7474

0 commit comments

Comments
 (0)