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
6 changes: 0 additions & 6 deletions tests/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ dnslib = "*"
# These are likely to be available via yum/dnf or apt-get
requests = "*"
gunicorn = "*"
httpbin = "*"
psutil = "*"

# Keep init.cli.ext updated with this required microserver version.
Expand All @@ -44,11 +43,6 @@ jsonschema = "*"
python-jose = "*"
pyyaml ="*"

# The latest version of Werkzeug (2.1.0) breaks httpbin because it removes
# deprecated function `BaseResponse` that httpbin directly or indirectly
# depends upon. Pinning Wekrzeug for now until httpbin or its dependencies is
# updated for the changed API.
Werkzeug = "==2.0.3"
flask = "==2.1.3"

[requires]
Expand Down
17 changes: 8 additions & 9 deletions tests/gold_tests/autest-site/httpbin.test.ext
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,23 @@
from ports import get_port


def MakeHttpBinServer(self, name, port=False, ip=False, delay=False, public_ip=False, ssl=False, options={}):
def MakeHttpBinServer(self, name, ip='127.0.0.1', port=None,
options={}) -> 'Process':
data_dir = os.path.join(self.RunDirectory, name)
# create Process
p = self.Processes.Process(name)
if (port == False):
if port is None:
port = get_port(p, "Port")
if (ip == False):
ip = '127.0.0.1'
if (delay == False):
delay = 0

self._RootRunable.SkipUnless(
Condition.HasProgram("gunicorn", "gunicorn needs be installed with httpbin package for this extension to run")
Condition.HasProgram(
"go-httpbin",
"go-httpbin needs be installed and in PATH for this extension to run")
)

command = "gunicorn -b {0}:{1} httpbin:app".format(ip, port)
command = f"go-httpbin -host {ip} -port {port} "
for flag, value in options.items():
command += " {} {}".format(flag, value)
command += f"{flag} {value} "

# create process
p.Command = command
Expand Down
6 changes: 3 additions & 3 deletions tests/gold_tests/cache/background_fill.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def __testCase0(self):
tr.Processes.Default.Command = f"""
curl -X PURGE --http1.1 -vs http://127.0.0.1:{self.ts.Variables.port}/drip?duration=4;
timeout 2 curl --http1.1 -vs http://127.0.0.1:{self.ts.Variables.port}/drip?duration=4;
sleep 2;
sleep 4;
curl --http1.1 -vs http://127.0.0.1:{self.ts.Variables.port}/drip?duration=4
"""
tr.Processes.Default.ReturnCode = 0
Expand All @@ -107,7 +107,7 @@ def __testCase1(self):
tr.Processes.Default.Command = f"""
curl -X PURGE --http1.1 -vsk https://127.0.0.1:{self.ts.Variables.ssl_port}/drip?duration=4;
timeout 2 curl --http1.1 -vsk https://127.0.0.1:{self.ts.Variables.ssl_port}/drip?duration=4;
sleep 2;
sleep 4;
curl --http1.1 -vsk https://127.0.0.1:{self.ts.Variables.ssl_port}/drip?duration=4
"""
tr.Processes.Default.ReturnCode = 0
Expand All @@ -123,7 +123,7 @@ def __testCase2(self):
tr.Processes.Default.Command = f"""
curl -X PURGE --http2 -vsk https://127.0.0.1:{self.ts.Variables.ssl_port}/drip?duration=4;
timeout 2 curl --http2 -vsk https://127.0.0.1:{self.ts.Variables.ssl_port}/drip?duration=4;
sleep 2;
sleep 4;
curl --http2 -vsk https://127.0.0.1:{self.ts.Variables.ssl_port}/drip?duration=4
"""
tr.Processes.Default.ReturnCode = 0
Expand Down
1 change: 0 additions & 1 deletion tests/gold_tests/connect/gold/connect_0_stderr.gold
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@
``
<``
``
* Closing connection 0
7 changes: 3 additions & 4 deletions tests/gold_tests/h2/gold/httpbin_0_stderr.gold
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
> Accept: */*
``
< HTTP/2 200 ``
< server: ATS/``
< date: ``
< content-type: application/json
``
< content-type: application/json; encoding=utf-8
< date: ``
< content-length: ``
< age: ``
< via: ``ApacheTrafficServer/``
``
< server: ATS/``
8 changes: 4 additions & 4 deletions tests/gold_tests/h2/gold/httpbin_1_stderr.gold
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
> Accept: */*
``
< HTTP/2 200 ``
< server: ATS/``
< date: ``
< content-type: application/octet-stream
``
< content-length: 0``
< content-type: application/octet-stream
< date: ``
< content-length: ``
< age: ``
< via: ``ApacheTrafficServer/``
< server: ATS/``
``
1 change: 1 addition & 0 deletions tests/gold_tests/h2/gold/httpbin_1_stdout.gold
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
``
6 changes: 3 additions & 3 deletions tests/gold_tests/h2/gold/httpbin_2_stderr.gold
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
> Accept: */*
``
< HTTP/2 200 ``
< server: ATS/``
< date: ``
< content-type: application/octet-stream
``
< content-type: application/octet-stream
< date: ``
< age: ``
< via: ``ApacheTrafficServer/``
< server: ATS/``
``
2 changes: 1 addition & 1 deletion tests/gold_tests/h2/gold/httpbin_2_stdout.gold
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b99e42637ce13160c48e9b2bc9ed2d4dd175bc6cf44c7814b01e4853f262b284 -
7a884625d64511d986423b361d75a5d037d7fa62b9ecf0959b93adda1afe07ef -
4 changes: 3 additions & 1 deletion tests/gold_tests/h2/gold/httpbin_3_stdout.gold
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
``
"form": {
"key": "value"
"key": [
"value"
]
},
``
}
2 changes: 1 addition & 1 deletion tests/gold_tests/h2/gold/httpbin_access.gold
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[``] GET http://127.0.0.1:``/get HTTP/1.1 http/2 `` `` TCP_MISS 200 ``
[``] GET http://127.0.0.1:``/bytes/0 HTTP/1.1 http/2 `` `` TCP_MISS 200 0
[``] GET http://127.0.0.1:``/bytes/0 HTTP/1.1 http/2 `` `` TCP_MISS 200 1
[``] GET http://127.0.0.1:``/stream-bytes/102400?seed=0 HTTP/1.1 http/2 `` `` TCP_MISS 200 102400
``
4 changes: 3 additions & 1 deletion tests/gold_tests/h2/httpbin.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@
test_run.Processes.Default.Streams.stderr = Testers.GoldFile("gold/httpbin_0_stderr.gold", case_insensitive=True)
test_run.StillRunningAfter = httpbin

# Test Case 1: Empty response body
# Test Case 1: Attempt an empty response body.
# Note: go-httpbin incorrectly returns a body of 1 byte instead of 0 bytes.
# https://github.com/mccutchen/go-httpbin/issues/112
test_run = Test.AddTestRun()
test_run.Processes.Default.Command = 'curl -vs -k --http2 https://127.0.0.1:{0}/bytes/0'.format(ts.Variables.ssl_port)
test_run.Processes.Default.ReturnCode = 0
Expand Down
Loading