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
8 changes: 4 additions & 4 deletions tests/gold_tests/autest-site/curl.test.ext
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ Tools to help with TestRun commands
#


def spawn_curl_commands(self, cmdstr, count, ts, retcode=0, use_default=True):
def spawn_curl_commands(self, cmdstr, count, ts=None, retcode=0, use_default=True):
ret = []

if self.Variables.get("CurlUds", False):
if self.Variables.get("CurlUds", False) and ts != None:
cmdstr = f'curl --unix-socket {ts.Variables.uds_path} ' + cmdstr
else:
cmdstr = 'curl ' + cmdstr
Expand All @@ -51,7 +51,7 @@ def spawn_curl_commands(self, cmdstr, count, ts, retcode=0, use_default=True):
def curl_command(self, cmd, ts=None, p=None):
if p == None:
p = self.Processes.Default
if self.Variables.get("CurlUds", False):
if self.Variables.get("CurlUds", False) and ts != None:
# curl via UDS doesn't add this header when proxy flag enabled, need to explicitly set for test
# unless pipe is found, indicating multiple commands
if "--proxy" in cmd and "|" not in cmd:
Expand All @@ -64,7 +64,7 @@ def curl_command(self, cmd, ts=None, p=None):

def curl_multiple_commands(self, cmd, ts=None):
p = self.Processes.Default
if self.Variables.get("CurlUds", False):
if self.Variables.get("CurlUds", False) and ts != None:
p.Command = cmd.format(curl=f'curl --unix-socket {ts.Variables.uds_path}', curl_base='curl')
else:
p.Command = cmd.format(curl='curl', curl_base='curl')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ def _setupJqValidation(self) -> None:
tr.MakeCurlCommand(
f'-s -H"uuid: 1" -H "Host: example.com" -H "X-Debug: probe-full-json" '
f'http://127.0.0.1:{self._ts.Variables.port}/test | '
"jq '.\"client-request\".\"uuid\",.\"server-body\",.\"proxy-response\".\"x-response\"'")
"jq '.\"client-request\".\"uuid\",.\"server-body\",.\"proxy-response\".\"x-response\"'",
ts=self._ts)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "gold/jq_escaped.gold"

Expand All @@ -101,7 +102,8 @@ def _setupJqValidation(self) -> None:
tr.MakeCurlCommand(
f'-s -H"uuid: 2" -H "Host: example.com" -H "X-Debug: probe-full-json" '
f'http://127.0.0.1:{self._ts.Variables.port}/binary | '
"jq '.\"client-request\".\"uuid\",.\"server-body\",.\"proxy-response\".\"x-response\"'")
"jq '.\"client-request\".\"uuid\",.\"server-body\",.\"proxy-response\".\"x-response\"'",
ts=self._ts)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout += "gold/jq_hex.gold"

Expand All @@ -110,7 +112,8 @@ def _setupJqValidation(self) -> None:
tr.MakeCurlCommand(
f'-s -H"uuid: 1" -H "Host: example.com" -H "X-Debug: probe-full-json=hex" '
f'http://127.0.0.1:{self._ts.Variables.port}/test | '
"jq '.\"server-body\"'")
"jq '.\"server-body\"'",
ts=self._ts)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout += Testers.ContainsExpression(
'3c21444f43545950452068746d6c3e', "Should contain hex-encoded HTML content (forced hex override)")
Expand All @@ -120,7 +123,8 @@ def _setupJqValidation(self) -> None:
tr.MakeCurlCommand(
f'-s -H"uuid: 1" -H "Host: example.com" -H "X-Debug: probe-full-json=escape" '
f'http://127.0.0.1:{self._ts.Variables.port}/test | '
"jq '.\"client-request\".\"uuid\",.\"server-body\",.\"proxy-response\".\"x-response\"'")
"jq '.\"client-request\".\"uuid\",.\"server-body\",.\"proxy-response\".\"x-response\"'",
ts=self._ts)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout += "gold/jq_escaped.gold"

Expand All @@ -129,7 +133,8 @@ def _setupJqValidation(self) -> None:
tr.MakeCurlCommand(
f'-s -H"uuid: 1" -H "Host: example.com" -H "X-Debug: probe-full-json=nobody" '
f'http://127.0.0.1:{self._ts.Variables.port}/test | '
"jq '.\"client-request\".\"uuid\",.\"server-body\",.\"proxy-response\".\"x-response\"'")
"jq '.\"client-request\".\"uuid\",.\"server-body\",.\"proxy-response\".\"x-response\"'",
ts=self._ts)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout += "gold/jq_nobody.gold"

Expand Down