Skip to content

Commit 2b2feb6

Browse files
author
Serris Lew
committed
Update curl command from uds_path to ts arg
1 parent 2a03732 commit 2b2feb6

File tree

124 files changed

+430
-545
lines changed

Some content is hidden

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

124 files changed

+430
-545
lines changed

tests/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ ts=Test.MakeATSProcess("ts")
132132
#first test is a miss for default
133133
tr=Test.AddTestRun()
134134
# get port for command from Variables
135-
tr.MakeCurlCommand('"http://127.0.0.1:{0}" --verbose'.format(ts.Variables.port), uds_path=ts.Variables.uds_path)
135+
tr.MakeCurlCommand('"http://127.0.0.1:{0}" --verbose'.format(ts.Variables.port), ts=ts)
136136

137137
```
138138

tests/gold_tests/autest-site/curl.test.ext

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ Tools to help with TestRun commands
3030
#
3131

3232

33-
def spawn_curl_commands(self, cmdstr, count, retcode=0, use_default=True, uds_path=""):
33+
def spawn_curl_commands(self, cmdstr, count, retcode=0, use_default=True, ts):
3434
ret = []
3535

3636
if self.Variables.get("CurlUds", False):
37-
cmdstr = f'curl --unix-socket {uds_path} ' + cmdstr
37+
cmdstr = f'curl --unix-socket {ts.Variables.uds_path} ' + cmdstr
3838
else:
3939
cmdstr = 'curl ' + cmdstr
4040
if use_default:
@@ -48,20 +48,20 @@ def spawn_curl_commands(self, cmdstr, count, retcode=0, use_default=True, uds_pa
4848
return ret
4949

5050

51-
def curl_command(self, cmd, uds_path="", p=None):
51+
def curl_command(self, cmd, ts, p=None):
5252
if p == None:
5353
p = self.Processes.Default
5454
if self.Variables.get("CurlUds", False):
55-
p.Command = f'curl --unix-socket {uds_path} ' + cmd
55+
p.Command = f'curl --unix-socket {ts.Variables.uds_path} ' + cmd
5656
else:
5757
p.Command = 'curl ' + cmd
5858
return p
5959

6060

61-
def curl_multiple_commands(self, cmd, uds_path=""):
61+
def curl_multiple_commands(self, cmd, ts):
6262
p = self.Processes.Default
6363
if self.Variables.get("CurlUds", False):
64-
p.Command = cmd.format(curl=f'curl --unix-socket {uds_path}', curl_base='curl')
64+
p.Command = cmd.format(curl=f'curl --unix-socket {ts.Variables.uds_path}', curl_base='curl')
6565
else:
6666
p.Command = cmd.format(curl='curl', curl_base='curl')
6767
return p

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), uds_path=ts.Variables.uds_path)
28+
t.MakeCurlCommand("http://127.0.0.1:{0}".format(ts.Variables.port), ts=ts)
2929
p.ReturnCode = 0
3030
p.StartBefore(Test.Processes.ts)

tests/gold_tests/basic/config.test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1616
# See the License for the specific language governing permissions and
1717
# limitations under the License.
18-
import os
1918

2019
Test.Summary = "Test start up of Traffic server with configuration modification of starting port"
2120

@@ -27,6 +26,6 @@
2726
ts.Ready = When.PortOpen(ts.Variables.port)
2827
t = Test.AddTestRun("Test traffic server started properly")
2928
t.Processes.Default.StartBefore(ts)
30-
t.MakeCurlCommand("127.0.0.1:{port}".format(port=ts.Variables.port), uds_path=ts.Variables.uds_path)
29+
t.MakeCurlCommand("127.0.0.1:{port}".format(port=ts.Variables.port), ts=ts)
3130
t.ReturnCode = 0
3231
t.StillRunningAfter = ts

tests/gold_tests/basic/copy_config.test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1616
# See the License for the specific language governing permissions and
1717
# limitations under the License.
18-
import os
1918

2019
Test.Summary = "Test start up of Traffic server with configuration modification of starting port of different servers at the same time"
2120

@@ -38,7 +37,7 @@
3837
t = Test.AddTestRun("Talk to ts1")
3938
t.Processes.Default.StartBefore(ts1)
4039
t.Processes.Default.StartBefore(ts2)
41-
t.MakeCurlCommand("127.0.0.1:{port}".format(port=ts1.Variables.port), uds_path=ts1.Variables.uds_path)
40+
t.MakeCurlCommand("127.0.0.1:{port}".format(port=ts1.Variables.port), ts=ts1)
4241
t.ReturnCode = 0
4342
t.StillRunningAfter = ts1
4443
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), uds_path=ts1.Variables.uds_path)
30+
t.MakeCurlCommand("127.0.0.1:{0}".format(ts1.Variables.port), ts=ts1)
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), uds_path=ts2.Variables.uds_path)
42+
t.MakeCurlCommand("127.0.0.1:{0}".format(ts2.Variables.port), ts=ts2)
4343
p.ReturnCode = 0

tests/gold_tests/bigobj/bigobj.test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ def create_pushfile():
7575
"-v -H 'Content-Type: application/octet-stream' --data-binary @{}/objfile -X PUSH http://localhost:{}/bigobj -H 'Content-Length:{}'"
7676
.format(Test.RunDirectory, ts.Variables.port,
7777
len(header) + obj_bytes),
78-
uds_path=ts.Variables.uds_path)
78+
ts=ts)
7979
tr.Processes.Default.ReturnCode = 0
8080
tr.Processes.Default.Streams.All = Testers.ContainsExpression("HTTP/1.1 201 Created", "The PUSH request should have succeeded")
8181

8282
tr = Test.AddTestRun("GET bigobj: cleartext, HTTP/1.1, IPv4")
83-
tr.MakeCurlCommand(f'--verbose {ipv4flag} --http1.1 http://localhost:{ts.Variables.port}/bigobj', uds_path=ts.Variables.uds_path)
83+
tr.MakeCurlCommand(f'--verbose {ipv4flag} --http1.1 http://localhost:{ts.Variables.port}/bigobj', ts=ts)
8484
tr.Processes.Default.ReturnCode = 0
8585
tr.Processes.Default.Streams.All = Testers.ContainsExpression("HTTP/1.1 200 OK", "Should fetch pushed object")
8686
tr.Processes.Default.Streams.All = Testers.ContainsExpression("Content-length: 102400", "Content size should be accurate")
@@ -131,7 +131,7 @@ def create_pushfile():
131131
"-v -H 'Content-Type: application/octet-stream' --data-binary @{}/objfile -X PUSH http://localhost:{}/bigobj -H 'Content-Length:{}'"
132132
.format(Test.RunDirectory, ts.Variables.port,
133133
len(header) + obj_bytes),
134-
uds_path=ts.Variables.uds_path)
134+
ts=ts)
135135
tr.Processes.Default.ReturnCode = 0
136136
tr.Processes.Default.Streams.All = Testers.ContainsExpression(
137137
"403 Access Denied", "The PUSH request should have received a 403 response.")

tests/gold_tests/cache/background_fill.test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def __testCase0(self):
114114
sleep 4;
115115
{{curl}} --http1.1 -vs http://127.0.0.1:{self.ts['for_httpbin'].Variables.port}/drip?duration=4
116116
""",
117-
uds_path=self.ts['for_httpbin'].Variables.uds_path)
117+
ts=self.ts['for_httpbin'])
118118
tr.Processes.Default.ReturnCode = 0
119119
tr.Processes.Default.Streams.stderr = Testers.Any(
120120
"gold/background_fill_0_stderr_H.gold", "gold/background_fill_0_stderr_W.gold")
@@ -133,7 +133,7 @@ def __testCase1(self):
133133
sleep 5;
134134
{{curl}} --http1.1 -vsk https://127.0.0.1:{self.ts['for_httpbin'].Variables.ssl_port}/drip?duration=4
135135
""",
136-
uds_path=self.ts['for_httpbin'].Variables.uds_path)
136+
ts=self.ts['for_httpbin'])
137137
tr.Processes.Default.ReturnCode = 0
138138
tr.Processes.Default.Streams.stderr = Testers.Any(
139139
"gold/background_fill_1_stderr_H.gold", "gold/background_fill_1_stderr_W.gold")
@@ -152,7 +152,7 @@ def __testCase2(self):
152152
sleep 5;
153153
{{curl}} --http2 -vsk https://127.0.0.1:{self.ts['for_httpbin'].Variables.ssl_port}/drip?duration=4
154154
""",
155-
uds_path=self.ts['for_httpbin'].Variables.uds_path)
155+
ts=self.ts['for_httpbin'])
156156
tr.Processes.Default.ReturnCode = 0
157157
tr.Processes.Default.Streams.stderr = Testers.Any(
158158
"gold/background_fill_2_stderr_H.gold", "gold/background_fill_2_stderr_W.gold")

tests/gold_tests/cache/cache-control.test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
tr.MakeCurlCommand(
8383
'-s -D - -v {ipv4} --http1.1 -H "x-debug: x-cache,via" -H "Host: www.example.com" http://localhost:{port}/max_age_10sec'.format(
8484
port=ts.Variables.port, ipv4=ipv4flag),
85-
uds_path=ts.Variables.uds_path)
85+
ts=ts)
8686
tr.Processes.Default.ReturnCode = 0
8787
tr.Processes.Default.Streams.stdout = "gold/cache_and_req_body-miss.gold"
8888
tr.StillRunningAfter = ts

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
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(
5353
ts.Variables.port, objectid),
54-
uds_path=ts.Variables.uds_path)
54+
ts=ts)
5555
tr.Processes.Default.ReturnCode = 0
5656
tr.Processes.Default.StartBefore(Test.Processes.ts)
5757
tr.Processes.Default.Streams.All = "gold/miss_default-1.gold"
@@ -61,7 +61,7 @@
6161
tr.MakeCurlCommand(
6262
'"http://127.0.0.1:{0}/default/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose'.format(
6363
ts.Variables.port, objectid),
64-
uds_path=ts.Variables.uds_path)
64+
ts=ts)
6565
tr.Processes.Default.ReturnCode = 0
6666
tr.Processes.Default.Streams.All = "gold/hit_default-1.gold"
6767

@@ -79,7 +79,7 @@
7979
tr.MakeCurlCommand(
8080
'"http://127.0.0.1:{0}/default/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose'.format(
8181
ts.Variables.port, objectid),
82-
uds_path=ts.Variables.uds_path)
82+
ts=ts)
8383
tr.Processes.Default.ReturnCode = 0
8484
tr.Processes.Default.Streams.All = "gold/miss_default77.gold"
8585

@@ -88,7 +88,7 @@
8888
tr.MakeCurlCommand(
8989
'"http://127.0.0.1:{0}/default/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose'.format(
9090
ts.Variables.port, objectid),
91-
uds_path=ts.Variables.uds_path)
91+
ts=ts)
9292
tr.Processes.Default.ReturnCode = 0
9393
tr.Processes.Default.Streams.All = "gold/hit_default77.gold"
9494

@@ -97,6 +97,6 @@
9797
tr.MakeCurlCommand(
9898
'"http://127.0.0.1:{0}/default/cache/10/{1}" -H "x-debug: x-cache,x-cache-key,via,x-cache-generation" --verbose'.format(
9999
ts.Variables.port, objectid),
100-
uds_path=ts.Variables.uds_path)
100+
ts=ts)
101101
tr.Processes.Default.ReturnCode = 0
102102
tr.Processes.Default.Streams.All = "gold/hit_default77.gold"

0 commit comments

Comments
 (0)