diff --git a/Makefile.am b/Makefile.am
index abcc9710f9d..0d06504400d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -112,7 +112,15 @@ rat:
java -jar $(top_srcdir)/ci/apache-rat-0.13-SNAPSHOT.jar -E $(top_srcdir)/ci/rat-regex.txt -d $(top_srcdir)
autopep8:
- @autopep8 -i -r $(top_srcdir)
+ @autopep8 \
+ --ignore-local-config \
+ -i \
+ -j 0 \
+ --exclude $(top_srcdir)/lib/yamlcpp \
+ --max-line-length 132 \
+ --aggressive \
+ --aggressive \
+ -r $(top_srcdir)
#
# These are rules to make clang-format easy and fast to run. Run it with e.g.
diff --git a/doc/checkvers.py b/doc/checkvers.py
index e16e7e4d3e9..6f1addc5746 100644
--- a/doc/checkvers.py
+++ b/doc/checkvers.py
@@ -28,7 +28,7 @@
# Check whether we have the required version of sphinx.
if options.checkvers:
- min_sphinx_version_info = (1,7,5)
+ min_sphinx_version_info = (1, 7, 5)
min_sphinx_version = '.'.join([str(x) for x in min_sphinx_version_info])
print('checking for sphinx version >= {0}... '.format(min_sphinx_version), end="")
@@ -65,5 +65,5 @@
import sphinxcontrib.plantuml
print('yes')
except Exception as e:
- print(e);
+ print(e)
sys.exit(1)
diff --git a/doc/conf.py b/doc/conf.py
index eefc2d4622d..599e9d332d9 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -27,6 +27,14 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
+from sphinx.writers import manpage
+from docutils.transforms import frontmatter
+from docutils.utils import unescape
+from docutils.utils import punctuation_chars
+from docutils.parsers.rst import states
+from docutils import nodes
+import re
+from manpages import man_pages
import sys
import os
from datetime import date
@@ -39,7 +47,6 @@
sys.path.insert(0, os.path.abspath('ext'))
sys.path.insert(0, os.path.abspath('.'))
-from manpages import man_pages
# -- General configuration -----------------------------------------------------
@@ -58,7 +65,7 @@
# Contains values that are dependent on configure.ac.
LOCAL_CONFIG = 'ext/local-config.py'
-with open(LOCAL_CONFIG) as f :
+with open(LOCAL_CONFIG) as f:
exec(compile(f.read(), LOCAL_CONFIG, 'exec'))
if version_info >= (1, 4):
@@ -96,10 +103,9 @@
# work identically when building with Autotools (e.g. $ make html)
# and without (e.g. on Read the Docs)
-import re
contents = open('../configure.ac').read()
-match = re.compile('m4_define\(\[TS_VERSION_S],\[(.*?)]\)').search(contents)
+match = re.compile(r'm4_define\(\[TS_VERSION_S],\[(.*?)]\)').search(contents)
# The full version, including alpha/beta/rc tags.
release = match.group(1)
@@ -134,7 +140,7 @@
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
- except:
+ except BaseException:
pass
# End of HACK
@@ -169,22 +175,15 @@
#modindex_common_prefix = []
nitpicky = True
-nitpick_ignore = [ ('c:type', 'int64_t')
- , ('c:type', 'bool')
- , ('c:type', 'sockaddr')
- , ('cpp:identifier', 'T') # template arg
- , ('cpp:identifier', 'F') # template arg
- , ('cpp:identifier', 'Args') # variadic template arg
- , ('cpp:identifier', 'Rest') # variadic template arg
- ]
+nitpick_ignore = [('c:type', 'int64_t'), ('c:type', 'bool'), ('c:type', 'sockaddr'), ('cpp:identifier', 'T') # template arg
+ , ('cpp:identifier', 'F') # template arg
+ , ('cpp:identifier', 'Args') # variadic template arg
+ , ('cpp:identifier', 'Rest') # variadic template arg
+ ]
# Autolink issue references.
# See Customizing the Parser in the docutils.parsers.rst module.
-from docutils import nodes
-from docutils.parsers.rst import states
-from docutils.utils import punctuation_chars
-from docutils.utils import unescape
# Customize parser.inliner in the only way that Sphinx supports.
# docutils.parsers.rst.Parser takes an instance of states.Inliner or a
@@ -337,13 +336,13 @@ def issue_reference(self, match, lineno):
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
- #'papersize': 'letterpaper',
+ # 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
- #'pointsize': '10pt',
+ # 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
- #'preamble': '',
+ # 'preamble': '',
}
if 'latex_a4' in tags:
@@ -390,8 +389,6 @@ def issue_reference(self, match, lineno):
# documents and includes the same brief description in both the HTML
# and manual page outputs.
-from docutils.transforms import frontmatter
-from sphinx.writers import manpage
# Override ManualPageWriter and ManualPageTranslator in the only way
# that Sphinx supports
@@ -507,4 +504,4 @@ def __init__(self, builder, *args, **kwds):
# Enabling marking bit fields as 'bitfield_N`.
# Currently parameterized fields don't work. When they do, we should change to
# 'bitfield(N)'.
-cpp_id_attributes = [ 'bitfield_1', 'bitfield_3', 'bitfield_24' ]
+cpp_id_attributes = ['bitfield_1', 'bitfield_3', 'bitfield_24']
diff --git a/doc/ext/doxygen.py b/doc/ext/doxygen.py
index 7ffdc004ab3..6d896693907 100644
--- a/doc/ext/doxygen.py
+++ b/doc/ext/doxygen.py
@@ -44,7 +44,7 @@ def escape(name):
Partial reimplementation in Python of Doxygen escapeCharsInString()
"""
- return name.replace('_', '__').replace(':', '_1').replace('/', '_2').replace('<', '_3').replace('>', '_4').replace('*', '_5').replace('&', '_6').replace('|', '_7').replace('.', '_8').replace('!', '_9').replace(',', '_00').replace(' ', '_01').replace('{', '_02').replace('}', '_03').replace('?', '_04').replace('^', '_05').replace('%', '_06').replace('(', '_07').replace(')', '_08').replace('+', '_09').replace('=', '_0A').replace('$', '_0B').replace('\\', '_0C')
+ return name.replace('_', '__').replace(':', '_1').replace('/', '_2').replace('<', '_3').replace('>', '_4').replace('*', '_5').replace('&', '_6').replace('|', '_7').replace('.', '_8').replace('!', '_9').replace(',', '_00').replace(' ', '_01').replace('{', '_02').replace('}', '_03').replace('?', '_04').replace('^', '_05').replace('%', '_06').replace('(', '_07').replace(')', '_08').replace('+', '_09').replace('=', '_0A').replace('$', '_0B').replace('\\', '_0C') # nopep8
class doctree_resolved:
@@ -66,7 +66,9 @@ def __init__(self, app, doctree, docname):
# Style the links
raw = nodes.raw(
- '', '', format='html')
+ '',
+ '',
+ format='html')
doctree.insert(0, raw)
def traverse(self, node, owner):
@@ -108,7 +110,8 @@ def traverse(self, node, owner):
cache[filename] = etree.parse('xml/' + filename)
# An enumvalue has no location
- memberdef, = cache[filename].xpath('descendant::compounddef[compoundname[text() = $name]]', name=name) or cache[filename].xpath(
+ memberdef, = cache[filename].xpath(
+ 'descendant::compounddef[compoundname[text() = $name]]', name=name) or cache[filename].xpath(
'descendant::memberdef[name[text() = $name] | enumvalue[name[text() = $name]]]', name=name)
# Append the link after the object's signature.
diff --git a/doc/ext/traffic-server.py b/doc/ext/traffic-server.py
index 9cf7c9dc8bf..20336945ad8 100644
--- a/doc/ext/traffic-server.py
+++ b/doc/ext/traffic-server.py
@@ -47,6 +47,7 @@ def is_string_type(s):
def is_string_type(s):
return isinstance(s, str)
+
class TSConfVar(std.Target):
"""
Description of a traffic server configuration variable.
@@ -168,7 +169,19 @@ def metrictypes(typename):
def metricunits(unitname):
- return directives.choice(unitname.lower(), ('ratio', 'percent', 'kbits', 'mbits', 'bytes', 'kbytes', 'mbytes', 'nanoseconds', 'microseconds', 'milliseconds', 'seconds'))
+ return directives.choice(
+ unitname.lower(),
+ ('ratio',
+ 'percent',
+ 'kbits',
+ 'mbits',
+ 'bytes',
+ 'kbytes',
+ 'mbytes',
+ 'nanoseconds',
+ 'microseconds',
+ 'milliseconds',
+ 'seconds'))
class TSStat(std.Target):
diff --git a/plugins/experimental/metalink/test/chunkedEncoding b/plugins/experimental/metalink/test/chunkedEncoding
index 000019be12b..e2c26139a51 100755
--- a/plugins/experimental/metalink/test/chunkedEncoding
+++ b/plugins/experimental/metalink/test/chunkedEncoding
@@ -16,12 +16,12 @@
# implied. See the License for the specific language governing
# permissions and limitations under the License.
+from twisted.web import http
+from twisted.internet import error, protocol, reactor, tcp
+
print '''1..1 chunkedEncoding
# The proxy forwards the final chunk at the end of a chunked response'''
-from twisted.internet import error, protocol, reactor, tcp
-from twisted.web import http
-
def callback():
print 'not ok 1 - No final chunk yet'
diff --git a/plugins/experimental/metalink/test/chunkedEncodingDisconnect b/plugins/experimental/metalink/test/chunkedEncodingDisconnect
index 8e5cd458b9e..0fa3bc193bf 100755
--- a/plugins/experimental/metalink/test/chunkedEncodingDisconnect
+++ b/plugins/experimental/metalink/test/chunkedEncodingDisconnect
@@ -16,13 +16,13 @@
# implied. See the License for the specific language governing
# permissions and limitations under the License.
+from twisted.internet import error, protocol, reactor, tcp
+from twisted.web import http
+
print '''1..1 chunkedEncodingDisconnect
# The proxy closes the client connection and doesn't send a final
# chunk if the origin disconnects without sending one'''
-from twisted.internet import error, protocol, reactor, tcp
-from twisted.web import http
-
def callback():
print 'not ok 1 - The client was left hanging'
diff --git a/plugins/experimental/metalink/test/clientDisconnect b/plugins/experimental/metalink/test/clientDisconnect
index 54398d2ecdd..af2258a5735 100755
--- a/plugins/experimental/metalink/test/clientDisconnect
+++ b/plugins/experimental/metalink/test/clientDisconnect
@@ -16,12 +16,12 @@
# implied. See the License for the specific language governing
# permissions and limitations under the License.
-print '''1..1 clientDissconnect
-# The proxy doesn't crash if the client disconnects prematurely'''
-
from twisted.internet import error, protocol, reactor, tcp
from twisted.web import http
+print '''1..1 clientDissconnect
+# The proxy doesn't crash if the client disconnects prematurely'''
+
def callback():
print 'not ok 1 - Why didn\'t the test finish yet?'
diff --git a/plugins/experimental/metalink/test/contentLength b/plugins/experimental/metalink/test/contentLength
index d9635b2cb17..f3bab947f80 100755
--- a/plugins/experimental/metalink/test/contentLength
+++ b/plugins/experimental/metalink/test/contentLength
@@ -16,12 +16,12 @@
# implied. See the License for the specific language governing
# permissions and limitations under the License.
-print '''1..1 contentLength
-# The proxy forwards the Content-Length header to the client'''
-
from twisted.internet import error, protocol, reactor, tcp
from twisted.web import http
+print '''1..1 contentLength
+# The proxy forwards the Content-Length header to the client'''
+
def callback():
print 'not ok 1 - Why didn\'t the test finish yet?'
diff --git a/plugins/experimental/metalink/test/contentLengthDisconnect b/plugins/experimental/metalink/test/contentLengthDisconnect
index 17c371a7f49..cb39cd36997 100755
--- a/plugins/experimental/metalink/test/contentLengthDisconnect
+++ b/plugins/experimental/metalink/test/contentLengthDisconnect
@@ -16,13 +16,13 @@
# implied. See the License for the specific language governing
# permissions and limitations under the License.
+from twisted.internet import error, protocol, reactor, tcp
+from twisted.web import http
+
print '''1..2 contentLengthDisconnect
# The proxy closes the client connection if the origin disconnects
# prematurely'''
-from twisted.internet import error, protocol, reactor, tcp
-from twisted.web import http
-
def callback():
print 'not ok 2 - The client was left hanging'
diff --git a/plugins/experimental/metalink/test/finalChunkedEncodingDisconnect b/plugins/experimental/metalink/test/finalChunkedEncodingDisconnect
index 41887a92a33..8db9e4e0712 100755
--- a/plugins/experimental/metalink/test/finalChunkedEncodingDisconnect
+++ b/plugins/experimental/metalink/test/finalChunkedEncodingDisconnect
@@ -16,13 +16,13 @@
# implied. See the License for the specific language governing
# permissions and limitations under the License.
+from twisted.internet import error, protocol, reactor, tcp
+from twisted.web import http
+
print '''1..1 finalChunkEncodingDisconnect
# The proxy forwards the final chunk even if the origin disconnects
# immediately afterward'''
-from twisted.internet import error, protocol, reactor, tcp
-from twisted.web import http
-
def callback():
print 'not ok 1 - No final chunk yet'
diff --git a/plugins/experimental/metalink/test/headers b/plugins/experimental/metalink/test/headers
index adc071a12c5..b6451e46a9b 100755
--- a/plugins/experimental/metalink/test/headers
+++ b/plugins/experimental/metalink/test/headers
@@ -16,12 +16,12 @@
# implied. See the License for the specific language governing
# permissions and limitations under the License.
-print '''1..1 headers
-# The response isn't held up until the origin starts sending content'''
-
from twisted.internet import error, protocol, reactor, tcp
from twisted.web import http
+print '''1..1 headers
+# The response isn't held up until the origin starts sending content'''
+
def callback():
print 'not ok 1 - No response yet'
diff --git a/plugins/experimental/metalink/test/http09 b/plugins/experimental/metalink/test/http09
index 675459a9ef4..0e7e0ef42e3 100755
--- a/plugins/experimental/metalink/test/http09
+++ b/plugins/experimental/metalink/test/http09
@@ -16,9 +16,6 @@
# implied. See the License for the specific language governing
# permissions and limitations under the License.
-print '''1..1 http09
-# The proxy doesn't crash on an HTTP/0.9 response'''
-
# http://www.w3.org/Protocols/HTTP/AsImplemented
#
# The proxy crashes only after the response is complete. It closes
@@ -32,6 +29,9 @@ print '''1..1 http09
from twisted.internet import error, protocol, reactor, tcp
from twisted.web import http
+print '''1..1 http09
+# The proxy doesn't crash on an HTTP/0.9 response'''
+
def callback():
print 'not ok 1 - Why didn\'t the test finish yet?'
diff --git a/plugins/experimental/metalink/test/location b/plugins/experimental/metalink/test/location
index 30ed48846d0..4a0b7704e1f 100755
--- a/plugins/experimental/metalink/test/location
+++ b/plugins/experimental/metalink/test/location
@@ -16,12 +16,12 @@
# implied. See the License for the specific language governing
# permissions and limitations under the License.
-print '''1..2 location
-# The proxy rewrites the Location header if the file is already cached'''
-
from twisted.internet import error, protocol, reactor, tcp
from twisted.web import http
+print '''1..2 location
+# The proxy rewrites the Location header if the file is already cached'''
+
def callback():
print 'not ok 1 - Why didn\'t the test finish yet?'
diff --git a/plugins/experimental/metalink/test/longer b/plugins/experimental/metalink/test/longer
index d56d18c9eba..d7e48f36f93 100755
--- a/plugins/experimental/metalink/test/longer
+++ b/plugins/experimental/metalink/test/longer
@@ -16,16 +16,16 @@
# implied. See the License for the specific language governing
# permissions and limitations under the License.
-print '''1..1 longer
-# The proxy doesn't choke if the origin sends more content than it
-# advertised'''
-
# Unlike the contentLength test, don't stop the reactor at the end of
# the headers. Give the proxy time to choke.
from twisted.internet import error, protocol, reactor, tcp
from twisted.web import http
+print '''1..1 longer
+# The proxy doesn't choke if the origin sends more content than it
+# advertised'''
+
def callback():
print 'not ok 1 - No Content-Length header'
diff --git a/plugins/experimental/metalink/test/notCacheable b/plugins/experimental/metalink/test/notCacheable
index 8d6c529d3f2..217d44dab65 100755
--- a/plugins/experimental/metalink/test/notCacheable
+++ b/plugins/experimental/metalink/test/notCacheable
@@ -16,12 +16,12 @@
# implied. See the License for the specific language governing
# permissions and limitations under the License.
-print '''1..1 notCacheable
-# The digest of a file that wasn't cacheable doesn't crash the proxy'''
-
from twisted.internet import error, protocol, reactor, tcp
from twisted.web import http
+print '''1..1 notCacheable
+# The digest of a file that wasn't cacheable doesn't crash the proxy'''
+
def callback():
print 'not ok 1 - Why didn\'t the test finish yet?'
diff --git a/plugins/experimental/metalink/test/notModified b/plugins/experimental/metalink/test/notModified
index 4e664aeb184..2d78433dfd9 100755
--- a/plugins/experimental/metalink/test/notModified
+++ b/plugins/experimental/metalink/test/notModified
@@ -16,12 +16,12 @@
# implied. See the License for the specific language governing
# permissions and limitations under the License.
-print '''1..2 notModified
-# The proxy doesn't crash on a 304 Not Modified response'''
-
from twisted.internet import error, protocol, reactor, tcp
from twisted.web import http
+print '''1..2 notModified
+# The proxy doesn't crash on a 304 Not Modified response'''
+
def callback():
print 'ok 2 - The proxy didn\'t crash (the client connection didn\'t close yet)'
diff --git a/plugins/experimental/metalink/test/pipeliningDisconnect b/plugins/experimental/metalink/test/pipeliningDisconnect
index 501576fa74a..4943d197879 100755
--- a/plugins/experimental/metalink/test/pipeliningDisconnect
+++ b/plugins/experimental/metalink/test/pipeliningDisconnect
@@ -16,13 +16,13 @@
# implied. See the License for the specific language governing
# permissions and limitations under the License.
+from twisted.internet import error, protocol, reactor, tcp
+from twisted.web import http
+
print '''1..1 pipeliningDisconnect
# The proxy doesn't crash if INKVConnInternal::do_io_close() gets
# called after a message is already complete'''
-from twisted.internet import error, protocol, reactor, tcp
-from twisted.web import http
-
def callback():
print 'ok 1 - Did the connection close before the proxy made the second request?'
diff --git a/plugins/experimental/metalink/test/shortChunkedEncodingDisconnect b/plugins/experimental/metalink/test/shortChunkedEncodingDisconnect
index f4d7e74ec7b..f75aeaf7b39 100755
--- a/plugins/experimental/metalink/test/shortChunkedEncodingDisconnect
+++ b/plugins/experimental/metalink/test/shortChunkedEncodingDisconnect
@@ -16,14 +16,14 @@
# implied. See the License for the specific language governing
# permissions and limitations under the License.
+from twisted.internet import error, protocol, reactor, tcp
+from twisted.web import http
+
print '''1..1 shortChunkedEncodingDisconnect
# The proxy closes the client connection and doesn't send a final
# chunk if the origin disconnects without sending one, before the
# proxy sends the response headers'''
-from twisted.internet import error, protocol, reactor, tcp
-from twisted.web import http
-
def callback():
print 'not ok 1 - The client was left hanging'
diff --git a/plugins/experimental/metalink/test/shortClientDisconnect b/plugins/experimental/metalink/test/shortClientDisconnect
index 03ec5a52645..d78e411eeb7 100755
--- a/plugins/experimental/metalink/test/shortClientDisconnect
+++ b/plugins/experimental/metalink/test/shortClientDisconnect
@@ -16,13 +16,13 @@
# implied. See the License for the specific language governing
# permissions and limitations under the License.
+from twisted.internet import error, protocol, reactor, tcp
+from twisted.web import http
+
print '''1..1 shortClientDisconnect
# The proxy doesn't crash if the client disconnects before the proxy
# sends the response headers'''
-from twisted.internet import error, protocol, reactor, tcp
-from twisted.web import http
-
def callback():
print 'not ok 1 - Why didn\'t the test finish yet?'
diff --git a/plugins/experimental/metalink/test/shortContentLengthDisconnect b/plugins/experimental/metalink/test/shortContentLengthDisconnect
index 9c40f398469..b508d805f19 100755
--- a/plugins/experimental/metalink/test/shortContentLengthDisconnect
+++ b/plugins/experimental/metalink/test/shortContentLengthDisconnect
@@ -16,14 +16,14 @@
# implied. See the License for the specific language governing
# permissions and limitations under the License.
+from twisted.internet import error, protocol, reactor, tcp
+from twisted.web import http
+
print '''1..2 shortContentLengthDisconnect
# The proxy sends the right Content-Length header and closes the
# client connection if the origin disconnects before the proxy sends
# the response headers'''
-from twisted.internet import error, protocol, reactor, tcp
-from twisted.web import http
-
def callback():
print 'not ok 2 - The client was left hanging'
diff --git a/plugins/experimental/metalink/test/zero b/plugins/experimental/metalink/test/zero
index 71fe60d8961..18a98c807a4 100755
--- a/plugins/experimental/metalink/test/zero
+++ b/plugins/experimental/metalink/test/zero
@@ -16,12 +16,12 @@
# implied. See the License for the specific language governing
# permissions and limitations under the License.
-print '''1..1 zero
-# The proxy doesn't crash if the Content-Length is zero'''
-
from twisted.internet import error, protocol, reactor, tcp
from twisted.web import http
+print '''1..1 zero
+# The proxy doesn't crash if the Content-Length is zero'''
+
def callback():
print 'not ok 1 - Why didn\'t the test finish yet?'
diff --git a/plugins/experimental/ssl_session_reuse/tests/plug-load.test.py b/plugins/experimental/ssl_session_reuse/tests/plug-load.test.py
index cd3801e6f51..10a6468f711 100644
--- a/plugins/experimental/ssl_session_reuse/tests/plug-load.test.py
+++ b/plugins/experimental/ssl_session_reuse/tests/plug-load.test.py
@@ -20,45 +20,45 @@
'''
pluginName = 'ats_ssl_plugin'
-path=os.path.abspath(".")
-configFile='./packages/rhel.6.5.package/conf/trafficserver/ats_ssl_session_reuse.xml'
+path = os.path.abspath(".")
+configFile = './packages/rhel.6.5.package/conf/trafficserver/ats_ssl_session_reuse.xml'
-Test.ContinueOnFail=True
+Test.ContinueOnFail = True
# Define default ATS
-ts=Test.MakeATSProcess("ts")
-server=Test.MakeOriginServer("server")
+ts = Test.MakeATSProcess("ts")
+server = Test.MakeOriginServer("server")
Test.testName = ""
-request_header={"headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
-#expected response from the origin server
-response_header={"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_header = {"headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+# expected response from the origin server
+response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
-#add response to the server dictionary
+# add response to the server dictionary
server.addResponse("sessionfile.log", request_header, response_header)
ts.Disk.records_config.update({
- 'proxy.config.diags.debug.enabled': 1,
- 'proxy.config.diags.debug.tags': '{0}'.format(pluginName),
- })
+ 'proxy.config.diags.debug.enabled': 1,
+ 'proxy.config.diags.debug.tags': '{0}'.format(pluginName),
+})
ts.Disk.plugin_config.AddLine(
- '# {1}/{0}.so {2}'.format(pluginName,path,configFile)
+ '# {1}/{0}.so {2}'.format(pluginName, path, configFile)
)
ts.Disk.remap_config.AddLine(
'map http://www.example.com http://127.0.0.1:{0}'.format(server.Variables.Port)
)
-goldFile = os.path.join(Test.RunDirectory,"{0}.gold".format(pluginName))
-with open(goldFile,'w+') as jf:
- jf.write("``loading plugin ``{0}.so``".format(pluginName))
+goldFile = os.path.join(Test.RunDirectory, "{0}.gold".format(pluginName))
+with open(goldFile, 'w+') as jf:
+ jf.write("``loading plugin ``{0}.so``".format(pluginName))
# call localhost straight
-tr=Test.AddTestRun()
-tr.Processes.Default.Command='curl --proxy 127.0.0.1:{0} "http://www.example.com" --verbose'.format(ts.Variables.port)
-tr.Processes.Default.ReturnCode=0
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = 'curl --proxy 127.0.0.1:{0} "http://www.example.com" --verbose'.format(ts.Variables.port)
+tr.Processes.Default.ReturnCode = 0
# time delay as proxy.config.http.wait_for_cache could be broken
-tr.Processes.Default.StartBefore(server,ready=When.PortOpen(server.Variables.Port))
+tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port))
tr.Processes.Default.StartBefore(Test.Processes.ts)
-tr.StillRunningAfter=server
+tr.StillRunningAfter = server
-#ts.Streams.All=goldFile
-#ts.Disk.diags_log.Content+=goldFile
+# ts.Streams.All=goldFile
+# ts.Disk.diags_log.Content+=goldFile
diff --git a/plugins/experimental/traffic_dump/post_process.py b/plugins/experimental/traffic_dump/post_process.py
index 42f76d82fcb..0472cbc0735 100755
--- a/plugins/experimental/traffic_dump/post_process.py
+++ b/plugins/experimental/traffic_dump/post_process.py
@@ -43,6 +43,7 @@
class PostProcessError(Exception):
''' Base class for post processing errors.
'''
+
def __init__(self, message=None):
self.message = message
diff --git a/plugins/experimental/uri_signing/python_signer/uri_signer.py b/plugins/experimental/uri_signing/python_signer/uri_signer.py
index 353241bb93b..549080a4d9a 100755
--- a/plugins/experimental/uri_signing/python_signer/uri_signer.py
+++ b/plugins/experimental/uri_signing/python_signer/uri_signer.py
@@ -25,108 +25,109 @@
# https://github.com/mpdavis/python-jose
from jose import jwk, jwt
+
def main():
- parser = argparse.ArgumentParser()
- parser.add_argument('-c', '--config',
- help="Configuration File",
- required=True)
- parser.add_argument('-u', '--uri',
- help="URI to sign",
- required=True)
-
- # helpers
- parser.add_argument('--key_index', type=int, nargs=1)
- parser.add_argument('--token_lifetime', type=int, nargs=1)
-
- # override arguments -- claims
- parser.add_argument('--aud', nargs=1)
- parser.add_argument('--cdniets', type=int, nargs=1)
- parser.add_argument('--cdnistd', type=int, nargs=1)
- parser.add_argument('--cdnistt', type=int, nargs=1)
- parser.add_argument('--exp', type=int, nargs=1)
- parser.add_argument('--iss', nargs=1)
-
- # override arguments -- key
- parser.add_argument('--alg', nargs=1)
- parser.add_argument('--k', nargs=1)
- parser.add_argument('--kid', nargs=1)
- parser.add_argument('--kty', nargs=1)
-
- args = parser.parse_args()
-
- with open(args.config, 'r') as f:
- config = json.load(f)
-
- keys = config["keys"]
-
- # Select a key, either explicitly or randomly
- key_index = 0
- if args.key_index:
- key_index = args.key_index[0]
- print("args key_index " + str(key_index))
- else:
- key_index = random.randint(0,len(keys)-1)
- print("randomizing key index")
-
- print("Using key_index " + str(key_index))
-
- print("Using Key: " + str(keys[key_index]["kid"]) + " to sign URI.")
- key = keys[key_index]
-
- # Build Out claimset
- claimset = {}
- if "iss" in config.keys():
- claimset["iss"] = config["iss"]
-
- if "token_lifetime" in config.keys():
- claimset["exp"] = int(time.time()) + config["token_lifetime"]
- else:
- claimset["exp"] = int(time.time()) + 30
-
- if "aud" in config.keys():
- claimset["aud"] = config["aud"]
-
- if "cdnistt" in config.keys():
- if config["cdnistt"]:
- claimset["cdnistt"] = 1
- if "cdniets" in config.keys():
- claimset["cdniets"] = config["cdniets"]
- else:
- claimset["cdniets"] = 30
-
-
- # process override args - simple
- if args.iss:
- claimset["iss"] = args.iss[0]
- if args.exp:
- claimset["exp"] = args.exp[0]
- if args.aud:
- claimset["aud"] = args.aud[0]
-
- # process override args - complex
- if args.cdnistt:
- claimset["cdnistt"] = args.cdnistt[0]
-
- if "cdnistt" in config.keys():
- if args.cdniets:
- claimset["cdniets"] = arg.cdniets[0]
-
- # specific key overrides
- if args.alg:
- key["alg"] = args.alg[0]
- if args.kid:
- key["kid"] = args.kid[0]
- if args.kty:
- key["kty"] = args.kty[0]
- if args.k:
- key["k"] = args.k[0]
-
- print(claimset)
- print(key)
-
- Token = jwt.encode(claimset,key,algorithm=key["alg"])
-
- print("Signed URL: " + args.uri + "?URISigningPackage=" + Token)
+ parser = argparse.ArgumentParser()
+ parser.add_argument('-c', '--config',
+ help="Configuration File",
+ required=True)
+ parser.add_argument('-u', '--uri',
+ help="URI to sign",
+ required=True)
+
+ # helpers
+ parser.add_argument('--key_index', type=int, nargs=1)
+ parser.add_argument('--token_lifetime', type=int, nargs=1)
+
+ # override arguments -- claims
+ parser.add_argument('--aud', nargs=1)
+ parser.add_argument('--cdniets', type=int, nargs=1)
+ parser.add_argument('--cdnistd', type=int, nargs=1)
+ parser.add_argument('--cdnistt', type=int, nargs=1)
+ parser.add_argument('--exp', type=int, nargs=1)
+ parser.add_argument('--iss', nargs=1)
+
+ # override arguments -- key
+ parser.add_argument('--alg', nargs=1)
+ parser.add_argument('--k', nargs=1)
+ parser.add_argument('--kid', nargs=1)
+ parser.add_argument('--kty', nargs=1)
+
+ args = parser.parse_args()
+
+ with open(args.config, 'r') as f:
+ config = json.load(f)
+
+ keys = config["keys"]
+
+ # Select a key, either explicitly or randomly
+ key_index = 0
+ if args.key_index:
+ key_index = args.key_index[0]
+ print("args key_index " + str(key_index))
+ else:
+ key_index = random.randint(0, len(keys) - 1)
+ print("randomizing key index")
+
+ print("Using key_index " + str(key_index))
+
+ print("Using Key: " + str(keys[key_index]["kid"]) + " to sign URI.")
+ key = keys[key_index]
+
+ # Build Out claimset
+ claimset = {}
+ if "iss" in config.keys():
+ claimset["iss"] = config["iss"]
+
+ if "token_lifetime" in config.keys():
+ claimset["exp"] = int(time.time()) + config["token_lifetime"]
+ else:
+ claimset["exp"] = int(time.time()) + 30
+
+ if "aud" in config.keys():
+ claimset["aud"] = config["aud"]
+
+ if "cdnistt" in config.keys():
+ if config["cdnistt"]:
+ claimset["cdnistt"] = 1
+ if "cdniets" in config.keys():
+ claimset["cdniets"] = config["cdniets"]
+ else:
+ claimset["cdniets"] = 30
+
+ # process override args - simple
+ if args.iss:
+ claimset["iss"] = args.iss[0]
+ if args.exp:
+ claimset["exp"] = args.exp[0]
+ if args.aud:
+ claimset["aud"] = args.aud[0]
+
+ # process override args - complex
+ if args.cdnistt:
+ claimset["cdnistt"] = args.cdnistt[0]
+
+ if "cdnistt" in config.keys():
+ if args.cdniets:
+ claimset["cdniets"] = arg.cdniets[0]
+
+ # specific key overrides
+ if args.alg:
+ key["alg"] = args.alg[0]
+ if args.kid:
+ key["kid"] = args.kid[0]
+ if args.kty:
+ key["kty"] = args.kty[0]
+ if args.k:
+ key["k"] = args.k[0]
+
+ print(claimset)
+ print(key)
+
+ Token = jwt.encode(claimset, key, algorithm=key["alg"])
+
+ print("Signed URL: " + args.uri + "?URISigningPackage=" + Token)
+
if __name__ == "__main__":
- main()
+ main()
diff --git a/tests/gold_tests/autest-site/ports.py b/tests/gold_tests/autest-site/ports.py
index 4f268717035..db6a66f104b 100644
--- a/tests/gold_tests/autest-site/ports.py
+++ b/tests/gold_tests/autest-site/ports.py
@@ -102,7 +102,7 @@ def _get_available_port(queue):
if queue.qsize() == 0:
host.WriteWarning("Port queue is empty.")
raise PortQueueSelectionError(
- "Could not get a valid port because the queue is empty")
+ "Could not get a valid port because the queue is empty")
port = queue.get()
while PortOpen(port):
@@ -112,7 +112,7 @@ def _get_available_port(queue):
if queue.qsize() == 0:
host.WriteWarning("Port queue is empty.")
raise PortQueueSelectionError(
- "Could not get a valid port because the queue is empty")
+ "Could not get a valid port because the queue is empty")
port = queue.get()
return port
@@ -154,7 +154,7 @@ def _setup_port_queue(amount=1000):
).decode().split("=")[1].split()
dmin = int(dmin)
dmax = int(dmax)
- except:
+ except Exception:
host.WriteWarning("Unable to call sysctrl!\n Tests may fail because of bad port selection!")
return
@@ -228,22 +228,22 @@ def get_port(obj, name):
try:
port = _get_available_port(g_ports)
host.WriteVerbose(
- "get_port",
- "Using port from port queue: {}".format(port))
+ "get_port",
+ "Using port from port queue: {}".format(port))
# setup clean up step to recycle the port
obj.Setup.Lambda(func_cleanup=lambda: g_ports.put(
port), description="recycling port")
except PortQueueSelectionError:
port = _get_port_by_bind()
host.WriteVerbose(
- "get_port",
- "Queue was drained. Using port from a bound socket: {}".format(port))
+ "get_port",
+ "Queue was drained. Using port from a bound socket: {}".format(port))
else:
# Since the queue could not be populated, use a port via bind.
port = _get_port_by_bind()
host.WriteVerbose(
- "get_port",
- "Queue is empty. Using port from a bound socket: {}".format(port))
+ "get_port",
+ "Queue is empty. Using port from a bound socket: {}".format(port))
# Assign to the named variable.
obj.Variables[name] = port
diff --git a/tests/gold_tests/basic/deny0.test.py b/tests/gold_tests/basic/deny0.test.py
index 4cacd14d783..cf808c4ac53 100644
--- a/tests/gold_tests/basic/deny0.test.py
+++ b/tests/gold_tests/basic/deny0.test.py
@@ -24,7 +24,7 @@
Test.ContinueOnFail = True
-HOST1='redirect.test'
+HOST1 = 'redirect.test'
redirect_serv = Test.MakeOriginServer("redirect_serv", ip='0.0.0.0')
@@ -33,17 +33,11 @@
ts = Test.MakeATSProcess("ts")
ts.Disk.records_config.update({
- 'proxy.config.diags.debug.enabled': 1
- ,'proxy.config.diags.debug.tags': 'http|dns|redirect'
- ,'proxy.config.http.redirection_enabled': 1
- ,'proxy.config.http.number_of_redirections': 1
- ,'proxy.config.http.cache.http': 0
- ,'proxy.config.dns.nameservers': '127.0.0.1:{0}'.format(dns.Variables.Port)
- ,'proxy.config.dns.resolv_conf': 'NULL'
- ,'proxy.config.url_remap.remap_required': 0 # need this so the domain gets a chance to be evaluated through DNS
+ # need this so the domain gets a chance to be evaluated through DNS
+ 'proxy.config.diags.debug.enabled': 1, 'proxy.config.diags.debug.tags': 'http|dns|redirect', 'proxy.config.http.redirection_enabled': 1, 'proxy.config.http.number_of_redirections': 1, 'proxy.config.http.cache.http': 0, 'proxy.config.dns.nameservers': '127.0.0.1:{0}'.format(dns.Variables.Port), 'proxy.config.dns.resolv_conf': 'NULL', 'proxy.config.url_remap.remap_required': 0
})
-Test.Setup.Copy(os.path.join(Test.Variables.AtsTestToolsDir,'tcp_client.py'))
+Test.Setup.Copy(os.path.join(Test.Variables.AtsTestToolsDir, 'tcp_client.py'))
data_dirname = 'generated_test_data'
data_path = os.path.join(Test.TestDirectory, data_dirname)
@@ -53,30 +47,33 @@
f.write('HTTP/1.1 400 Bad Destination Address\r\n')
isFirstTest = True
+
+
def buildMetaTest(testName, requestString):
- tr = Test.AddTestRun(testName)
- global isFirstTest
- if isFirstTest:
- isFirstTest = False
- tr.Processes.Default.StartBefore(ts, ready=When.PortOpen(ts.Variables.port))
- tr.Processes.Default.StartBefore(redirect_serv, ready=When.PortOpen(redirect_serv.Variables.Port))
- tr.Processes.Default.StartBefore(dns)
- with open(os.path.join(data_path, tr.Name), 'w') as f:
- f.write(requestString)
- tr.Processes.Default.Command = "python3 tcp_client.py 127.0.0.1 {0} {1} | head -1".format(ts.Variables.port, os.path.join(data_dirname, tr.Name))
- tr.ReturnCode = 0
- tr.Processes.Default.Streams.stdout = gold_filepath
- tr.StillRunningAfter = ts
- tr.StillRunningAfter = redirect_serv
- tr.StillRunningAfter = dns
+ tr = Test.AddTestRun(testName)
+ global isFirstTest
+ if isFirstTest:
+ isFirstTest = False
+ tr.Processes.Default.StartBefore(ts, ready=When.PortOpen(ts.Variables.port))
+ tr.Processes.Default.StartBefore(redirect_serv, ready=When.PortOpen(redirect_serv.Variables.Port))
+ tr.Processes.Default.StartBefore(dns)
+ with open(os.path.join(data_path, tr.Name), 'w') as f:
+ f.write(requestString)
+ tr.Processes.Default.Command = "python3 tcp_client.py 127.0.0.1 {0} {1} | head -1".format(
+ ts.Variables.port, os.path.join(data_dirname, tr.Name))
+ tr.ReturnCode = 0
+ tr.Processes.Default.Streams.stdout = gold_filepath
+ tr.StillRunningAfter = ts
+ tr.StillRunningAfter = redirect_serv
+ tr.StillRunningAfter = dns
buildMetaTest('RejectInterfaceAnyIpv4',
- 'GET / HTTP/1.1\r\nHost: 0:{port}\r\nConnection: close\r\n\r\n'.format(port=ts.Variables.port))
+ 'GET / HTTP/1.1\r\nHost: 0:{port}\r\nConnection: close\r\n\r\n'.format(port=ts.Variables.port))
buildMetaTest('RejectInterfaceAnyIpv6',
- 'GET / HTTP/1.1\r\nHost: [::]:{port}\r\nConnection: close\r\n\r\n'.format(port=ts.Variables.portv6))
+ 'GET / HTTP/1.1\r\nHost: [::]:{port}\r\nConnection: close\r\n\r\n'.format(port=ts.Variables.portv6))
# Sets up redirect to IPv4 ANY address
@@ -86,7 +83,7 @@ def buildMetaTest(testName, requestString):
redirect_serv.addResponse("sessionfile.log", redirect_request_header, redirect_response_header)
buildMetaTest('RejectRedirectToInterfaceAnyIpv4',
- 'GET /redirect-0 HTTP/1.1\r\nHost: {host}:{port}\r\n\r\n'.format(host=HOST1, port=redirect_serv.Variables.Port))
+ 'GET /redirect-0 HTTP/1.1\r\nHost: {host}:{port}\r\n\r\n'.format(host=HOST1, port=redirect_serv.Variables.Port))
# Sets up redirect to IPv6 ANY address
@@ -96,7 +93,7 @@ def buildMetaTest(testName, requestString):
redirect_serv.addResponse("sessionfile.log", redirect_request_header, redirect_response_header)
buildMetaTest('RejectRedirectToInterfaceAnyIpv6',
- 'GET /redirect-0v6 HTTP/1.1\r\nHost: {host}:{port}\r\n\r\n'.format(host=HOST1, port=redirect_serv.Variables.Port))
+ 'GET /redirect-0v6 HTTP/1.1\r\nHost: {host}:{port}\r\n\r\n'.format(host=HOST1, port=redirect_serv.Variables.Port))
Test.Setup.Copy(data_path)
diff --git a/tests/gold_tests/body_factory/http304_response.test.py b/tests/gold_tests/body_factory/http304_response.test.py
index dc39eb61a4c..79e0e8c648b 100644
--- a/tests/gold_tests/body_factory/http304_response.test.py
+++ b/tests/gold_tests/body_factory/http304_response.test.py
@@ -47,7 +47,7 @@
tr.Processes.Default.StartBefore(Test.Processes.ts)
tr.StillRunningAfter = ts
-cmd_tpl = "python3 tcp_client.py 127.0.0.1 {0} {1} | grep -v '^Date: '| grep -v '^Server: ATS/' | sed 's;ApacheTrafficServer\/[^ ]*;VERSION;'"
+cmd_tpl = r"python3 tcp_client.py 127.0.0.1 {0} {1} | grep -v '^Date: '| grep -v '^Server: ATS/' | sed 's;ApacheTrafficServer\/[^ ]*;VERSION;'"
tr.Processes.Default.Command = cmd_tpl.format(ts.Variables.port, 'data/{0}_get.txt'.format(DEFAULT_304_HOST))
tr.Processes.Default.TimeOut = 5 # seconds
tr.Processes.Default.ReturnCode = 0
diff --git a/tests/gold_tests/body_factory/http_with_origin.test.py b/tests/gold_tests/body_factory/http_with_origin.test.py
index 6c65a790c56..7d418c4f396 100644
--- a/tests/gold_tests/body_factory/http_with_origin.test.py
+++ b/tests/gold_tests/body_factory/http_with_origin.test.py
@@ -99,7 +99,7 @@
trget304.StillRunningAfter = ts
trget304.StillRunningAfter = server
-cmd_tpl = "python3 tcp_client.py 127.0.0.1 {0} {1} | grep -v '^Date: '| grep -v '^Server: ATS/' | sed 's;ApacheTrafficServer\/[^ ]*;VERSION;'"
+cmd_tpl = r"python3 tcp_client.py 127.0.0.1 {0} {1} | grep -v '^Date: '| grep -v '^Server: ATS/' | sed 's;ApacheTrafficServer\/[^ ]*;VERSION;'"
trget304.Processes.Default.Command = cmd_tpl.format(ts.Variables.port, 'data/{0}_get_304.txt'.format(HOST))
trget304.Processes.Default.TimeOut = 5 # seconds
trget304.Processes.Default.ReturnCode = 0
diff --git a/tests/gold_tests/cache/cache-control.test.py b/tests/gold_tests/cache/cache-control.test.py
index cf3caf63b09..3f59659282c 100644
--- a/tests/gold_tests/cache/cache-control.test.py
+++ b/tests/gold_tests/cache/cache-control.test.py
@@ -27,14 +27,29 @@
ts = Test.MakeATSProcess("ts")
server = Test.MakeOriginServer("server")
-#**testname is required**
+# **testname is required**
testName = ""
request_header1 = {"headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
-response_header1 = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\nCache-Control: max-age=300\r\n\r\n", "timestamp": "1469733493.993", "body": "xxx"}
-request_header2 = {"headers": "GET /no_cache_control HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
-response_header2 = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": "the flinstones"}
-request_header3 = {"headers": "GET /max_age_10sec HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
-response_header3 = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\nCache-Control: max-age=10,public\r\n\r\n", "timestamp": "1469733493.993", "body": "yabadabadoo"}
+response_header1 = {
+ "headers": "HTTP/1.1 200 OK\r\nConnection: close\r\nCache-Control: max-age=300\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": "xxx"}
+request_header2 = {
+ "headers": "GET /no_cache_control HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""}
+response_header2 = {
+ "headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": "the flinstones"}
+request_header3 = {
+ "headers": "GET /max_age_10sec HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""}
+response_header3 = {
+ "headers": "HTTP/1.1 200 OK\r\nConnection: close\r\nCache-Control: max-age=10,public\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": "yabadabadoo"}
server.addResponse("sessionlog.json", request_header1, response_header1)
server.addResponse("sessionlog.json", request_header2, response_header2)
server.addResponse("sessionlog.json", request_header3, response_header3)
@@ -58,42 +73,48 @@
tr = Test.AddTestRun()
tr.Processes.Default.StartBefore(server)
tr.Processes.Default.StartBefore(Test.Processes.ts, ready=1)
-tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H "x-debug: x-cache,via" -H "Host: www.example.com" http://localhost:{port}/max_age_10sec'.format(port=ts.Variables.port)
+tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H "x-debug: x-cache,via" -H "Host: www.example.com" http://localhost:{port}/max_age_10sec'.format(
+ port=ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "gold/cache_and_req_body-miss.gold"
tr.StillRunningAfter = ts
# Test 2 - 200 cached response and using netcat
tr = Test.AddTestRun()
-tr.Processes.Default.Command = "printf 'GET /max_age_10sec HTTP/1.1\r\n''x-debug: x-cache,x-cache-key,via\r\n''Host: www.example.com\r\n''\r\n'|nc 127.0.0.1 -w 1 {port}".format(port=ts.Variables.port)
+tr.Processes.Default.Command = "printf 'GET /max_age_10sec HTTP/1.1\r\n''x-debug: x-cache,x-cache-key,via\r\n''Host: www.example.com\r\n''\r\n'|nc 127.0.0.1 -w 1 {port}".format(
+ port=ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "gold/cache_and_req_body-hit.gold"
tr.StillRunningAfter = ts
# Test 3 - response with no cache control, so cache-miss every time
tr = Test.AddTestRun()
-tr.Processes.Default.Command = "printf 'GET /no_cache_control HTTP/1.1\r\n''x-debug: x-cache,x-cache-key,via\r\n''Host: www.example.com\r\n''\r\n'|nc 127.0.0.1 -w 1 {port}".format(port=ts.Variables.port)
+tr.Processes.Default.Command = "printf 'GET /no_cache_control HTTP/1.1\r\n''x-debug: x-cache,x-cache-key,via\r\n''Host: www.example.com\r\n''\r\n'|nc 127.0.0.1 -w 1 {port}".format(
+ port=ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "gold/cache_no_cc.gold"
tr.StillRunningAfter = ts
# Test 4 - Cache-Control: no-cache (from client), so cache miss every time
tr = Test.AddTestRun()
-tr.Processes.Default.Command = "printf 'GET /no_cache_control HTTP/1.1\r\n''Cache-Control:no-cache\r\n''x-debug: x-cache,x-cache-key,via\r\n''Host: www.example.com\r\n''\r\n'|nc 127.0.0.1 -w 1 {port}".format(port=ts.Variables.port)
+tr.Processes.Default.Command = "printf 'GET /no_cache_control HTTP/1.1\r\n''Cache-Control:no-cache\r\n''x-debug: x-cache,x-cache-key,via\r\n''Host: www.example.com\r\n''\r\n'|nc 127.0.0.1 -w 1 {port}".format(
+ port=ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "gold/cache_no_cc.gold"
tr.StillRunningAfter = ts
# Test 5 - hit stale cache.
tr = Test.AddTestRun()
-tr.Processes.Default.Command = "sleep 15; printf 'GET /max_age_10sec HTTP/1.1\r\n''x-debug: x-cache,x-cache-key,via\r\n''Host: www.example.com\r\n''\r\n'|nc 127.0.0.1 -w 1 {port}".format(port=ts.Variables.port)
+tr.Processes.Default.Command = "sleep 15; printf 'GET /max_age_10sec HTTP/1.1\r\n''x-debug: x-cache,x-cache-key,via\r\n''Host: www.example.com\r\n''\r\n'|nc 127.0.0.1 -w 1 {port}".format(
+ port=ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "gold/cache_hit_stale.gold"
tr.StillRunningAfter = ts
# Test 6 - only-if-cached. 504 "Not Cached" should be returned if not in cache
tr = Test.AddTestRun()
-tr.Processes.Default.Command = "printf 'GET /no_cache_control HTTP/1.1\r\n''Cache-Control: only-if-cached\r\n''x-debug: x-cache,x-cache-key,via\r\n''Host: www.example.com\r\n''Cache-control: max-age=300\r\n''\r\n'|nc 127.0.0.1 -w 1 {port}".format(port=ts.Variables.port)
+tr.Processes.Default.Command = "printf 'GET /no_cache_control HTTP/1.1\r\n''Cache-Control: only-if-cached\r\n''x-debug: x-cache,x-cache-key,via\r\n''Host: www.example.com\r\n''Cache-control: max-age=300\r\n''\r\n'|nc 127.0.0.1 -w 1 {port}".format(
+ port=ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "gold/cache_no_cache.gold"
tr.StillRunningAfter = ts
diff --git a/tests/gold_tests/chunked_encoding/chunked_encoding.test.py b/tests/gold_tests/chunked_encoding/chunked_encoding.test.py
index fdea2517d88..4e6df88ec9b 100644
--- a/tests/gold_tests/chunked_encoding/chunked_encoding.test.py
+++ b/tests/gold_tests/chunked_encoding/chunked_encoding.test.py
@@ -42,16 +42,18 @@
"timestamp": "1469733493.993",
"body": ""}
-request_header2 = {"headers": "POST / HTTP/1.1\r\nHost: www.anotherexample.com\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 11\r\n\r\n",
- "timestamp": "1415926535.898",
- "body": "knock knock"}
+request_header2 = {
+ "headers": "POST / HTTP/1.1\r\nHost: www.anotherexample.com\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 11\r\n\r\n",
+ "timestamp": "1415926535.898",
+ "body": "knock knock"}
response_header2 = {"headers": "HTTP/1.1 200 OK\r\nServer: uServer\r\nConnection: close\r\nTransfer-Encoding: chunked\r\n\r\n",
"timestamp": "1415926535.898",
"body": ""}
-request_header3 = {"headers": "POST / HTTP/1.1\r\nHost: www.yetanotherexample.com\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 11\r\n\r\n",
- "timestamp": "1415926535.898",
- "body": "knock knock"}
+request_header3 = {
+ "headers": "POST / HTTP/1.1\r\nHost: www.yetanotherexample.com\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 11\r\n\r\n",
+ "timestamp": "1415926535.898",
+ "body": "knock knock"}
response_header3 = {"headers": "HTTP/1.1 200 OK\r\nServer: uServer\r\nConnection: close\r\nTransfer-Encoding: chunked\r\n\r\n",
"timestamp": "1415926535.898",
"body": ""}
@@ -69,7 +71,7 @@
'proxy.config.diags.debug.tags': 'http',
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
})
@@ -91,7 +93,7 @@
)
# build test code
-tr=Test.Build(target='smuggle-client',sources=['smuggle-client.c'])
+tr = Test.Build(target='smuggle-client', sources=['smuggle-client.c'])
tr.TimeOut = 5
tr.Setup.Copy('smuggle-client.c')
diff --git a/tests/gold_tests/command_argument/verify_global_plugin.test.py b/tests/gold_tests/command_argument/verify_global_plugin.test.py
index e7bfae34a2d..aa86b2de40f 100644
--- a/tests/gold_tests/command_argument/verify_global_plugin.test.py
+++ b/tests/gold_tests/command_argument/verify_global_plugin.test.py
@@ -99,7 +99,7 @@ def create_ts_process():
"ERROR: .*unable to find TSPluginInit function in",
"Should warn about the need for the TSPluginInit symbol")
ts.Disk.diags_log.Content = Testers.ContainsExpression("ERROR",
- "ERROR: .*unable to find TSPluginInit function in")
+ "ERROR: .*unable to find TSPluginInit function in")
"""
@@ -122,7 +122,7 @@ def create_ts_process():
"ERROR: .*unable to find TSPluginInit function in",
"Should warn about the need for the TSPluginInit symbol")
ts.Disk.diags_log.Content = Testers.ContainsExpression("ERROR",
- "ERROR: .*unable to find TSPluginInit function in")
+ "ERROR: .*unable to find TSPluginInit function in")
"""
@@ -195,4 +195,4 @@ def prepare_undefined_symbol_plugin(tsproc, path_c, path_cpp, path_h):
"ERROR: .*: undefined symbol: .*foo.*",
"Should warn about the need for the TSPluginInit symbol")
ts.Disk.diags_log.Content = Testers.ContainsExpression("ERROR",
- "ERROR: .*: undefined symbol: .*foo.*")
+ "ERROR: .*: undefined symbol: .*foo.*")
diff --git a/tests/gold_tests/command_argument/verify_remap_plugin.test.py b/tests/gold_tests/command_argument/verify_remap_plugin.test.py
index 004c9c86ee6..dc4dc167d5e 100644
--- a/tests/gold_tests/command_argument/verify_remap_plugin.test.py
+++ b/tests/gold_tests/command_argument/verify_remap_plugin.test.py
@@ -98,7 +98,8 @@ def create_ts_process():
tr.Processes.Default.Streams.stderr = Testers.ContainsExpression(
"ERROR: .*missing required function TSRemapInit",
"Should warn about the need for the TSRemapInit symbol")
-ts.Disk.diags_log.Content = Testers.ContainsExpression("ERROR",
+ts.Disk.diags_log.Content = Testers.ContainsExpression(
+ "ERROR",
"ERROR: .*missing required function TSRemapInit")
@@ -121,7 +122,8 @@ def create_ts_process():
tr.Processes.Default.Streams.stderr = Testers.ContainsExpression(
"ERROR: .*missing required function TSRemapInit",
"Should warn about the need for the TSRemapInit symbol")
-ts.Disk.diags_log.Content = Testers.ContainsExpression("ERROR",
+ts.Disk.diags_log.Content = Testers.ContainsExpression(
+ "ERROR",
"ERROR: .*missing required function TSRemapInit")
diff --git a/tests/gold_tests/continuations/double.test.py b/tests/gold_tests/continuations/double.test.py
index ab830cde26f..8f454260fa4 100644
--- a/tests/gold_tests/continuations/double.test.py
+++ b/tests/gold_tests/continuations/double.test.py
@@ -49,14 +49,14 @@
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.http.cache.http': 0, # disable cache to simply the test.
'proxy.config.cache.enable_read_while_writer': 0,
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
'proxy.config.http2.max_concurrent_streams_in': 65535
})
# add plugin to assist with test metrics
Test.PreparePlugin(os.path.join(Test.Variables.AtsTestToolsDir,
- 'plugins', 'continuations_verify.cc'), ts)
+ 'plugins', 'continuations_verify.cc'), ts)
comparator_command = '''
if test "`traffic_ctl metric get continuations_verify.{0}.close.1 | cut -d ' ' -f 2`" -eq "`traffic_ctl metric get continuations_verify.{0}.close.2 | cut -d ' ' -f 2`" ; then\
@@ -75,9 +75,9 @@
# Create a bunch of curl commands to be executed in parallel. Default.Process is set in SpawnCommands.
# On Fedora 28/29, it seems that curl will occaisionally timeout after a couple seconds and return exitcode 2
# Examinig the packet capture shows that Traffic Server dutifully sends the response
-ps = tr.SpawnCommands(cmdstr=cmd, count=numberOfRequests, retcode=Any(0,2))
+ps = tr.SpawnCommands(cmdstr=cmd, count=numberOfRequests, retcode=Any(0, 2))
tr.Processes.Default.Env = ts.Env
-tr.Processes.Default.ReturnCode = Any(0,2)
+tr.Processes.Default.ReturnCode = Any(0, 2)
# Execution order is: ts/server, ps(curl cmds), Default Process.
tr.Processes.Default.StartBefore(
@@ -98,14 +98,17 @@
# Parking this as a ready tester on a meaningless process
# To stall the test runs that check for the stats until the
# stats have propagated and are ready to read.
+
+
def make_done_stat_ready(tsenv):
- def done_stat_ready(process, hasRunFor, **kw):
- retval = subprocess.run("traffic_ctl metric get continuations_verify.test.done > done 2> /dev/null", shell=True, env=tsenv)
- if retval.returncode == 0:
- retval = subprocess.run("grep 1 done > /dev/null", shell = True, env=tsenv)
- return retval.returncode == 0
+ def done_stat_ready(process, hasRunFor, **kw):
+ retval = subprocess.run("traffic_ctl metric get continuations_verify.test.done > done 2> /dev/null", shell=True, env=tsenv)
+ if retval.returncode == 0:
+ retval = subprocess.run("grep 1 done > /dev/null", shell=True, env=tsenv)
+ return retval.returncode == 0
+
+ return done_stat_ready
- return done_stat_ready
# number of sessions/transactions opened and closed are equal
tr = Test.AddTestRun("Check Ssn")
@@ -135,4 +138,3 @@ def done_stat_ready(process, hasRunFor, **kw):
tr.Processes.Default.Streams.stdout = Testers.ContainsExpression("yes", 'should verify contents')
tr.StillRunningAfter = ts
tr.StillRunningAfter = server2
-
diff --git a/tests/gold_tests/continuations/double_h2.test.py b/tests/gold_tests/continuations/double_h2.test.py
index 8cf025add2e..8102021747f 100644
--- a/tests/gold_tests/continuations/double_h2.test.py
+++ b/tests/gold_tests/continuations/double_h2.test.py
@@ -59,14 +59,14 @@
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.http.cache.http': 0, # disable cache to simply the test.
'proxy.config.cache.enable_read_while_writer': 0,
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
'proxy.config.http2.max_concurrent_streams_in': 65535
})
# add plugin to assist with test metrics
Test.PreparePlugin(os.path.join(Test.Variables.AtsTestToolsDir,
- 'plugins', 'continuations_verify.cc'), ts)
+ 'plugins', 'continuations_verify.cc'), ts)
comparator_command = '''
if test "`traffic_ctl metric get continuations_verify.{0}.close.1 | cut -d ' ' -f 2`" -eq "`traffic_ctl metric get continuations_verify.{0}.close.2 | cut -d ' ' -f 2`" ; then\
@@ -86,9 +86,9 @@
# Create a bunch of curl commands to be executed in parallel. Default.Process is set in SpawnCommands.
# On Fedora 28/29, it seems that curl will occaisionally timeout after a couple seconds and return exitcode 2
# Examinig the packet capture shows that Traffic Server dutifully sends the response
-ps = tr.SpawnCommands(cmdstr=cmd, count=numberOfRequests, retcode=Any(0,2))
+ps = tr.SpawnCommands(cmdstr=cmd, count=numberOfRequests, retcode=Any(0, 2))
tr.Processes.Default.Env = ts.Env
-tr.Processes.Default.ReturnCode = Any(0,2)
+tr.Processes.Default.ReturnCode = Any(0, 2)
# Execution order is: ts/server, ps(curl cmds), Default Process.
tr.Processes.Default.StartBefore(
@@ -109,14 +109,17 @@
# Parking this as a ready tester on a meaningless process
# To stall the test runs that check for the stats until the
# stats have propagated and are ready to read.
+
+
def make_done_stat_ready(tsenv):
- def done_stat_ready(process, hasRunFor, **kw):
- retval = subprocess.run("traffic_ctl metric get continuations_verify.test.done > done 2> /dev/null", shell=True, env=tsenv)
- if retval.returncode == 0:
- retval = subprocess.run("grep 1 done > /dev/null", shell = True, env=tsenv)
- return retval.returncode == 0
+ def done_stat_ready(process, hasRunFor, **kw):
+ retval = subprocess.run("traffic_ctl metric get continuations_verify.test.done > done 2> /dev/null", shell=True, env=tsenv)
+ if retval.returncode == 0:
+ retval = subprocess.run("grep 1 done > /dev/null", shell=True, env=tsenv)
+ return retval.returncode == 0
+
+ return done_stat_ready
- return done_stat_ready
# number of sessions/transactions opened and closed are equal
tr = Test.AddTestRun("Check Ssn")
@@ -146,4 +149,3 @@ def done_stat_ready(process, hasRunFor, **kw):
tr.Processes.Default.Streams.stdout = Testers.ContainsExpression("yes", 'should verify contents')
tr.StillRunningAfter = ts
tr.StillRunningAfter = server2
-
diff --git a/tests/gold_tests/continuations/openclose.test.py b/tests/gold_tests/continuations/openclose.test.py
index b75b95ebf30..ff2760ce525 100644
--- a/tests/gold_tests/continuations/openclose.test.py
+++ b/tests/gold_tests/continuations/openclose.test.py
@@ -59,9 +59,9 @@
# Create a bunch of curl commands to be executed in parallel. Default.Process is set in SpawnCommands.
# On Fedora 28/29, it seems that curl will occaisionally timeout after a couple seconds and return exitcode 2
# Examinig the packet capture shows that Traffic Server dutifully sends the response
-ps = tr.SpawnCommands(cmdstr=cmd, count=numberOfRequests, retcode=Any(0,2))
+ps = tr.SpawnCommands(cmdstr=cmd, count=numberOfRequests, retcode=Any(0, 2))
tr.Processes.Default.Env = ts.Env
-tr.Processes.Default.ReturnCode = Any(0,2)
+tr.Processes.Default.ReturnCode = Any(0, 2)
# Execution order is: ts/server, ps(curl cmds), Default Process.
tr.Processes.Default.StartBefore(
@@ -73,7 +73,7 @@
# Signal that all the curl processes have completed
tr = Test.AddTestRun("Curl Done")
-tr.DelayStart = 2 # Delaying a couple seconds to make sure the global continuation's lock contention resolves.
+tr.DelayStart = 2 # Delaying a couple seconds to make sure the global continuation's lock contention resolves.
tr.Processes.Default.Command = "traffic_ctl plugin msg done done"
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Env = ts.Env
@@ -82,14 +82,17 @@
# Parking this as a ready tester on a meaningless process
# To stall the test runs that check for the stats until the
# stats have propagated and are ready to read.
+
+
def make_done_stat_ready(tsenv):
- def done_stat_ready(process, hasRunFor, **kw):
- retval = subprocess.run("traffic_ctl metric get ssntxnorder_verify.test.done > done 2> /dev/null", shell=True, env=tsenv)
- if retval.returncode == 0:
- retval = subprocess.run("grep 1 done > /dev/null", shell = True, env=tsenv)
- return retval.returncode == 0
+ def done_stat_ready(process, hasRunFor, **kw):
+ retval = subprocess.run("traffic_ctl metric get ssntxnorder_verify.test.done > done 2> /dev/null", shell=True, env=tsenv)
+ if retval.returncode == 0:
+ retval = subprocess.run("grep 1 done > /dev/null", shell=True, env=tsenv)
+ return retval.returncode == 0
+
+ return done_stat_ready
- return done_stat_ready
# number of sessions/transactions opened and closed are equal
tr = Test.AddTestRun("Check Ssn order errors")
@@ -138,4 +141,3 @@ def done_stat_ready(process, hasRunFor, **kw):
"ssntxnorder_verify.txn.start {}".format(numberOfRequests), 'should be the number of transactions we made')
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-
diff --git a/tests/gold_tests/continuations/openclose_h2.test.py b/tests/gold_tests/continuations/openclose_h2.test.py
index 6f07ce97a8e..4a04eb9da10 100644
--- a/tests/gold_tests/continuations/openclose_h2.test.py
+++ b/tests/gold_tests/continuations/openclose_h2.test.py
@@ -73,9 +73,9 @@
# Create a bunch of curl commands to be executed in parallel. Default.Process is set in SpawnCommands.
# On Fedora 28/29, it seems that curl will occaisionally timeout after a couple seconds and return exitcode 2
# Examinig the packet capture shows that Traffic Server dutifully sends the response
-ps = tr.SpawnCommands(cmdstr=cmd, count=numberOfRequests, retcode=Any(0,2))
+ps = tr.SpawnCommands(cmdstr=cmd, count=numberOfRequests, retcode=Any(0, 2))
tr.Processes.Default.Env = ts.Env
-tr.Processes.Default.ReturnCode = Any(0,2)
+tr.Processes.Default.ReturnCode = Any(0, 2)
# Execution order is: ts/server, ps(curl cmds), Default Process.
tr.Processes.Default.StartBefore(
@@ -88,7 +88,7 @@
# Signal that all the curl processes have completed
tr = Test.AddTestRun("Curl Done")
-tr.DelayStart = 2 # Delaying a couple seconds to make sure the global continuation's lock contention resolves.
+tr.DelayStart = 2 # Delaying a couple seconds to make sure the global continuation's lock contention resolves.
tr.Processes.Default.Command = "traffic_ctl plugin msg done done"
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Env = ts.Env
@@ -97,14 +97,17 @@
# Parking this as a ready tester on a meaningless process
# To stall the test runs that check for the stats until the
# stats have propagated and are ready to read.
+
+
def make_done_stat_ready(tsenv):
- def done_stat_ready(process, hasRunFor, **kw):
- retval = subprocess.run("traffic_ctl metric get ssntxnorder_verify.test.done > done 2> /dev/null", shell=True, env=tsenv)
- if retval.returncode == 0:
- retval = subprocess.run("grep 1 done > /dev/null", shell = True, env=tsenv)
- return retval.returncode == 0
+ def done_stat_ready(process, hasRunFor, **kw):
+ retval = subprocess.run("traffic_ctl metric get ssntxnorder_verify.test.done > done 2> /dev/null", shell=True, env=tsenv)
+ if retval.returncode == 0:
+ retval = subprocess.run("grep 1 done > /dev/null", shell=True, env=tsenv)
+ return retval.returncode == 0
+
+ return done_stat_ready
- return done_stat_ready
# number of sessions/transactions opened and closed are equal
tr = Test.AddTestRun("Check Ssn order errors")
@@ -153,4 +156,3 @@ def done_stat_ready(process, hasRunFor, **kw):
"ssntxnorder_verify.txn.start {}".format(numberOfRequests), 'should be the number of transactions we made')
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-
diff --git a/tests/gold_tests/h2/h2active_timeout.py b/tests/gold_tests/h2/h2active_timeout.py
index d2f47f2ce53..aaf2622e66b 100644
--- a/tests/gold_tests/h2/h2active_timeout.py
+++ b/tests/gold_tests/h2/h2active_timeout.py
@@ -38,7 +38,7 @@ def makerequest(port, active_timeout):
response = conn.get_response(req_id)
req_id = conn.request('GET', '/')
response = conn.get_response(req_id)
- except:
+ except Exception:
print('CONNECTION_TIMEOUT')
return
diff --git a/tests/gold_tests/h2/h2disable.test.py b/tests/gold_tests/h2/h2disable.test.py
index 3fdc0e3bf8f..5f987e32514 100644
--- a/tests/gold_tests/h2/h2disable.test.py
+++ b/tests/gold_tests/h2/h2disable.test.py
@@ -56,11 +56,11 @@
})
ts.Disk.sni_yaml.AddLines([
- 'sni:',
- '- fqdn: bar.com',
- ' http2: off',
- '- fqdn: bob.*.com',
- ' http2: off',
+ 'sni:',
+ '- fqdn: bar.com',
+ ' http2: off',
+ '- fqdn: bob.*.com',
+ ' http2: off',
])
tr = Test.AddTestRun("Negotiate-h2")
@@ -86,7 +86,8 @@
tr2.TimeOut = 5
tr2 = Test.AddTestRun("Do not negotiate h2")
-tr2.Processes.Default.Command = "curl -v -k --resolve 'bob.foo.com:{0}:127.0.0.1' https://bob.foo.com:{0}".format(ts.Variables.ssl_port)
+tr2.Processes.Default.Command = "curl -v -k --resolve 'bob.foo.com:{0}:127.0.0.1' https://bob.foo.com:{0}".format(
+ ts.Variables.ssl_port)
tr2.ReturnCode = 0
tr2.StillRunningAfter = server
tr2.Processes.Default.TimeOut = 5
diff --git a/tests/gold_tests/h2/h2disable_no_accept_threads.test.py b/tests/gold_tests/h2/h2disable_no_accept_threads.test.py
index fe508a6cde2..e99952ba259 100644
--- a/tests/gold_tests/h2/h2disable_no_accept_threads.test.py
+++ b/tests/gold_tests/h2/h2disable_no_accept_threads.test.py
@@ -56,11 +56,11 @@
})
ts.Disk.sni_yaml.AddLines([
- 'sni:',
- '- fqdn: bar.com',
- ' http2: off',
- '- fqdn: bob.*.com',
- ' http2: off',
+ 'sni:',
+ '- fqdn: bar.com',
+ ' http2: off',
+ '- fqdn: bob.*.com',
+ ' http2: off',
])
tr = Test.AddTestRun("Negotiate-h2")
@@ -86,7 +86,8 @@
tr2.TimeOut = 5
tr2 = Test.AddTestRun("Do not negotiate h2")
-tr2.Processes.Default.Command = "curl -v -k --resolve 'bob.foo.com:{0}:127.0.0.1' https://bob.foo.com:{0}".format(ts.Variables.ssl_port)
+tr2.Processes.Default.Command = "curl -v -k --resolve 'bob.foo.com:{0}:127.0.0.1' https://bob.foo.com:{0}".format(
+ ts.Variables.ssl_port)
tr2.ReturnCode = 0
tr2.StillRunningAfter = server
tr2.Processes.Default.TimeOut = 5
diff --git a/tests/gold_tests/h2/h2enable.test.py b/tests/gold_tests/h2/h2enable.test.py
index 07964af61d6..6f7cf02f1eb 100644
--- a/tests/gold_tests/h2/h2enable.test.py
+++ b/tests/gold_tests/h2/h2enable.test.py
@@ -56,11 +56,11 @@
})
ts.Disk.sni_yaml.AddLines([
- 'sni:',
- '- fqdn: bar.com',
- ' http2: on',
- '- fqdn: bob.*.com',
- ' http2: on',
+ 'sni:',
+ '- fqdn: bar.com',
+ ' http2: on',
+ '- fqdn: bob.*.com',
+ ' http2: on',
])
tr = Test.AddTestRun("Do-not-Negotiate-h2")
@@ -86,7 +86,8 @@
tr2.TimeOut = 5
tr2 = Test.AddTestRun("Do negotiate h2")
-tr2.Processes.Default.Command = "curl -v -k --resolve 'bob.foo.com:{0}:127.0.0.1' https://bob.foo.com:{0}".format(ts.Variables.ssl_port)
+tr2.Processes.Default.Command = "curl -v -k --resolve 'bob.foo.com:{0}:127.0.0.1' https://bob.foo.com:{0}".format(
+ ts.Variables.ssl_port)
tr2.ReturnCode = 0
tr2.StillRunningAfter = server
tr2.Processes.Default.TimeOut = 5
diff --git a/tests/gold_tests/h2/h2enable_no_accept_threads.test.py b/tests/gold_tests/h2/h2enable_no_accept_threads.test.py
index 9e64acc40ff..0e914d0c385 100644
--- a/tests/gold_tests/h2/h2enable_no_accept_threads.test.py
+++ b/tests/gold_tests/h2/h2enable_no_accept_threads.test.py
@@ -56,11 +56,11 @@
})
ts.Disk.sni_yaml.AddLines([
- 'sni:',
- '- fqdn: bar.com',
- ' http2: on',
- '- fqdn: bob.*.com',
- ' http2: on',
+ 'sni:',
+ '- fqdn: bar.com',
+ ' http2: on',
+ '- fqdn: bob.*.com',
+ ' http2: on',
])
tr = Test.AddTestRun("Do-not-Negotiate-h2")
@@ -86,7 +86,8 @@
tr2.TimeOut = 5
tr2 = Test.AddTestRun("Do negotiate h2")
-tr2.Processes.Default.Command = "curl -v -k --resolve 'bob.foo.com:{0}:127.0.0.1' https://bob.foo.com:{0}".format(ts.Variables.ssl_port)
+tr2.Processes.Default.Command = "curl -v -k --resolve 'bob.foo.com:{0}:127.0.0.1' https://bob.foo.com:{0}".format(
+ ts.Variables.ssl_port)
tr2.ReturnCode = 0
tr2.StillRunningAfter = server
tr2.Processes.Default.TimeOut = 5
diff --git a/tests/gold_tests/h2/h2spec.test.py b/tests/gold_tests/h2/h2spec.test.py
index c1ff4f011bb..e91fd229ff1 100644
--- a/tests/gold_tests/h2/h2spec.test.py
+++ b/tests/gold_tests/h2/h2spec.test.py
@@ -54,7 +54,7 @@
'proxy.config.http.cache.http': 0,
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.diags.debug.enabled': 0,
'proxy.config.diags.debug.tags': 'http',
})
diff --git a/tests/gold_tests/h2/http2.test.py b/tests/gold_tests/h2/http2.test.py
index d75a9d41663..cbced007e59 100644
--- a/tests/gold_tests/h2/http2.test.py
+++ b/tests/gold_tests/h2/http2.test.py
@@ -33,32 +33,52 @@
# For Test Case 1 & 5 - /
server.addResponse("sessionlog.json",
- {"headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""},
- {"headers": "HTTP/1.1 200 OK\r\nServer: microserver\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""})
+ {"headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""},
+ {"headers": "HTTP/1.1 200 OK\r\nServer: microserver\r\nConnection: close\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""})
# For Test Case 2 - /bigfile
# Add info for the large H2 download test
server.addResponse("sessionlog.json",
- {"headers": "GET /bigfile HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""},
- {"headers": "HTTP/1.1 200 OK\r\nServer: microserver\r\nConnection: close\r\nCache-Control: max-age=3600\r\nContent-Length: 191414\r\n\r\n", "timestamp": "1469733493.993", "body": ""})
+ {"headers": "GET /bigfile HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""},
+ {"headers": "HTTP/1.1 200 OK\r\nServer: microserver\r\nConnection: close\r\nCache-Control: max-age=3600\r\nContent-Length: 191414\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""})
# For Test Case 3 - /test2
server.addResponse("sessionlog.json",
- {"headers": "GET /test2 HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""},
- {"headers": "HTTP/1.1 200 OK\r\nServer: microserver\r\nTransfer-Encoding: chunked\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""})
+ {"headers": "GET /test2 HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""},
+ {"headers": "HTTP/1.1 200 OK\r\nServer: microserver\r\nTransfer-Encoding: chunked\r\nConnection: close\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""})
# For Test Case 6 - /postchunked
post_body = "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
server.addResponse("sessionlog.jason",
- {"headers": "POST /postchunked HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": post_body},
- {"headers": "HTTP/1.1 200 OK\r\nServer: microserver\r\nConnection: close\r\nContent-Length: 10\r\n\r\n", "timestamp": "1469733493.993", "body": "0123456789"})
+ {"headers": "POST /postchunked HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": post_body},
+ {"headers": "HTTP/1.1 200 OK\r\nServer: microserver\r\nConnection: close\r\nContent-Length: 10\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": "0123456789"})
# For Test Case 7 - /bigpostchunked
# Make a post body that will be split across at least two frames
big_post_body = "0123456789" * 131070
server.addResponse("sessionlog.jason",
- {"headers": "POST /bigpostchunked HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": big_post_body},
- {"headers": "HTTP/1.1 200 OK\r\nServer: microserver\r\nConnection: close\r\nContent-Length: 10\r\n\r\n", "timestamp": "1469733493.993", "body": "0123456789"})
+ {"headers": "POST /bigpostchunked HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": big_post_body},
+ {"headers": "HTTP/1.1 200 OK\r\nServer: microserver\r\nConnection: close\r\nContent-Length: 10\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": "0123456789"})
big_post_body_file = open(os.path.join(Test.RunDirectory, "big_post_body"), "w")
big_post_body_file.write(big_post_body)
@@ -66,13 +86,21 @@
# For Test Case 8 - /huge_resp_hdrs
server.addResponse("sessionlog.json",
- {"headers": "GET /huge_resp_hdrs HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""},
- {"headers": "HTTP/1.1 200 OK\r\nServer: microserver\r\nConnection: close\r\nContent-Length: 6\r\n\r\n", "timestamp": "1469733493.993", "body": "200 OK"})
+ {"headers": "GET /huge_resp_hdrs HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""},
+ {"headers": "HTTP/1.1 200 OK\r\nServer: microserver\r\nConnection: close\r\nContent-Length: 6\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": "200 OK"})
# For Test Case 9 - /status/204
server.addResponse("sessionlog.json",
- {"headers": "GET /status/204 HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""},
- {"headers": "HTTP/1.1 204 No Content\r\nServer: microserver\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""})
+ {"headers": "GET /status/204 HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""},
+ {"headers": "HTTP/1.1 204 No Content\r\nServer: microserver\r\nConnection: close\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""})
# ----
# Setup ATS
@@ -85,8 +113,8 @@
ts.Setup.CopyAs('rules/huge_resp_hdrs.conf', Test.RunDirectory)
ts.Disk.remap_config.AddLine(
- 'map /huge_resp_hdrs http://127.0.0.1:{0}/huge_resp_hdrs @plugin=header_rewrite.so @pparam={1}/huge_resp_hdrs.conf '.format(server.Variables.Port, Test.RunDirectory)
-)
+ 'map /huge_resp_hdrs http://127.0.0.1:{0}/huge_resp_hdrs @plugin=header_rewrite.so @pparam={1}/huge_resp_hdrs.conf '.format(
+ server.Variables.Port, Test.RunDirectory))
ts.Disk.remap_config.AddLine(
'map / http://127.0.0.1:{0}'.format(server.Variables.Port)
@@ -101,7 +129,7 @@
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.http.cache.http': 0,
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
'proxy.config.http2.active_timeout_in': 3,
'proxy.config.http2.max_concurrent_streams_in': 65535,
@@ -161,7 +189,8 @@
# While HTTP/2 does not support Tranfer-encoding we pass that into curl to encourage it to not set the content length
# on the post body
tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'curl -s -k -H "Transfer-Encoding: chunked" -d "{0}" https://127.0.0.1:{1}/postchunked'.format(post_body, ts.Variables.ssl_port)
+tr.Processes.Default.Command = 'curl -s -k -H "Transfer-Encoding: chunked" -d "{0}" https://127.0.0.1:{1}/postchunked'.format(
+ post_body, ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = "gold/post_chunked.gold"
tr.StillRunningAfter = server
@@ -170,7 +199,8 @@
# While HTTP/2 does not support Tranfer-encoding we pass that into curl to encourage it to not set the content length
# on the post body
tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'curl -s -k -H "Transfer-Encoding: chunked" -d @big_post_body https://127.0.0.1:{0}/bigpostchunked'.format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = 'curl -s -k -H "Transfer-Encoding: chunked" -d @big_post_body https://127.0.0.1:{0}/bigpostchunked'.format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = "gold/post_chunked.gold"
tr.StillRunningAfter = server
diff --git a/tests/gold_tests/h2/http2_priority.test.py b/tests/gold_tests/h2/http2_priority.test.py
index d3f5581e578..117b28610a1 100644
--- a/tests/gold_tests/h2/http2_priority.test.py
+++ b/tests/gold_tests/h2/http2_priority.test.py
@@ -33,8 +33,12 @@
# Test Case 0:
server.addResponse("sessionlog.json",
- {"headers": "GET /bigfile HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""},
- {"headers": "HTTP/1.1 200 OK\r\nServer: microserver\r\nConnection: close\r\nCache-Control: max-age=3600\r\nContent-Length: 1048576\r\n\r\n", "timestamp": "1469733493.993", "body": ""})
+ {"headers": "GET /bigfile HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""},
+ {"headers": "HTTP/1.1 200 OK\r\nServer: microserver\r\nConnection: close\r\nCache-Control: max-age=3600\r\nContent-Length: 1048576\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""})
# ----
# Setup ATS
@@ -56,7 +60,7 @@
'proxy.config.http2.no_activity_timeout_in': 3,
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
'proxy.config.diags.debug.enabled': 1,
'proxy.config.diags.debug.tags': 'http2',
diff --git a/tests/gold_tests/h2/httpbin.test.py b/tests/gold_tests/h2/httpbin.test.py
index 2144df8a06d..574f00ffe83 100644
--- a/tests/gold_tests/h2/httpbin.test.py
+++ b/tests/gold_tests/h2/httpbin.test.py
@@ -57,14 +57,14 @@
'proxy.config.http.cache.http': 0,
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
'proxy.config.diags.debug.enabled': 1,
'proxy.config.diags.debug.tags': 'http2',
})
ts.Disk.logging_yaml.AddLines(
-'''
+ '''
logging:
formats:
- name: access
diff --git a/tests/gold_tests/h2/nghttp.test.py b/tests/gold_tests/h2/nghttp.test.py
index 2e149a67dd9..2bed24bed26 100644
--- a/tests/gold_tests/h2/nghttp.test.py
+++ b/tests/gold_tests/h2/nghttp.test.py
@@ -40,8 +40,11 @@
# For Test Case 0
microserver.addResponse("sessionlog.json",
{"headers": "POST /post HTTP/1.1\r\nHost: www.example.com\r\nTrailer: foo\r\n\r\n",
- "timestamp": "1469733493.993", "body": post_body},
- {"headers": "HTTP/1.1 200 OK\r\nServer: microserver\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""})
+ "timestamp": "1469733493.993",
+ "body": post_body},
+ {"headers": "HTTP/1.1 200 OK\r\nServer: microserver\r\nConnection: close\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""})
# ----
# Setup ATS
diff --git a/tests/gold_tests/headers/cache_and_req_body.test.py b/tests/gold_tests/headers/cache_and_req_body.test.py
index f42ec57e42e..c9aba744bd1 100644
--- a/tests/gold_tests/headers/cache_and_req_body.test.py
+++ b/tests/gold_tests/headers/cache_and_req_body.test.py
@@ -27,10 +27,13 @@
ts = Test.MakeATSProcess("ts")
server = Test.MakeOriginServer("server")
-#**testname is required**
+# **testname is required**
testName = ""
request_header = {"headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
-response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\nLast-Modified: Tue, 08 May 2018 15:49:41 GMT\r\nCache-Control: max-age=1\r\n\r\n", "timestamp": "1469733493.993", "body": "xxx"}
+response_header = {
+ "headers": "HTTP/1.1 200 OK\r\nConnection: close\r\nLast-Modified: Tue, 08 May 2018 15:49:41 GMT\r\nCache-Control: max-age=1\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": "xxx"}
server.addResponse("sessionlog.json", request_header, response_header)
# ATS Configuration
@@ -48,70 +51,74 @@
)
cache_and_req_body_miss = {
- 'Connection' : 'keep-alive',
- 'Via' : {'equal_re' : None},
- 'Server' : {'equal_re' : '.*'},
- 'X-Cache-Key' : {'equal_re' : 'http://127.0.0.1.*'},
- 'X-Cache' : 'miss',
- 'Last-Modified' : {'equal_re' : '.*'},
- 'cache-control' : 'max-age=1',
- 'Content-Length' : '3',
- 'Date' : {'equal_re' : '.*'},
- 'Age' : {'equal_re' : '.*'}
+ 'Connection': 'keep-alive',
+ 'Via': {'equal_re': None},
+ 'Server': {'equal_re': '.*'},
+ 'X-Cache-Key': {'equal_re': 'http://127.0.0.1.*'},
+ 'X-Cache': 'miss',
+ 'Last-Modified': {'equal_re': '.*'},
+ 'cache-control': 'max-age=1',
+ 'Content-Length': '3',
+ 'Date': {'equal_re': '.*'},
+ 'Age': {'equal_re': '.*'}
}
cache_and_req_body_hit = {
- 'Last-Modified' : {'equal_re' : '.*'},
- 'cache-control' : 'max-age=1',
- 'Content-Length' : '3',
- 'Date' : {'equal_re' : '.*'},
- 'Age' : {'equal_re' : '.*'},
- 'Connection' : 'keep-alive',
- 'Via' : {'equal_re' : '.*'},
- 'Server' : {'equal_re' : '.*'},
- 'X-Cache' : 'hit-fresh',
- 'HTTP/1.1 200 OK' : ''
+ 'Last-Modified': {'equal_re': '.*'},
+ 'cache-control': 'max-age=1',
+ 'Content-Length': '3',
+ 'Date': {'equal_re': '.*'},
+ 'Age': {'equal_re': '.*'},
+ 'Connection': 'keep-alive',
+ 'Via': {'equal_re': '.*'},
+ 'Server': {'equal_re': '.*'},
+ 'X-Cache': 'hit-fresh',
+ 'HTTP/1.1 200 OK': ''
}
cache_and_req_body_hit_close = {
- 'Last-Modified' : {'equal_re' : '.*'},
- 'cache-control' : 'max-age=1',
- 'Content-Length' : '3',
- 'Date' : {'equal_re' : '.*'},
- 'Age' : {'equal_re' : '.*'},
- 'Connection' : 'close',
- 'Via' : {'equal_re' : '.*'},
- 'Server' : {'equal_re' : '.*'},
- 'X-Cache' : 'hit-fresh',
- 'HTTP/1.1 200 OK' : ''
+ 'Last-Modified': {'equal_re': '.*'},
+ 'cache-control': 'max-age=1',
+ 'Content-Length': '3',
+ 'Date': {'equal_re': '.*'},
+ 'Age': {'equal_re': '.*'},
+ 'Connection': 'close',
+ 'Via': {'equal_re': '.*'},
+ 'Server': {'equal_re': '.*'},
+ 'X-Cache': 'hit-fresh',
+ 'HTTP/1.1 200 OK': ''
}
# Test 1 - 200 response and cache fill
tr = Test.AddTestRun()
tr.Processes.Default.StartBefore(server)
tr.Processes.Default.StartBefore(ts, ready=When.PortOpen(ts.Variables.port))
-tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{port}/'.format(port=ts.Variables.port)
+tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{port}/'.format(
+ port=ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = Testers.CurlHeader(cache_and_req_body_miss)
tr.StillRunningAfter = ts
# Test 2 - 200 cached response and using netcat
tr = Test.AddTestRun()
-tr.Processes.Default.Command = "printf 'GET / HTTP/1.1\r\n''x-debug: x-cache,x-cache-key,via\r\n''Host: www.example.com\r\n''\r\n'|nc 127.0.0.1 -w 1 {port}".format(port=ts.Variables.port)
+tr.Processes.Default.Command = "printf 'GET / HTTP/1.1\r\n''x-debug: x-cache,x-cache-key,via\r\n''Host: www.example.com\r\n''\r\n'|nc 127.0.0.1 -w 1 {port}".format(
+ port=ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = Testers.CurlHeader(cache_and_req_body_hit)
tr.StillRunningAfter = ts
# Test 3 - 200 cached response and trying to hide a request in the body
tr = Test.AddTestRun()
-tr.Processes.Default.Command = "printf 'GET / HTTP/1.1\r\n''x-debug: x-cache,x-cache-key,via\r\n''Host: www.example.com\r\n''Content-Length: 71\r\n''\r\n''GET /index.html?evil=zorg810 HTTP/1.1\r\n''Host: dummy-host.example.com\r\n''\r\n'|nc 127.0.0.1 -w 1 {port}".format(port=ts.Variables.port)
+tr.Processes.Default.Command = "printf 'GET / HTTP/1.1\r\n''x-debug: x-cache,x-cache-key,via\r\n''Host: www.example.com\r\n''Content-Length: 71\r\n''\r\n''GET /index.html?evil=zorg810 HTTP/1.1\r\n''Host: dummy-host.example.com\r\n''\r\n'|nc 127.0.0.1 -w 1 {port}".format(
+ port=ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = Testers.CurlHeader(cache_and_req_body_hit)
tr.StillRunningAfter = ts
# Test 4 - 200 cached response and Content-Length larger than bytes sent, MUST close
tr = Test.AddTestRun()
-tr.Processes.Default.Command = "printf 'GET / HTTP/1.1\r\n''x-debug: x-cache,x-cache-key,via\r\n''Host: dummy-host.example.com\r\n''Cache-control: max-age=300\r\n''Content-Length: 100\r\n''\r\n''GET /index.html?evil=zorg810 HTTP/1.1\r\n''Host: dummy-host.example.com\r\n''\r\n'|nc 127.0.0.1 -w 1 {port}".format(port=ts.Variables.port)
+tr.Processes.Default.Command = "printf 'GET / HTTP/1.1\r\n''x-debug: x-cache,x-cache-key,via\r\n''Host: dummy-host.example.com\r\n''Cache-control: max-age=300\r\n''Content-Length: 100\r\n''\r\n''GET /index.html?evil=zorg810 HTTP/1.1\r\n''Host: dummy-host.example.com\r\n''\r\n'|nc 127.0.0.1 -w 1 {port}".format(
+ port=ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = Testers.CurlHeader(cache_and_req_body_hit_close)
tr.StillRunningAfter = ts
diff --git a/tests/gold_tests/headers/cachedIMSRange.test.py b/tests/gold_tests/headers/cachedIMSRange.test.py
index 2738aaa3716..a799d637bcb 100644
--- a/tests/gold_tests/headers/cachedIMSRange.test.py
+++ b/tests/gold_tests/headers/cachedIMSRange.test.py
@@ -27,33 +27,69 @@
# Set up Origin server
# request_header is from ATS to origin; response from Origin to ATS
# lookup_key is to make unique response in origin for header "UID" that will pass in ATS request
-server = Test.MakeOriginServer("server",lookup_key="{%UID}")
+server = Test.MakeOriginServer("server", lookup_key="{%UID}")
# Initial request
-request_header = {"headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\nUID: Fill\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
-response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\nLast-Modified: Tue, 08 May 2018 15:49:41 GMT\r\nCache-Control: max-age=1\r\n\r\n", "timestamp": "1469733493.993", "body": "xxx"}
+request_header = {
+ "headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\nUID: Fill\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""}
+response_header = {
+ "headers": "HTTP/1.1 200 OK\r\nConnection: close\r\nLast-Modified: Tue, 08 May 2018 15:49:41 GMT\r\nCache-Control: max-age=1\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": "xxx"}
server.addResponse("sessionlog.json", request_header, response_header)
# IMS revalidation request
-request_IMS_header = {"headers": "GET / HTTP/1.1\r\nUID: IMS\r\nIf-Modified-Since: Tue, 08 May 2018 15:49:41 GMT\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
-response_IMS_header = {"headers": "HTTP/1.1 304 Not Modified\r\nConnection: close\r\nCache-Control: max-age=1\r\n\r\n", "timestamp": "1469733493.993", "body": None}
+request_IMS_header = {
+ "headers": "GET / HTTP/1.1\r\nUID: IMS\r\nIf-Modified-Since: Tue, 08 May 2018 15:49:41 GMT\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""}
+response_IMS_header = {
+ "headers": "HTTP/1.1 304 Not Modified\r\nConnection: close\r\nCache-Control: max-age=1\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": None}
server.addResponse("sessionlog.json", request_IMS_header, response_IMS_header)
# EtagFill
-request_etagfill_header = {"headers": "GET /etag HTTP/1.1\r\nHost: www.example.com\r\nUID: EtagFill\r\n\r\n", "timestamp": "1469733493.993", "body": None}
-response_etagfill_header = {"headers": "HTTP/1.1 200 OK\r\nETag: myetag\r\nConnection: close\r\nCache-Control: max-age=1\r\n\r\n", "timestamp": "1469733493.993", "body": "xxx"}
+request_etagfill_header = {
+ "headers": "GET /etag HTTP/1.1\r\nHost: www.example.com\r\nUID: EtagFill\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": None}
+response_etagfill_header = {
+ "headers": "HTTP/1.1 200 OK\r\nETag: myetag\r\nConnection: close\r\nCache-Control: max-age=1\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": "xxx"}
server.addResponse("sessionlog.json", request_etagfill_header, response_etagfill_header)
# INM revalidation
-request_INM_header = {"headers": "GET /etag HTTP/1.1\r\nUID: INM\r\nIf-None-Match: myetag\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": None}
-response_INM_header = {"headers": "HTTP/1.1 304 Not Modified\r\nConnection: close\r\nETag: myetag\r\nCache-Control: max-age=1\r\n\r\n", "timestamp": "1469733493.993", "body": None}
+request_INM_header = {
+ "headers": "GET /etag HTTP/1.1\r\nUID: INM\r\nIf-None-Match: myetag\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": None}
+response_INM_header = {
+ "headers": "HTTP/1.1 304 Not Modified\r\nConnection: close\r\nETag: myetag\r\nCache-Control: max-age=1\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": None}
server.addResponse("sessionlog.json", request_INM_header, response_INM_header)
# object changed to 0 byte
-request_noBody_header = {"headers": "GET / HTTP/1.1\r\nUID: noBody\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
-response_noBody_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\nContent-Length: 0\r\nCache-Control: max-age=3\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_noBody_header = {
+ "headers": "GET / HTTP/1.1\r\nUID: noBody\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""}
+response_noBody_header = {
+ "headers": "HTTP/1.1 200 OK\r\nConnection: close\r\nContent-Length: 0\r\nCache-Control: max-age=3\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""}
server.addResponse("sessionlog.json", request_noBody_header, response_noBody_header)
# etag object now is a 404. Yeah, 404s don't usually have Cache-Control, but, ATS's default is to cache 404s for a while.
-request_etagfill_header = {"headers": "GET /etag HTTP/1.1\r\nHost: www.example.com\r\nUID: EtagError\r\n\r\n", "timestamp": "1469733493.993", "body": None}
-response_etagfill_header = {"headers": "HTTP/1.1 404 Not Found\r\nConnection: close\r\nContent-Length: 0\r\nCache-Control: max-age=3\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_etagfill_header = {
+ "headers": "GET /etag HTTP/1.1\r\nHost: www.example.com\r\nUID: EtagError\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": None}
+response_etagfill_header = {
+ "headers": "HTTP/1.1 404 Not Found\r\nConnection: close\r\nContent-Length: 0\r\nCache-Control: max-age=3\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""}
server.addResponse("sessionlog.json", request_etagfill_header, response_etagfill_header)
# ATS Configuration
@@ -75,25 +111,32 @@
tr = Test.AddTestRun()
tr.Processes.Default.StartBefore(server)
tr.Processes.Default.StartBefore(ts, ready=When.PortOpen(ts.Variables.port))
-tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H"UID: Fill" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/'.format(ts.Variables.port)
+tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H"UID: Fill" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "cache_and_req_body-miss.gold"
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-# Test 1 - Once it goes stale, fetch it again. We expect Origin to get IMS request, and serve a 304. We expect ATS to refresh the object, and give a 200 to user
+# Test 1 - Once it goes stale, fetch it again. We expect Origin to get IMS
+# request, and serve a 304. We expect ATS to refresh the object, and give
+# a 200 to user
tr = Test.AddTestRun()
-tr.DelayStart=2
-tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H"UID: IMS" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/'.format(ts.Variables.port)
+tr.DelayStart = 2
+tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H"UID: IMS" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "cache_and_req_body-hit-stale.gold"
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-# Test 2 - Once it goes stale, fetch it via a range request. We expect Origin to get IMS request, and serve a 304. We expect ATS to refresh the object, and give a 206 to user
+# Test 2 - Once it goes stale, fetch it via a range request. We expect
+# Origin to get IMS request, and serve a 304. We expect ATS to refresh the
+# object, and give a 206 to user
tr = Test.AddTestRun()
-tr.DelayStart=2
-tr.Processes.Default.Command = 'curl --range 0-1 -s -D - -v --ipv4 --http1.1 -H"UID: IMS" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/'.format(ts.Variables.port)
+tr.DelayStart = 2
+tr.Processes.Default.Command = 'curl --range 0-1 -s -D - -v --ipv4 --http1.1 -H"UID: IMS" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "cache_and_req_body-hit-stale-206.gold"
tr.StillRunningAfter = ts
@@ -101,24 +144,31 @@
# Test 3 - Fill a new object with an Etag. Not checking the output here.
tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H"UID: EtagFill" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/etag'.format(ts.Variables.port)
+tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H"UID: EtagFill" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/etag'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-# Test 4 - Once the etag object goes stale, fetch it again. We expect Origin to get INM request, and serve a 304. We expect ATS to refresh the object, and give a 200 to user
+# Test 4 - Once the etag object goes stale, fetch it again. We expect
+# Origin to get INM request, and serve a 304. We expect ATS to refresh the
+# object, and give a 200 to user
tr = Test.AddTestRun()
-tr.DelayStart=2
-tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H"UID: INM" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/etag'.format(ts.Variables.port)
+tr.DelayStart = 2
+tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H"UID: INM" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/etag'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "cache_and_req_body-hit-stale-INM.gold"
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-# Test 5 - Once the etag object goes stale, fetch it via a range request. We expect Origin to get INM request, and serve a 304. We expect ATS to refresh the object, and give a 206 to user
+# Test 5 - Once the etag object goes stale, fetch it via a range request.
+# We expect Origin to get INM request, and serve a 304. We expect ATS to
+# refresh the object, and give a 206 to user
tr = Test.AddTestRun()
-tr.DelayStart=2
-tr.Processes.Default.Command = 'curl --range 0-1 -s -D - -v --ipv4 --http1.1 -H"UID: INM" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/etag'.format(ts.Variables.port)
+tr.DelayStart = 2
+tr.Processes.Default.Command = 'curl --range 0-1 -s -D - -v --ipv4 --http1.1 -H"UID: INM" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/etag'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "cache_and_req_body-hit-stale-206-etag.gold"
tr.StillRunningAfter = ts
@@ -126,8 +176,9 @@
# Test 6 - The origin changes the initial LMT object to 0 byte. We expect ATS to fetch and serve the new 0 byte object.
tr = Test.AddTestRun()
-tr.DelayStart=3
-tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H"UID: noBody" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/'.format(ts.Variables.port)
+tr.DelayStart = 3
+tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H"UID: noBody" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "cache_and_req_nobody-hit-stale.gold"
tr.StillRunningAfter = ts
@@ -135,8 +186,9 @@
# Test 7 - Fetch the new 0 byte object again when fresh in cache to ensure its still a 0 byte object.
tr = Test.AddTestRun()
-tr.DelayStart=3
-tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H"UID: noBody" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/'.format(ts.Variables.port)
+tr.DelayStart = 3
+tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H"UID: noBody" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "cache_and_req_nobody-hit-stale.gold"
tr.StillRunningAfter = ts
@@ -144,8 +196,9 @@
# Test 8 - The origin changes the etag object to 0 byte 404. We expect ATS to fetch and serve the 404 0 byte object.
tr = Test.AddTestRun()
-tr.DelayStart=2
-tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H"UID: EtagError" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/etag'.format(ts.Variables.port)
+tr.DelayStart = 2
+tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H"UID: EtagError" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/etag'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "cache_and_error_nobody.gold"
tr.StillRunningAfter = ts
@@ -153,8 +206,9 @@
# Test 9 - Fetch the 0 byte etag object again when fresh in cache to ensure its still a 0 byte object
tr = Test.AddTestRun()
-tr.DelayStart=2
-tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H"UID: EtagError" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/etag'.format(ts.Variables.port)
+tr.DelayStart = 2
+tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H"UID: EtagError" -H "x-debug: x-cache,x-cache-key,via" -H "Host: www.example.com" http://localhost:{0}/etag'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "cache_and_error_nobody.gold"
tr.StillRunningAfter = ts
diff --git a/tests/gold_tests/headers/forwarded-observer.py b/tests/gold_tests/headers/forwarded-observer.py
index 7789c4296d1..4e5cbf992b8 100644
--- a/tests/gold_tests/headers/forwarded-observer.py
+++ b/tests/gold_tests/headers/forwarded-observer.py
@@ -26,6 +26,7 @@
byCount = 0
byEqualUuid = "__INVALID__"
+
def observe(headers):
global byCount
diff --git a/tests/gold_tests/headers/general-connection-failure-502.test.py b/tests/gold_tests/headers/general-connection-failure-502.test.py
index 889bea565ee..4cb06c3b449 100644
--- a/tests/gold_tests/headers/general-connection-failure-502.test.py
+++ b/tests/gold_tests/headers/general-connection-failure-502.test.py
@@ -25,21 +25,21 @@
ts = Test.MakeATSProcess("ts")
HOST = 'www.connectfail502.test'
-server = Test.MakeOriginServer("server", ssl=False) # Reserves a port across autest.
+server = Test.MakeOriginServer("server", ssl=False) # Reserves a port across autest.
ts.Disk.remap_config.AddLine(
- 'map http://{host} http://{ip}:{uport}'.format(host=HOST, ip='127.0.0.1', uport=server.Variables.Port)
+ 'map http://{host} http://{ip}:{uport}'.format(host=HOST, ip='127.0.0.1', uport=server.Variables.Port)
)
Test.Setup.Copy(os.path.join(Test.Variables.AtsTestToolsDir, 'tcp_client.py'))
-data_file=Test.Disk.File("www.connectfail502.test-get.txt", id="datafile")
+data_file = Test.Disk.File("www.connectfail502.test-get.txt", id="datafile")
data_file.WriteOn("GET / HTTP/1.1\r\nHost: {host}\r\n\r\n".format(host=HOST))
tr = Test.AddTestRun()
tr.Processes.Default.StartBefore(Test.Processes.ts)
# Do not start the origin server: We wish to simulate connection refused while hopefully no one else uses this port.
tr.Processes.Default.Command = "python3 tcp_client.py 127.0.0.1 {0} {1} | sed -e '/^Date: /d' -e '/^Server: ATS\//d'"\
- .format(ts.Variables.port, "www.connectfail502.test-get.txt")
+ .format(ts.Variables.port, "www.connectfail502.test-get.txt")
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = 'general-connection-failure-502.gold'
diff --git a/tests/gold_tests/headers/hsts.test.py b/tests/gold_tests/headers/hsts.test.py
index 67ed89ce656..f8b7292e98e 100644
--- a/tests/gold_tests/headers/hsts.test.py
+++ b/tests/gold_tests/headers/hsts.test.py
@@ -27,7 +27,7 @@
ts = Test.MakeATSProcess("ts", select_ports=True, enable_tls=True)
server = Test.MakeOriginServer("server")
-#**testname is required**
+# **testname is required**
testName = ""
request_header = {"headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
diff --git a/tests/gold_tests/headers/http408.test.py b/tests/gold_tests/headers/http408.test.py
index 9db1ccec1b0..e3c2d9cd697 100644
--- a/tests/gold_tests/headers/http408.test.py
+++ b/tests/gold_tests/headers/http408.test.py
@@ -39,7 +39,7 @@
'map http://{0} http://127.0.0.1:{1}'.format(HTTP_408_HOST, server.Variables.Port)
)
-TIMEOUT=2
+TIMEOUT = 2
ts.Disk.records_config.update({
'proxy.config.http.transaction_no_activity_timeout_in': TIMEOUT,
})
@@ -51,7 +51,7 @@
tr.Processes.Default.StartBefore(server)
tr.Processes.Default.StartBefore(Test.Processes.ts)
tr.Processes.Default.Command = 'python3 tcp_client.py 127.0.0.1 {0} {1} --delay-after-send {2}'\
- .format(ts.Variables.port, 'data/{0}.txt'.format(HTTP_408_HOST), TIMEOUT + 2)
+ .format(ts.Variables.port, 'data/{0}.txt'.format(HTTP_408_HOST), TIMEOUT + 2)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.TimeOut = 10
tr.Processes.Default.Streams.stdout = "http408.gold"
diff --git a/tests/gold_tests/headers/normalize_ae_observer.py b/tests/gold_tests/headers/normalize_ae_observer.py
index 10de1d48e13..49947766de9 100644
--- a/tests/gold_tests/headers/normalize_ae_observer.py
+++ b/tests/gold_tests/headers/normalize_ae_observer.py
@@ -19,6 +19,7 @@
log = open('normalize_ae.log', 'w')
+
def observe(headers):
seen = False
@@ -36,4 +37,5 @@ def observe(headers):
log.write("-\n")
log.flush()
+
Hooks.register(Hooks.ReadRequestHook, observe)
diff --git a/tests/gold_tests/headers/syntax.test.py b/tests/gold_tests/headers/syntax.test.py
index 0fc79dbea8f..262b8358561 100644
--- a/tests/gold_tests/headers/syntax.test.py
+++ b/tests/gold_tests/headers/syntax.test.py
@@ -27,7 +27,7 @@
ts = Test.MakeATSProcess("ts")
server = Test.MakeOriginServer("server")
-#**testname is required**
+# **testname is required**
testName = ""
request_header = {"headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
@@ -41,42 +41,48 @@
tr = Test.AddTestRun()
tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port))
tr.Processes.Default.StartBefore(Test.Processes.ts, ready=When.PortOpen(ts.Variables.port))
-tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H " foo: bar" -H "Host: www.example.com" http://localhost:{0}/'.format(ts.Variables.port)
+tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H " foo: bar" -H "Host: www.example.com" http://localhost:{0}/'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "syntax.200.gold"
tr.StillRunningAfter = ts
# Test 1 - 400 Response - Single space after field name
tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H "foo : bar" -H "Host: www.example.com" http://localhost:{0}/'.format(ts.Variables.port)
+tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H "foo : bar" -H "Host: www.example.com" http://localhost:{0}/'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "syntax.400.gold"
tr.StillRunningAfter = ts
# Test 2 - 400 Response - Double space after field name
tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H "foo : bar" -H "Host: www.example.com" http://localhost:{0}/'.format(ts.Variables.port)
+tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H "foo : bar" -H "Host: www.example.com" http://localhost:{0}/'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "syntax.400.gold"
tr.StillRunningAfter = ts
# Test 3 - 400 Response - Three different Content-Length headers
tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -d "hello world" -H "Content-Length: 11" -H "Content-Length: 10" -H "Content-Length: 9" -H "Host: www.example.com" http://localhost:{0}/'.format(ts.Variables.port)
+tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -d "hello world" -H "Content-Length: 11" -H "Content-Length: 10" -H "Content-Length: 9" -H "Host: www.example.com" http://localhost:{0}/'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "syntax.400.gold"
tr.StillRunningAfter = ts
# Test 4 - 200 Response - Three same Content-Length headers
tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -d "hello world" -H "Content-Length: 11" -H "Content-Length: 11" -H "Content-Length: 11" -H "Host: www.example.com" http://localhost:{0}/'.format(ts.Variables.port)
+tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -d "hello world" -H "Content-Length: 11" -H "Content-Length: 11" -H "Content-Length: 11" -H "Host: www.example.com" http://localhost:{0}/'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "syntax.200.gold"
tr.StillRunningAfter = ts
# Test 5 - 200 Response - Three different Content-Length headers with a Transfer encoding header
tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -d "hello world" -H "Transfer-Encoding: chunked" -H "Content-Length: 11" -H "Content-Length: 10" -H "Content-Length: 9" -H "Host: www.example.com" http://localhost:{0}/'.format(ts.Variables.port)
+tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -d "hello world" -H "Transfer-Encoding: chunked" -H "Content-Length: 11" -H "Content-Length: 10" -H "Content-Length: 9" -H "Host: www.example.com" http://localhost:{0}/'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "syntax.200.gold"
tr.StillRunningAfter = ts
diff --git a/tests/gold_tests/headers/via.test.py b/tests/gold_tests/headers/via.test.py
index 5e275d193df..7fc07bc25e1 100644
--- a/tests/gold_tests/headers/via.test.py
+++ b/tests/gold_tests/headers/via.test.py
@@ -46,13 +46,18 @@
ts.addSSLfile("../remap/ssl/server.key")
ts.Variables.ssl_port = 4443
-ts.Disk.records_config.update({
- 'proxy.config.http.insert_request_via_str': 4,
- 'proxy.config.http.insert_response_via_str': 4,
- 'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.http.server_ports': 'ipv4:{0} ipv4:{1}:proto=http2;http:ssl ipv6:{0} ipv6:{1}:proto=http2;http:ssl'.format(ts.Variables.port, ts.Variables.ssl_port),
-})
+ts.Disk.records_config.update(
+ {
+ 'proxy.config.http.insert_request_via_str': 4,
+ 'proxy.config.http.insert_response_via_str': 4,
+ 'proxy.config.ssl.server.cert.path': '{0}'.format(
+ ts.Variables.SSLDir),
+ 'proxy.config.ssl.server.private_key.path': '{0}'.format(
+ ts.Variables.SSLDir),
+ 'proxy.config.http.server_ports': 'ipv4:{0} ipv4:{1}:proto=http2;http:ssl ipv6:{0} ipv6:{1}:proto=http2;http:ssl'.format(
+ ts.Variables.port,
+ ts.Variables.ssl_port),
+ })
ts.Disk.remap_config.AddLine(
'map http://www.example.com http://127.0.0.1:{0}'.format(server.Variables.Port)
diff --git a/tests/gold_tests/ip_allow/ip_allow.test.py b/tests/gold_tests/ip_allow/ip_allow.test.py
index 59c3daf4c7b..32c0261c3b4 100644
--- a/tests/gold_tests/ip_allow/ip_allow.test.py
+++ b/tests/gold_tests/ip_allow/ip_allow.test.py
@@ -29,13 +29,13 @@
testName = ""
request = {
- "headers":
+ "headers":
"GET /get HTTP/1.1\r\n"
"Host: www.example.com:80\r\n\r\n",
"timestamp": "1469733493.993",
"body": ""}
response = {
- "headers":
+ "headers":
"HTTP/1.1 200 OK\r\n"
"Content-Length: 3\r\n"
"Connection: close\r\n\r\n",
@@ -47,13 +47,13 @@
# bug in ip_allow and they are sent through, have them return a 200 OK. This
# will fail the match with the gold file which expects a 403.
request = {
- "headers":
+ "headers":
"CONNECT www.example.com:80/connect HTTP/1.1\r\n"
"Host: www.example.com:80\r\n\r\n",
"timestamp": "1469733493.993",
"body": ""}
response = {
- "headers":
+ "headers":
"HTTP/1.1 200 OK\r\n"
"Content-Length: 3\r\n"
"Connection: close\r\n\r\n",
@@ -61,13 +61,13 @@
"1469733493.993", "body": "xxx"}
server.addResponse("sessionlog.json", request, response)
request = {
- "headers":
+ "headers":
"PUSH www.example.com:80/h2_push HTTP/2\r\n"
"Host: www.example.com:80\r\n\r\n",
"timestamp": "1469733493.993",
"body": ""}
response = {
- "headers":
+ "headers":
"HTTP/2 200 OK\r\n"
"Content-Length: 3\r\n"
"Connection: close\r\n\r\n",
@@ -90,7 +90,7 @@
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.http.cache.http': 0,
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
'proxy.config.http2.active_timeout_in': 3,
'proxy.config.http2.max_concurrent_streams_in': 65535,
@@ -120,7 +120,7 @@
# Note that CONNECT is not in the allowed list.
ts.Disk.ip_allow_yaml.AddLines(
- '''ip_allow:
+ '''ip_allow:
- apply: in
ip_addrs: 0/0
action: allow
@@ -134,11 +134,11 @@
)
ts.Streams.stderr += Testers.ContainsExpression(
- "Line 1 denial for 'CONNECT' from 127.0.0.1",
- "The CONNECT request should be denied by ip_allow")
+ "Line 1 denial for 'CONNECT' from 127.0.0.1",
+ "The CONNECT request should be denied by ip_allow")
ts.Streams.stderr += Testers.ContainsExpression(
- "Line 1 denial for 'PUSH' from 127.0.0.1",
- "The PUSH request should be denied by ip_allow")
+ "Line 1 denial for 'PUSH' from 127.0.0.1",
+ "The PUSH request should be denied by ip_allow")
#
# TEST 1: Perform a GET request. Should be allowed because GET is in the allowlist.
diff --git a/tests/gold_tests/logging/all_headers.test.py b/tests/gold_tests/logging/all_headers.test.py
index 7e0f47e2696..e5b850e88da 100644
--- a/tests/gold_tests/logging/all_headers.test.py
+++ b/tests/gold_tests/logging/all_headers.test.py
@@ -32,7 +32,7 @@
request_header = {"headers": "GET / HTTP/1.1\r\nHost: does.not.matter\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\nCache-control: max-age=85000\r\n\r\n",
- "timestamp": "1469733493.993", "body": "xxx"}
+ "timestamp": "1469733493.993", "body": "xxx"}
server.addResponse("sessionlog.json", request_header, response_header)
ts.Disk.records_config.update({
@@ -77,11 +77,12 @@ def reallyLong():
retval += ' -H "x-header{}: {}"'.format(i, value)
return retval
+
tr = Test.AddTestRun()
tr.Processes.Default.StartBefore(server)
tr.Processes.Default.StartBefore(Test.Processes.ts)
tr.Processes.Default.Command = (
-'curl "http://127.0.0.1:{0}" --user-agent "007" --verbose '.format(ts.Variables.port) + reallyLong()
+ 'curl "http://127.0.0.1:{0}" --user-agent "007" --verbose '.format(ts.Variables.port) + reallyLong()
)
tr.Processes.Default.ReturnCode = 0
@@ -89,7 +90,7 @@ def reallyLong():
#
tr = Test.AddTestRun()
tr.Processes.Default.Command = (
-'curl "http://127.0.0.1:{0}" --user-agent "007" --verbose '.format(ts.Variables.port) + reallyLong()
+ 'curl "http://127.0.0.1:{0}" --user-agent "007" --verbose '.format(ts.Variables.port) + reallyLong()
)
tr.Processes.Default.ReturnCode = 0
diff --git a/tests/gold_tests/logging/all_headers_sanitizer.py b/tests/gold_tests/logging/all_headers_sanitizer.py
index 64c22fd451f..c7580394bd0 100644
--- a/tests/gold_tests/logging/all_headers_sanitizer.py
+++ b/tests/gold_tests/logging/all_headers_sanitizer.py
@@ -31,7 +31,7 @@
rexl.append((re.compile(r"\{\{Via\}\:\{[^}]*\}\}"), "({__VIA__}}"))
rexl.append((re.compile(r"\{\{Server\}\:\{ApacheTrafficServer/[0-9.]*\}\}"), "({__ATS2_SERVER__}}"))
rexl.append((re.compile(r"\{\{Age\}\:\{[0-9]*\}\}"), "({__AGE__}}"))
-rexl.append((re.compile(r"\:" + sys.argv[2]), "__TS_PORT__")) # 1st and only argument is TS client port
+rexl.append((re.compile(r"\:" + sys.argv[2]), "__TS_PORT__")) # 1st and only argument is TS client port
# Handle inconsistencies which I think are caused by different revisions of the standard Python http.server.HTTPServer class.
@@ -45,13 +45,13 @@
limit_count = 0
limit_max = 120
while not processed and limit_count < limit_max:
- limit_count += 1
- if not path.exists(filename):
- time.sleep(1);
- else:
- with open(filename, "r") as f:
- processed = True
- for line in f:
- for rex, subStr in rexl:
- line = rex.sub(subStr, line)
- print(line)
+ limit_count += 1
+ if not path.exists(filename):
+ time.sleep(1)
+ else:
+ with open(filename, "r") as f:
+ processed = True
+ for line in f:
+ for rex, subStr in rexl:
+ line = rex.sub(subStr, line)
+ print(line)
diff --git a/tests/gold_tests/logging/log-field.test.py b/tests/gold_tests/logging/log-field.test.py
index 784d2201af8..f88afc42429 100644
--- a/tests/gold_tests/logging/log-field.test.py
+++ b/tests/gold_tests/logging/log-field.test.py
@@ -26,17 +26,25 @@
server = Test.MakeOriginServer("server")
request_header = {'timestamp': 100, "headers": "GET /test-1 HTTP/1.1\r\nHost: test-1\r\n\r\n", "body": ""}
-response_header = {'timestamp': 100,
- "headers": "HTTP/1.1 200 OK\r\nTest: 1\r\nContent-Type: application/json\r\nConnection: close\r\nContent-Type: application/json\r\n\r\n", "body": "Test 1"}
+response_header = {
+ 'timestamp': 100,
+ "headers": "HTTP/1.1 200 OK\r\nTest: 1\r\nContent-Type: application/json\r\nConnection: close\r\nContent-Type: application/json\r\n\r\n",
+ "body": "Test 1"}
server.addResponse("sessionlog.json", request_header, response_header)
server.addResponse("sessionlog.json",
- {'timestamp': 101, "headers": "GET /test-2 HTTP/1.1\r\nHost: test-2\r\n\r\n", "body": ""},
- {'timestamp': 101, "headers": "HTTP/1.1 200 OK\r\nTest: 2\r\nContent-Type: application/jason\r\nConnection: close\r\nContent-Type: application/json\r\n\r\n", "body": "Test 2"}
- )
+ {'timestamp': 101,
+ "headers": "GET /test-2 HTTP/1.1\r\nHost: test-2\r\n\r\n",
+ "body": ""},
+ {'timestamp': 101,
+ "headers": "HTTP/1.1 200 OK\r\nTest: 2\r\nContent-Type: application/jason\r\nConnection: close\r\nContent-Type: application/json\r\n\r\n",
+ "body": "Test 2"})
server.addResponse("sessionlog.json",
- {'timestamp': 102, "headers": "GET /test-3 HTTP/1.1\r\nHost: test-3\r\n\r\n", "body": ""},
- {'timestamp': 102, "headers": "HTTP/1.1 200 OK\r\nTest: 3\r\nConnection: close\r\nContent-Type: application/json\r\n\r\n", "body": "Test 3"}
- )
+ {'timestamp': 102,
+ "headers": "GET /test-3 HTTP/1.1\r\nHost: test-3\r\n\r\n",
+ "body": ""},
+ {'timestamp': 102,
+ "headers": "HTTP/1.1 200 OK\r\nTest: 3\r\nConnection: close\r\nContent-Type: application/json\r\n\r\n",
+ "body": "Test 3"})
ts.Disk.records_config.update({
'proxy.config.net.connections_throttle': 100,
diff --git a/tests/gold_tests/logging/log-filter.test.py b/tests/gold_tests/logging/log-filter.test.py
index 771afec8a3e..ea4b1621b3e 100644
--- a/tests/gold_tests/logging/log-filter.test.py
+++ b/tests/gold_tests/logging/log-filter.test.py
@@ -26,25 +26,39 @@
server = Test.MakeOriginServer("server")
request_header = {'timestamp': 100, "headers": "GET /test-1 HTTP/1.1\r\nHost: test-1\r\n\r\n", "body": ""}
-response_header = {'timestamp': 100,
- "headers": "HTTP/1.1 200 OK\r\nTest: 1\r\nContent-Type: application/json\r\nConnection: close\r\nContent-Type: application/json\r\n\r\n", "body": "Test 1"}
+response_header = {
+ 'timestamp': 100,
+ "headers": "HTTP/1.1 200 OK\r\nTest: 1\r\nContent-Type: application/json\r\nConnection: close\r\nContent-Type: application/json\r\n\r\n",
+ "body": "Test 1"}
server.addResponse("sessionlog.json", request_header, response_header)
server.addResponse("sessionlog.json",
- {'timestamp': 101, "headers": "GET /test-2 HTTP/1.1\r\nHost: test-2\r\n\r\n", "body": ""},
- {'timestamp': 101, "headers": "HTTP/1.1 200 OK\r\nTest: 2\r\nContent-Type: application/jason\r\nConnection: close\r\nContent-Type: application/json\r\n\r\n", "body": "Test 2"}
- )
+ {'timestamp': 101,
+ "headers": "GET /test-2 HTTP/1.1\r\nHost: test-2\r\n\r\n",
+ "body": ""},
+ {'timestamp': 101,
+ "headers": "HTTP/1.1 200 OK\r\nTest: 2\r\nContent-Type: application/jason\r\nConnection: close\r\nContent-Type: application/json\r\n\r\n",
+ "body": "Test 2"})
server.addResponse("sessionlog.json",
- {'timestamp': 102, "headers": "GET /test-3 HTTP/1.1\r\nHost: test-3\r\n\r\n", "body": ""},
- {'timestamp': 102, "headers": "HTTP/1.1 200 OK\r\nTest: 3\r\nConnection: close\r\nContent-Type: application/json\r\n\r\n", "body": "Test 3"}
- )
+ {'timestamp': 102,
+ "headers": "GET /test-3 HTTP/1.1\r\nHost: test-3\r\n\r\n",
+ "body": ""},
+ {'timestamp': 102,
+ "headers": "HTTP/1.1 200 OK\r\nTest: 3\r\nConnection: close\r\nContent-Type: application/json\r\n\r\n",
+ "body": "Test 3"})
server.addResponse("sessionlog.json",
- {'timestamp': 103, "headers": "GET /test-4 HTTP/1.1\r\nHost: test-4\r\n\r\n", "body": ""},
- {'timestamp': 103, "headers": "HTTP/1.1 200 OK\r\nTest: 4\r\nConnection: close\r\nContent-Type: application/json\r\n\r\n", "body": "Test 4"}
- )
+ {'timestamp': 103,
+ "headers": "GET /test-4 HTTP/1.1\r\nHost: test-4\r\n\r\n",
+ "body": ""},
+ {'timestamp': 103,
+ "headers": "HTTP/1.1 200 OK\r\nTest: 4\r\nConnection: close\r\nContent-Type: application/json\r\n\r\n",
+ "body": "Test 4"})
server.addResponse("sessionlog.json",
- {'timestamp': 104, "headers": "GET /test-5 HTTP/1.1\r\nHost: test-5\r\n\r\n", "body": ""},
- {'timestamp': 104, "headers": "HTTP/1.1 200 OK\r\nTest: 5\r\nConnection: close\r\nContent-Type: application/json\r\n\r\n", "body": "Test 5"}
- )
+ {'timestamp': 104,
+ "headers": "GET /test-5 HTTP/1.1\r\nHost: test-5\r\n\r\n",
+ "body": ""},
+ {'timestamp': 104,
+ "headers": "HTTP/1.1 200 OK\r\nTest: 5\r\nConnection: close\r\nContent-Type: application/json\r\n\r\n",
+ "body": "Test 5"})
ts.Disk.records_config.update({
'proxy.config.net.connections_throttle': 100,
diff --git a/tests/gold_tests/logging/log_pipe.test.py b/tests/gold_tests/logging/log_pipe.test.py
index cdadbd0805b..7a7d1570c83 100644
--- a/tests/gold_tests/logging/log_pipe.test.py
+++ b/tests/gold_tests/logging/log_pipe.test.py
@@ -39,7 +39,7 @@ def get_ts(logging_config):
ts.Disk.records_config.update({
'proxy.config.diags.debug.enabled': 1,
'proxy.config.diags.debug.tags': 'log-file',
- })
+ })
# Since we're only verifying logs and not traffic, we don't need an origin
# server. The following will simply deny the requests and emit a log
@@ -59,7 +59,7 @@ def get_ts(logging_config):
tr = Test.AddTestRun()
pipe_name = "default_pipe_size.pipe"
ts = get_ts(
- '''
+ '''
logging:
formats:
- name: custom
@@ -115,7 +115,7 @@ def get_ts(logging_config):
# increase the size.
pipe_size = 75000
ts = get_ts(
- '''
+ '''
logging:
formats:
- name: custom
@@ -156,8 +156,8 @@ def get_ts(logging_config):
buffer_verifier = "pipe_buffer_is_larger_than.py"
tr.Setup.Copy(buffer_verifier)
verify_buffer_size = tr.Processes.Process(
- "verify_buffer_size",
- "python3 {} {} {}".format(buffer_verifier, pipe_path, pipe_size))
+ "verify_buffer_size",
+ "python3 {} {} {}".format(buffer_verifier, pipe_path, pipe_size))
verify_buffer_size.Return = 0
verify_buffer_size.Streams.All += Testers.ContainsExpression(
"Success",
diff --git a/tests/gold_tests/logging/log_retention.test.py b/tests/gold_tests/logging/log_retention.test.py
index a0391c51af4..46fe38631fb 100644
--- a/tests/gold_tests/logging/log_retention.test.py
+++ b/tests/gold_tests/logging/log_retention.test.py
@@ -127,21 +127,21 @@ def get_curl_command(self):
Generate the appropriate single curl command.
"""
return 'curl "http://127.0.0.1:{0}" --verbose'.format(
- self.ts.Variables.port)
+ self.ts.Variables.port)
def get_command_to_rotate_once(self):
"""
Generate the set of curl commands to trigger a log rotate.
"""
return 'for i in {{1..2500}}; do curl "http://127.0.0.1:{0}" --verbose; done'.format(
- self.ts.Variables.port)
+ self.ts.Variables.port)
def get_command_to_rotate_thrice(self):
"""
Generate the set of curl commands to trigger a log rotate.
"""
return 'for i in {{1..7500}}; do curl "http://127.0.0.1:{0}" --verbose; done'.format(
- self.ts.Variables.port)
+ self.ts.Variables.port)
#
@@ -167,29 +167,29 @@ def get_command_to_rotate_thrice(self):
logs:
- filename: test_deletion
format: long
-'''.format(prefix="0123456789"*500).split("\n")
+'''.format(prefix="0123456789" * 500).split("\n")
)
# Verify that each log type was registered for auto-deletion.
test.ts.Streams.stderr = Testers.ContainsExpression(
- "Registering rotated log deletion for test_deletion.log with min roll count 0",
- "Verify test_deletion.log auto-delete configuration")
+ "Registering rotated log deletion for test_deletion.log with min roll count 0",
+ "Verify test_deletion.log auto-delete configuration")
test.ts.Streams.stderr += Testers.ContainsExpression(
- "Registering rotated log deletion for error.log with min roll count 0",
- "Verify error.log auto-delete configuration")
+ "Registering rotated log deletion for error.log with min roll count 0",
+ "Verify error.log auto-delete configuration")
test.ts.Streams.stderr += Testers.ContainsExpression(
- "Registering rotated log deletion for traffic.out with min roll count 0",
- "Verify traffic.out auto-delete configuration")
+ "Registering rotated log deletion for traffic.out with min roll count 0",
+ "Verify traffic.out auto-delete configuration")
test.ts.Streams.stderr += Testers.ContainsExpression(
- "Registering rotated log deletion for diags.log with min roll count 0",
- "Verify diags.log auto-delete configuration")
+ "Registering rotated log deletion for diags.log with min roll count 0",
+ "Verify diags.log auto-delete configuration")
test.ts.Streams.stderr += Testers.ContainsExpression(
- "Registering rotated log deletion for manager.log with min roll count 0",
- "Verify manager.log auto-delete configuration")
+ "Registering rotated log deletion for manager.log with min roll count 0",
+ "Verify manager.log auto-delete configuration")
# Verify test_deletion was rotated and deleted.
test.ts.Streams.stderr += Testers.ContainsExpression(
- "The rolled logfile.*test_deletion.log_.*was auto-deleted.*bytes were reclaimed",
- "Verify that space was reclaimed")
+ "The rolled logfile.*test_deletion.log_.*was auto-deleted.*bytes were reclaimed",
+ "Verify that space was reclaimed")
test.tr.Processes.Default.Command = test.get_command_to_rotate_once()
test.tr.Processes.Default.ReturnCode = 0
@@ -215,30 +215,30 @@ def get_command_to_rotate_thrice(self):
- filename: test_deletion
rolling_min_count: 1
format: long
-'''.format(prefix="0123456789"*500).split("\n")
+'''.format(prefix="0123456789" * 500).split("\n")
)
# Verify that each log type was registered for auto-deletion.
test.ts.Streams.stderr = Testers.ContainsExpression(
- "Registering rotated log deletion for test_deletion.log with min roll count 1",
- "Verify test_deletion.log auto-delete configuration")
+ "Registering rotated log deletion for test_deletion.log with min roll count 1",
+ "Verify test_deletion.log auto-delete configuration")
# Only the test_deletion should have its min_count overridden.
test.ts.Streams.stderr += Testers.ContainsExpression(
- "Registering rotated log deletion for error.log with min roll count 0",
- "Verify error.log auto-delete configuration")
+ "Registering rotated log deletion for error.log with min roll count 0",
+ "Verify error.log auto-delete configuration")
test.ts.Streams.stderr += Testers.ContainsExpression(
- "Registering rotated log deletion for traffic.out with min roll count 0",
- "Verify traffic.out auto-delete configuration")
+ "Registering rotated log deletion for traffic.out with min roll count 0",
+ "Verify traffic.out auto-delete configuration")
test.ts.Streams.stderr += Testers.ContainsExpression(
- "Registering rotated log deletion for diags.log with min roll count 0",
- "Verify diags.log auto-delete configuration")
+ "Registering rotated log deletion for diags.log with min roll count 0",
+ "Verify diags.log auto-delete configuration")
test.ts.Streams.stderr += Testers.ContainsExpression(
- "Registering rotated log deletion for manager.log with min roll count 0",
- "Verify manager.log auto-delete configuration")
+ "Registering rotated log deletion for manager.log with min roll count 0",
+ "Verify manager.log auto-delete configuration")
# Verify test_deletion was rotated and deleted.
test.ts.Streams.stderr += Testers.ContainsExpression(
- "The rolled logfile.*test_deletion.log_.*was auto-deleted.*bytes were reclaimed",
- "Verify that space was reclaimed")
+ "The rolled logfile.*test_deletion.log_.*was auto-deleted.*bytes were reclaimed",
+ "Verify that space was reclaimed")
test.tr.Processes.Default.Command = test.get_command_to_rotate_once()
test.tr.Processes.Default.ReturnCode = 0
@@ -255,24 +255,24 @@ def get_command_to_rotate_thrice(self):
# Verify that the plugin's logs and other core logs were registered for deletion.
test.ts.Streams.stderr = Testers.ContainsExpression(
- "Registering rotated log deletion for test_log_interface.log with min roll count 0",
- "Verify test_log_interface.log auto-delete configuration")
+ "Registering rotated log deletion for test_log_interface.log with min roll count 0",
+ "Verify test_log_interface.log auto-delete configuration")
test.ts.Streams.stderr += Testers.ContainsExpression(
- "Registering rotated log deletion for error.log with min roll count 0",
- "Verify error.log auto-delete configuration")
+ "Registering rotated log deletion for error.log with min roll count 0",
+ "Verify error.log auto-delete configuration")
test.ts.Streams.stderr += Testers.ContainsExpression(
- "Registering rotated log deletion for traffic.out with min roll count 0",
- "Verify traffic.out auto-delete configuration")
+ "Registering rotated log deletion for traffic.out with min roll count 0",
+ "Verify traffic.out auto-delete configuration")
test.ts.Streams.stderr += Testers.ContainsExpression(
- "Registering rotated log deletion for diags.log with min roll count 0",
- "Verify diags.log auto-delete configuration")
+ "Registering rotated log deletion for diags.log with min roll count 0",
+ "Verify diags.log auto-delete configuration")
test.ts.Streams.stderr += Testers.ContainsExpression(
- "Registering rotated log deletion for manager.log with min roll count 0",
- "Verify manager.log auto-delete configuration")
+ "Registering rotated log deletion for manager.log with min roll count 0",
+ "Verify manager.log auto-delete configuration")
# Verify test_deletion was rotated and deleted.
test.ts.Streams.stderr += Testers.ContainsExpression(
- "The rolled logfile.*test_log_interface.log_.*was auto-deleted.*bytes were reclaimed",
- "Verify that space was reclaimed")
+ "The rolled logfile.*test_log_interface.log_.*was auto-deleted.*bytes were reclaimed",
+ "Verify that space was reclaimed")
test.tr.Processes.Default.Command = test.get_command_to_rotate_once()
test.tr.Processes.Default.ReturnCode = 0
@@ -306,36 +306,36 @@ def get_command_to_rotate_thrice(self):
- filename: test_high_priority_deletion
rolling_min_count: 1
format: long
-'''.format(prefix="0123456789"*500).split("\n")
+'''.format(prefix="0123456789" * 500).split("\n")
)
# Verify that each log type was registered for auto-deletion.
test.ts.Streams.stderr = Testers.ContainsExpression(
- "Registering rotated log deletion for test_low_priority_deletion.log with min roll count 5",
- "Verify test_low_priority_deletion.log auto-delete configuration")
+ "Registering rotated log deletion for test_low_priority_deletion.log with min roll count 5",
+ "Verify test_low_priority_deletion.log auto-delete configuration")
test.ts.Streams.stderr += Testers.ContainsExpression(
- "Registering rotated log deletion for test_high_priority_deletion.log with min roll count 1",
- "Verify test_high_priority_deletion.log auto-delete configuration")
+ "Registering rotated log deletion for test_high_priority_deletion.log with min roll count 1",
+ "Verify test_high_priority_deletion.log auto-delete configuration")
# Only the test_deletion should have its min_count overridden.
test.ts.Streams.stderr += Testers.ContainsExpression(
- "Registering rotated log deletion for error.log with min roll count 0",
- "Verify error.log auto-delete configuration")
+ "Registering rotated log deletion for error.log with min roll count 0",
+ "Verify error.log auto-delete configuration")
test.ts.Streams.stderr += Testers.ContainsExpression(
- "Registering rotated log deletion for traffic.out with min roll count 0",
- "Verify traffic.out auto-delete configuration")
+ "Registering rotated log deletion for traffic.out with min roll count 0",
+ "Verify traffic.out auto-delete configuration")
test.ts.Streams.stderr += Testers.ContainsExpression(
- "Registering rotated log deletion for diags.log with min roll count 0",
- "Verify diags.log auto-delete configuration")
+ "Registering rotated log deletion for diags.log with min roll count 0",
+ "Verify diags.log auto-delete configuration")
test.ts.Streams.stderr += Testers.ContainsExpression(
- "Registering rotated log deletion for manager.log with min roll count 0",
- "Verify manager.log auto-delete configuration")
+ "Registering rotated log deletion for manager.log with min roll count 0",
+ "Verify manager.log auto-delete configuration")
# Verify test_deletion was rotated and deleted.
test.ts.Streams.stderr += Testers.ExcludesExpression(
- "The rolled logfile.*test_low_priority_deletion.log_.*was auto-deleted.*bytes were reclaimed",
- "Verify that space was reclaimed from test_high_priority_deletion")
+ "The rolled logfile.*test_low_priority_deletion.log_.*was auto-deleted.*bytes were reclaimed",
+ "Verify that space was reclaimed from test_high_priority_deletion")
test.ts.Streams.stderr += Testers.ContainsExpression(
- "The rolled logfile.*test_high_priority_deletion.log_.*was auto-deleted.*bytes were reclaimed",
- "Verify that space was reclaimed from test_high_priority_deletion")
+ "The rolled logfile.*test_high_priority_deletion.log_.*was auto-deleted.*bytes were reclaimed",
+ "Verify that space was reclaimed from test_high_priority_deletion")
test.tr.Processes.Default.Command = test.get_command_to_rotate_once()
test.tr.Processes.Default.ReturnCode = 0
@@ -356,22 +356,22 @@ def get_command_to_rotate_thrice(self):
# Only the test_deletion should have its min_count overridden.
test.ts.Streams.stderr = Testers.ContainsExpression(
- "Registering rotated log deletion for error.log with min roll count 3",
- "Verify error.log auto-delete configuration")
+ "Registering rotated log deletion for error.log with min roll count 3",
+ "Verify error.log auto-delete configuration")
test.ts.Streams.stderr += Testers.ContainsExpression(
- "Registering rotated log deletion for traffic.out with min roll count 4",
- "Verify traffic.out auto-delete configuration")
+ "Registering rotated log deletion for traffic.out with min roll count 4",
+ "Verify traffic.out auto-delete configuration")
test.ts.Streams.stderr += Testers.ContainsExpression(
- "Registering rotated log deletion for diags.log with min roll count 5",
- "Verify diags.log auto-delete configuration")
+ "Registering rotated log deletion for diags.log with min roll count 5",
+ "Verify diags.log auto-delete configuration")
test.ts.Streams.stderr += Testers.ContainsExpression(
- "Registering rotated log deletion for manager.log with min roll count 5",
- "Verify manager.log auto-delete configuration")
+ "Registering rotated log deletion for manager.log with min roll count 5",
+ "Verify manager.log auto-delete configuration")
# In case a future log is added, make sure the developer doesn't forget to
# set the min count per configuration.
test.ts.Streams.stderr += Testers.ExcludesExpression(
- "Registering .* with min roll count 0",
- "Verify nothing has a default min roll count of 0 per configuration")
+ "Registering .* with min roll count 0",
+ "Verify nothing has a default min roll count of 0 per configuration")
# This test doesn't require a log rotation. We just verify that the logs communicate
# the appropriate min_count values above.
@@ -402,30 +402,30 @@ def get_command_to_rotate_thrice(self):
- filename: test_deletion
rolling_min_count: 1
format: long
-'''.format(prefix="0123456789"*500).split("\n")
+'''.format(prefix="0123456789" * 500).split("\n")
)
# Verify that each log type was registered for auto-deletion.
test.ts.Streams.stderr = Testers.ExcludesExpression(
- "Registering rotated log deletion for test_deletion.log with min roll count 1",
- "Verify test_deletion.log auto-delete configuration")
+ "Registering rotated log deletion for test_deletion.log with min roll count 1",
+ "Verify test_deletion.log auto-delete configuration")
# Only the test_deletion should have its min_count overridden.
test.ts.Streams.stderr += Testers.ExcludesExpression(
- "Registering rotated log deletion for error.log with min roll count 0",
- "Verify error.log auto-delete configuration")
+ "Registering rotated log deletion for error.log with min roll count 0",
+ "Verify error.log auto-delete configuration")
test.ts.Streams.stderr += Testers.ExcludesExpression(
- "Registering rotated log deletion for traffic.out with min roll count 0",
- "Verify traffic.out auto-delete configuration")
+ "Registering rotated log deletion for traffic.out with min roll count 0",
+ "Verify traffic.out auto-delete configuration")
test.ts.Streams.stderr += Testers.ExcludesExpression(
- "Registering rotated log deletion for diags.log with min roll count 0",
- "Verify diags.log auto-delete configuration")
+ "Registering rotated log deletion for diags.log with min roll count 0",
+ "Verify diags.log auto-delete configuration")
test.ts.Streams.stderr += Testers.ExcludesExpression(
- "Registering rotated log deletion for manager.log with min roll count 0",
- "Verify manager.log auto-delete configuration")
+ "Registering rotated log deletion for manager.log with min roll count 0",
+ "Verify manager.log auto-delete configuration")
# Verify test_deletion was not deleted.
test.ts.Streams.stderr += Testers.ExcludesExpression(
- "The rolled logfile.*test_deletion.log_.*was auto-deleted.*bytes were reclaimed",
- "Verify that space was reclaimed")
+ "The rolled logfile.*test_deletion.log_.*was auto-deleted.*bytes were reclaimed",
+ "Verify that space was reclaimed")
test.tr.Processes.Default.Command = test.get_command_to_rotate_once()
test.tr.Processes.Default.ReturnCode = 0
@@ -459,16 +459,15 @@ def get_command_to_rotate_thrice(self):
logs:
- filename: test_deletion
format: long
-'''.format(prefix="0123456789"*500).split("\n")
+'''.format(prefix="0123456789" * 500).split("\n")
)
# Verify that trim happened for the rolled file.
test.ts.Streams.stderr = Testers.ContainsExpression(
- "rolled logfile.*test_deletion.log.*old.* was auto-deleted",
- "Verify test_deletion.log was trimmed")
+ "rolled logfile.*test_deletion.log.*old.* was auto-deleted",
+ "Verify test_deletion.log was trimmed")
test.tr.Processes.Default.Command = test.get_command_to_rotate_thrice()
test.tr.Processes.Default.ReturnCode = 0
test.tr.StillRunningAfter = test.ts
test.tr.StillRunningAfter = test.server
-
diff --git a/tests/gold_tests/logging/new_log_flds_observer.py b/tests/gold_tests/logging/new_log_flds_observer.py
index 0fba8c19942..b6e4e70e9ee 100644
--- a/tests/gold_tests/logging/new_log_flds_observer.py
+++ b/tests/gold_tests/logging/new_log_flds_observer.py
@@ -54,7 +54,7 @@
ccid[3] != ccid[4] and
ccid[4] == ccid[5] and
ctid[4] != ctid[5] and
- ccid[5] != ccid[6]):
+ ccid[5] != ccid[6]):
exit(code=0)
# Failure exit if report was not valid.
diff --git a/tests/gold_tests/logging/pipe_buffer_is_larger_than.py b/tests/gold_tests/logging/pipe_buffer_is_larger_than.py
index d598505cacf..e332dcbe5ef 100644
--- a/tests/gold_tests/logging/pipe_buffer_is_larger_than.py
+++ b/tests/gold_tests/logging/pipe_buffer_is_larger_than.py
@@ -27,15 +27,15 @@
def parse_args():
parser = parser = argparse.ArgumentParser(
- description='Verify that a FIFO has a buffer of at least a certain size')
+ description='Verify that a FIFO has a buffer of at least a certain size')
parser.add_argument(
- 'pipe_name',
- help='The pipe name upon which to verify the size is large enough.')
+ 'pipe_name',
+ help='The pipe name upon which to verify the size is large enough.')
parser.add_argument(
- 'minimum_buffer_size',
- help='The minimu buffer size for the pipe to expect.')
+ 'minimum_buffer_size',
+ help='The minimu buffer size for the pipe to expect.')
return parser.parse_args()
diff --git a/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests.test.py b/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests.test.py
index f1e34a65eab..ba5592849b3 100644
--- a/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests.test.py
+++ b/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests.test.py
@@ -22,7 +22,7 @@
Basic cache_range_requests plugin test
'''
-## Test description:
+# Test description:
# Preload the cache with the entire asset to be range requested.
# Reload remap rule with cache_range_requests plugin
# Request content through the cache_range_requests plugin
@@ -42,45 +42,45 @@
# default root
req_chk = {"headers":
- "GET / HTTP/1.1\r\n" +
- "Host: www.example.com\r\n" +
- "uuid: none\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": ""
-}
+ "GET / HTTP/1.1\r\n" +
+ "Host: www.example.com\r\n" +
+ "uuid: none\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""
+ }
res_chk = {"headers":
- "HTTP/1.1 200 OK\r\n" +
- "Connection: close\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": ""
-}
+ "HTTP/1.1 200 OK\r\n" +
+ "Connection: close\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""
+ }
server.addResponse("sessionlog.json", req_chk, res_chk)
body = "lets go surfin now"
req_full = {"headers":
- "GET /path HTTP/1.1\r\n" +
- "Host: www.example.com\r\n" +
- "Accept: */*\r\n" +
- "uuid: full\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": ""
-}
+ "GET /path HTTP/1.1\r\n" +
+ "Host: www.example.com\r\n" +
+ "Accept: */*\r\n" +
+ "uuid: full\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""
+ }
res_full = {"headers":
- "HTTP/1.1 200 OK\r\n" +
- "Cache-Control: max-age=500\r\n" +
- "Connection: close\r\n" +
- 'Etag: "path"\r\n' +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": body
-}
+ "HTTP/1.1 200 OK\r\n" +
+ "Cache-Control: max-age=500\r\n" +
+ "Connection: close\r\n" +
+ 'Etag: "path"\r\n' +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": body
+ }
server.addResponse("sessionlog.json", req_full, res_full)
@@ -90,135 +90,135 @@
inner_str = "7-15"
req_inner = {"headers":
- "GET /path HTTP/1.1\r\n" +
- "Host: www.example.com\r\n" +
- "Accept: */*\r\n" +
- "Range: bytes={}\r\n".format(inner_str) +
- "uuid: inner\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": ""
-}
+ "GET /path HTTP/1.1\r\n" +
+ "Host: www.example.com\r\n" +
+ "Accept: */*\r\n" +
+ "Range: bytes={}\r\n".format(inner_str) +
+ "uuid: inner\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""
+ }
res_inner = {"headers":
- "HTTP/1.1 206 Partial Content\r\n" +
- "Accept-Ranges: bytes\r\n" +
- "Cache-Control: max-age=500\r\n" +
- "Content-Range: bytes {0}/{1}\r\n".format(inner_str, bodylen) +
- "Connection: close\r\n" +
- 'Etag: "path"\r\n' +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": body[7:15]
-}
+ "HTTP/1.1 206 Partial Content\r\n" +
+ "Accept-Ranges: bytes\r\n" +
+ "Cache-Control: max-age=500\r\n" +
+ "Content-Range: bytes {0}/{1}\r\n".format(inner_str, bodylen) +
+ "Connection: close\r\n" +
+ 'Etag: "path"\r\n' +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": body[7:15]
+ }
server.addResponse("sessionlog.json", req_inner, res_inner)
frange_str = "0-"
req_frange = {"headers":
- "GET /path HTTP/1.1\r\n" +
- "Host: www.example.com\r\n" +
- "Accept: */*\r\n" +
- "Range: bytes={}\r\n".format(frange_str) +
- "uuid: frange\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": ""
-}
+ "GET /path HTTP/1.1\r\n" +
+ "Host: www.example.com\r\n" +
+ "Accept: */*\r\n" +
+ "Range: bytes={}\r\n".format(frange_str) +
+ "uuid: frange\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""
+ }
res_frange = {"headers":
- "HTTP/1.1 206 Partial Content\r\n" +
- "Accept-Ranges: bytes\r\n" +
- "Cache-Control: max-age=500\r\n" +
- "Content-Range: bytes 0-{0}/{0}\r\n".format(bodylen) +
- "Connection: close\r\n" +
- 'Etag: "path"\r\n' +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": body
-}
+ "HTTP/1.1 206 Partial Content\r\n" +
+ "Accept-Ranges: bytes\r\n" +
+ "Cache-Control: max-age=500\r\n" +
+ "Content-Range: bytes 0-{0}/{0}\r\n".format(bodylen) +
+ "Connection: close\r\n" +
+ 'Etag: "path"\r\n' +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": body
+ }
server.addResponse("sessionlog.json", req_frange, res_frange)
last_str = "-5"
req_last = {"headers":
- "GET /path HTTP/1.1\r\n" +
- "Host: www.example.com\r\n" +
- "Accept: */*\r\n" +
- "Range: bytes={}\r\n".format(last_str) +
- "uuid: last\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": ""
-}
+ "GET /path HTTP/1.1\r\n" +
+ "Host: www.example.com\r\n" +
+ "Accept: */*\r\n" +
+ "Range: bytes={}\r\n".format(last_str) +
+ "uuid: last\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""
+ }
res_last = {"headers":
- "HTTP/1.1 206 Partial Content\r\n" +
- "Accept-Ranges: bytes\r\n" +
- "Cache-Control: max-age=200\r\n" +
- "Content-Range: bytes {0}-{1}/{1}\r\n".format(bodylen - 5, bodylen) +
- "Connection: close\r\n" +
- 'Etag: "path"\r\n' +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": body[-5:]
-}
+ "HTTP/1.1 206 Partial Content\r\n" +
+ "Accept-Ranges: bytes\r\n" +
+ "Cache-Control: max-age=200\r\n" +
+ "Content-Range: bytes {0}-{1}/{1}\r\n".format(bodylen - 5, bodylen) +
+ "Connection: close\r\n" +
+ 'Etag: "path"\r\n' +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": body[-5:]
+ }
server.addResponse("sessionlog.json", req_last, res_last)
pselect_str = "1-10"
req_pselect = {"headers":
- "GET /path HTTP/1.1\r\n" +
- "Host: parentselect\r\n" +
- "Accept: */*\r\n" +
- "Range: bytes={}\r\n".format(pselect_str) +
- "uuid: pselect\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": ""
-}
+ "GET /path HTTP/1.1\r\n" +
+ "Host: parentselect\r\n" +
+ "Accept: */*\r\n" +
+ "Range: bytes={}\r\n".format(pselect_str) +
+ "uuid: pselect\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""
+ }
res_pselect = {"headers":
- "HTTP/1.1 206 Partial Content\r\n" +
- "Accept-Ranges: bytes\r\n" +
- "Cache-Control: max-age=200\r\n" +
- "Content-Range: bytes {}/19\r\n".format(pselect_str) +
- "Connection: close\r\n" +
- 'Etag: "path"\r\n' +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": body[1:10]
-}
+ "HTTP/1.1 206 Partial Content\r\n" +
+ "Accept-Ranges: bytes\r\n" +
+ "Cache-Control: max-age=200\r\n" +
+ "Content-Range: bytes {}/19\r\n".format(pselect_str) +
+ "Connection: close\r\n" +
+ 'Etag: "path"\r\n' +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": body[1:10]
+ }
server.addResponse("sessionlog.json", req_pselect, res_pselect)
req_psd = {"headers":
- "GET /path HTTP/1.1\r\n" +
- "Host: psd\r\n" +
- "Accept: */*\r\n" +
- "Range: bytes={}\r\n".format(pselect_str) +
- "uuid: pselect\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": ""
-}
+ "GET /path HTTP/1.1\r\n" +
+ "Host: psd\r\n" +
+ "Accept: */*\r\n" +
+ "Range: bytes={}\r\n".format(pselect_str) +
+ "uuid: pselect\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""
+ }
server.addResponse("sessionlog.json", req_psd, res_pselect)
# cache range requests plugin remap
ts.Disk.remap_config.AddLines([
- 'map http://www.example.com http://127.0.0.1:{}'.format(server.Variables.Port) +
+ 'map http://www.example.com http://127.0.0.1:{}'.format(server.Variables.Port) +
' @plugin=cache_range_requests.so',
- # parent select cache key option
- 'map http://parentselect http://127.0.0.1:{}'.format(server.Variables.Port) +
+ # parent select cache key option
+ 'map http://parentselect http://127.0.0.1:{}'.format(server.Variables.Port) +
' @plugin=cache_range_requests.so @pparam=--ps-cachekey',
- # deprecated
- 'map http://psd http://127.0.0.1:{}'.format(server.Variables.Port) +
+ # deprecated
+ 'map http://psd http://127.0.0.1:{}'.format(server.Variables.Port) +
' @plugin=cache_range_requests.so @pparam=ps_mode:cache_key_url',
])
@@ -227,10 +227,10 @@
# minimal configuration
ts.Disk.records_config.update({
- 'proxy.config.diags.debug.enabled': 1,
- 'proxy.config.diags.debug.tags': 'cache_range_requests',
- 'proxy.config.http.cache.http': 1,
- 'proxy.config.http.wait_for_cache': 1,
+ 'proxy.config.diags.debug.enabled': 1,
+ 'proxy.config.diags.debug.tags': 'cache_range_requests',
+ 'proxy.config.http.cache.http': 1,
+ 'proxy.config.http.wait_for_cache': 1,
})
curl_and_args = 'curl -s -D /dev/stdout -o /dev/stderr -x localhost:{} -H "x-debug: x-cache"'.format(ts.Variables.port)
@@ -329,7 +329,8 @@
tr.StillRunningAfter = ts
-curl_and_args = 'curl -s -D /dev/stdout -o /dev/stderr -x localhost:{} -H "x-debug: x-parentselection-key"'.format(ts.Variables.port)
+curl_and_args = 'curl -s -D /dev/stdout -o /dev/stderr -x localhost:{} -H "x-debug: x-parentselection-key"'.format(
+ ts.Variables.port)
# 9 Test - cache_key_url request
tr = Test.AddTestRun("cache_key_url request")
@@ -337,8 +338,8 @@
ps.Command = curl_and_args + ' http://parentselect/path -r {} -H "uuid: pselect"'.format(pselect_str)
ps.ReturnCode = 0
ps.Streams.stdout.Content = Testers.ContainsExpression(
- "X-ParentSelection-Key: .*-bytes=",
- "expected bytes in parent selection key",
+ "X-ParentSelection-Key: .*-bytes=",
+ "expected bytes in parent selection key",
)
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
@@ -348,7 +349,7 @@
ps = tr.Processes.Default
ps.Command = curl_and_args + ' http://www.example.com/path -r {} -H "uuid: inner"'.format(inner_str)
ps.ReturnCode = 0
-ps.Streams.stdout.Content = Testers.ExcludesExpression("X-ParentSelection-Key", "parent select key shouldn't show up")
+ps.Streams.stdout.Content = Testers.ExcludesExpression("X-ParentSelection-Key", "parent select key shouldn't show up")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
@@ -358,8 +359,8 @@
ps.Command = curl_and_args + ' http://psd/path -r {} -H "uuid: pselect"'.format(pselect_str)
ps.ReturnCode = 0
ps.Streams.stdout.Content = Testers.ContainsExpression(
- "X-ParentSelection-Key: .*-bytes=",
- "expected bytes in parent selection key",
+ "X-ParentSelection-Key: .*-bytes=",
+ "expected bytes in parent selection key",
)
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
diff --git a/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_cachekey.test.py b/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_cachekey.test.py
index 2622694a04e..02cf665c51a 100644
--- a/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_cachekey.test.py
+++ b/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_cachekey.test.py
@@ -23,7 +23,7 @@
cache_range_requests with cachekey
'''
-## Test description:
+# Test description:
# Preload the cache with the entire asset to be range requested.
# Reload remap rule with cache_range_requests plugin
# Request content through the cache_range_requests plugin
@@ -44,21 +44,21 @@
# default root
req_chk = {"headers":
- "GET / HTTP/1.1\r\n" +
- "Host: www.example.com\r\n" +
- "uuid: none\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": ""
-}
+ "GET / HTTP/1.1\r\n" +
+ "Host: www.example.com\r\n" +
+ "uuid: none\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""
+ }
res_chk = {"headers":
- "HTTP/1.1 200 OK\r\n" +
- "Connection: close\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": ""
-}
+ "HTTP/1.1 200 OK\r\n" +
+ "Connection: close\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""
+ }
server.addResponse("sessionlog.json", req_chk, res_chk)
@@ -67,90 +67,90 @@
# this request should work
req_full = {"headers":
- "GET /path HTTP/1.1\r\n" +
- "Host: www.example.com\r\n" +
- "Accept: */*\r\n" +
- "uuid: full\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": ""
-}
+ "GET /path HTTP/1.1\r\n" +
+ "Host: www.example.com\r\n" +
+ "Accept: */*\r\n" +
+ "uuid: full\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""
+ }
res_full = {"headers":
- "HTTP/1.1 206 Partial Content\r\n" +
- "Accept-Ranges: bytes\r\n" +
- 'Etag: "foo"\r\n' +
- "Cache-Control: public, max-age=500\r\n" +
- "Connection: close\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": body
-}
+ "HTTP/1.1 206 Partial Content\r\n" +
+ "Accept-Ranges: bytes\r\n" +
+ 'Etag: "foo"\r\n' +
+ "Cache-Control: public, max-age=500\r\n" +
+ "Connection: close\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": body
+ }
server.addResponse("sessionlog.json", req_full, res_full)
# this request should work
req_good = {"headers":
- "GET /path HTTP/1.1\r\n" +
- "Host: www.example.com\r\n" +
- "Accept: */*\r\n" +
- "Range: bytes=0-\r\n" +
- "uuid: range_full\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": ""
-}
+ "GET /path HTTP/1.1\r\n" +
+ "Host: www.example.com\r\n" +
+ "Accept: */*\r\n" +
+ "Range: bytes=0-\r\n" +
+ "uuid: range_full\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""
+ }
res_good = {"headers":
- "HTTP/1.1 206 Partial Content\r\n" +
- "Accept-Ranges: bytes\r\n" +
- 'Etag: "foo"\r\n' +
- "Cache-Control: public, max-age=500\r\n" +
- "Content-Range: bytes 0-{0}/{0}\r\n".format(bodylen) +
- "Connection: close\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": body
-}
+ "HTTP/1.1 206 Partial Content\r\n" +
+ "Accept-Ranges: bytes\r\n" +
+ 'Etag: "foo"\r\n' +
+ "Cache-Control: public, max-age=500\r\n" +
+ "Content-Range: bytes 0-{0}/{0}\r\n".format(bodylen) +
+ "Connection: close\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": body
+ }
server.addResponse("sessionlog.json", req_good, res_good)
# this request should fail with a cache_range_requests asset
req_fail = {"headers":
- "GET /path HTTP/1.1\r\n" +
- "Host: www.fail.com\r\n" +
- "Accept: */*\r\n" +
- "Range: bytes=0-\r\n" +
- "uuid: range_fail\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": ""
-}
+ "GET /path HTTP/1.1\r\n" +
+ "Host: www.fail.com\r\n" +
+ "Accept: */*\r\n" +
+ "Range: bytes=0-\r\n" +
+ "uuid: range_fail\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""
+ }
res_fail = {"headers":
- "HTTP/1.1 206 Partial Content\r\n" +
- "Accept-Ranges: bytes\r\n" +
- 'Etag: "foo"\r\n' +
- "Cache-Control: public, max-age=500\r\n" +
- "Content-Range: bytes 0-{0}/{0}\r\n".format(bodylen) +
- "Connection: close\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": body
-}
+ "HTTP/1.1 206 Partial Content\r\n" +
+ "Accept-Ranges: bytes\r\n" +
+ 'Etag: "foo"\r\n' +
+ "Cache-Control: public, max-age=500\r\n" +
+ "Content-Range: bytes 0-{0}/{0}\r\n".format(bodylen) +
+ "Connection: close\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": body
+ }
server.addResponse("sessionlog.json", req_fail, res_fail)
# cache range requests plugin remap, working config
ts.Disk.remap_config.AddLine(
- 'map http://www.example.com http://127.0.0.1:{}'.format(server.Variables.Port) +
+ 'map http://www.example.com http://127.0.0.1:{}'.format(server.Variables.Port) +
' @plugin=cachekey.so @pparam=--include-headers=Range' +
' @plugin=cache_range_requests.so @pparam=--no-modify-cachekey',
)
# improperly configured cache_range_requests with cachekey
ts.Disk.remap_config.AddLine(
- 'map http://www.fail.com http://127.0.0.1:{}'.format(server.Variables.Port) +
+ 'map http://www.fail.com http://127.0.0.1:{}'.format(server.Variables.Port) +
' @plugin=cachekey.so @pparam=--static-prefix=foo'
' @plugin=cache_range_requests.so',
)
@@ -160,10 +160,10 @@
# minimal configuration
ts.Disk.records_config.update({
- 'proxy.config.diags.debug.enabled': 1,
- 'proxy.config.diags.debug.tags': 'cache_range_requests',
- 'proxy.config.http.cache.http': 1,
- 'proxy.config.http.wait_for_cache': 1,
+ 'proxy.config.diags.debug.enabled': 1,
+ 'proxy.config.diags.debug.tags': 'cache_range_requests',
+ 'proxy.config.http.cache.http': 1,
+ 'proxy.config.http.wait_for_cache': 1,
})
curl_and_args = 'curl -s -D /dev/stdout -o /dev/stderr -x localhost:{} -H "x-debug: x-cache"'.format(ts.Variables.port)
@@ -195,4 +195,6 @@
ts.Disk.diags_log.Content = Testers.ContainsExpression("ERROR", "error condition hit")
ts.Disk.diags_log.Content = Testers.ContainsExpression("failed to change the cache url", "ensure failure for misconfiguration")
-ts.Disk.diags_log.Content = Testers.ContainsExpression("Disabling cache for this transaction to avoid cache poisoning", "ensure transaction caching disabled")
+ts.Disk.diags_log.Content = Testers.ContainsExpression(
+ "Disabling cache for this transaction to avoid cache poisoning",
+ "ensure transaction caching disabled")
diff --git a/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_ims.test.py b/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_ims.test.py
index 3c9c281b395..8a6a953cf3e 100644
--- a/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_ims.test.py
+++ b/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_ims.test.py
@@ -23,7 +23,7 @@
cache_range_requests X-CRR-IMS plugin test
'''
-## Test description:
+# Test description:
# Preload the cache with the entire asset to be range requested.
# Reload remap rule with cache_range_requests plugin
# Request content through the cache_range_requests plugin
@@ -43,21 +43,21 @@
# default root
req_chk = {"headers":
- "GET / HTTP/1.1\r\n" +
- "Host: www.example.com\r\n" +
- "uuid: none\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": ""
-}
+ "GET / HTTP/1.1\r\n" +
+ "Host: www.example.com\r\n" +
+ "uuid: none\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""
+ }
res_chk = {"headers":
- "HTTP/1.1 200 OK\r\n" +
- "Connection: close\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": ""
-}
+ "HTTP/1.1 200 OK\r\n" +
+ "Connection: close\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""
+ }
server.addResponse("sessionlog.json", req_chk, res_chk)
@@ -65,32 +65,32 @@
bodylen = len(body)
req_full = {"headers":
- "GET /path HTTP/1.1\r\n" +
- "Host: www.example.com\r\n" +
- "Accept: */*\r\n" +
- "Range: bytes=0-\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": ""
-}
+ "GET /path HTTP/1.1\r\n" +
+ "Host: www.example.com\r\n" +
+ "Accept: */*\r\n" +
+ "Range: bytes=0-\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""
+ }
res_full = {"headers":
- "HTTP/1.1 206 Partial Content\r\n" +
- "Accept-Ranges: bytes\r\n" +
- "Cache-Control: max-age=500\r\n" +
- "Content-Range: bytes 0-{0}/{0}\r\n".format(bodylen) +
- "Connection: close\r\n" +
- 'Etag: "772102f4-56f4bc1e6d417"\r\n' +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": body
-}
+ "HTTP/1.1 206 Partial Content\r\n" +
+ "Accept-Ranges: bytes\r\n" +
+ "Cache-Control: max-age=500\r\n" +
+ "Content-Range: bytes 0-{0}/{0}\r\n".format(bodylen) +
+ "Connection: close\r\n" +
+ 'Etag: "772102f4-56f4bc1e6d417"\r\n' +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": body
+ }
server.addResponse("sessionlog.json", req_full, res_full)
# cache range requests plugin remap
ts.Disk.remap_config.AddLine(
- 'map http://www.example.com http://127.0.0.1:{}'.format(server.Variables.Port) +
+ 'map http://www.example.com http://127.0.0.1:{}'.format(server.Variables.Port) +
' @plugin=cache_range_requests.so @pparam=--consider-ims',
)
@@ -99,10 +99,10 @@
# minimal configuration
ts.Disk.records_config.update({
- 'proxy.config.diags.debug.enabled': 1,
- 'proxy.config.diags.debug.tags': 'cache_range_requests',
- 'proxy.config.http.cache.http': 1,
- 'proxy.config.http.wait_for_cache': 1,
+ 'proxy.config.diags.debug.enabled': 1,
+ 'proxy.config.diags.debug.tags': 'cache_range_requests',
+ 'proxy.config.http.cache.http': 1,
+ 'proxy.config.http.wait_for_cache': 1,
})
curl_and_args = 'curl -s -D /dev/stdout -o /dev/stderr -x localhost:{} -H "x-debug: x-cache"'.format(ts.Variables.port)
@@ -119,7 +119,7 @@
# set up the IMS date field (go in the future) RFC 2616
-futuretime = time.time() + 100 # seconds
+futuretime = time.time() + 100 # seconds
futurestr = time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime(futuretime))
# test inner range
diff --git a/tests/gold_tests/pluginTest/cert_update/cert_update.test.py b/tests/gold_tests/pluginTest/cert_update/cert_update.test.py
index 0e2beb4d34a..c32d299afd9 100644
--- a/tests/gold_tests/pluginTest/cert_update/cert_update.test.py
+++ b/tests/gold_tests/pluginTest/cert_update/cert_update.test.py
@@ -22,8 +22,8 @@
'''
Test.SkipUnless(
- Condition.HasProgram("openssl","Openssl need to be installed on system for this test to work")
- )
+ Condition.HasProgram("openssl", "Openssl need to be installed on system for this test to work")
+)
# Set up origin server
server = Test.MakeOriginServer("server")
@@ -108,7 +108,8 @@
# Client-Cert-Pre
# s_server should see client (Traffic Server) as alice.com
tr = Test.AddTestRun("Client-Cert-Pre")
-s_server = tr.Processes.Process("s_server", "openssl s_server -www -key {0}/server1.pem -cert {0}/server1.pem -accept 12345 -Verify 1 -msg".format(ts.Variables.SSLDir))
+s_server = tr.Processes.Process(
+ "s_server", "openssl s_server -www -key {0}/server1.pem -cert {0}/server1.pem -accept 12345 -Verify 1 -msg".format(ts.Variables.SSLDir))
s_server.Ready = When.PortReady(12345)
tr.Command = 'curl --verbose --insecure --header "Host: foo.com" https://localhost:{}'.format(ts.Variables.ssl_port)
tr.Processes.Default.StartBefore(s_server)
@@ -120,15 +121,16 @@
tr = Test.AddTestRun("Client-Cert-Update")
tr.Processes.Default.Env = ts.Env
tr.Processes.Default.Command = (
- 'mv {0}/client2.pem {0}/client1.pem && {1}/traffic_ctl plugin msg cert_update.client {0}/client1.pem'.format(ts.Variables.SSLDir, ts.Variables.BINDIR)
-)
+ 'mv {0}/client2.pem {0}/client1.pem && {1}/traffic_ctl plugin msg cert_update.client {0}/client1.pem'.format(
+ ts.Variables.SSLDir, ts.Variables.BINDIR))
ts.Streams.all = "gold/update.gold"
ts.StillRunningAfter = server
# Client-Cert-After
# after use traffic_ctl to update client cert, s_server should see client (Traffic Server) as bob.com
tr = Test.AddTestRun("Client-Cert-After")
-s_server = tr.Processes.Process("s_server", "openssl s_server -www -key {0}/server1.pem -cert {0}/server1.pem -accept 12345 -Verify 1 -msg".format(ts.Variables.SSLDir))
+s_server = tr.Processes.Process(
+ "s_server", "openssl s_server -www -key {0}/server1.pem -cert {0}/server1.pem -accept 12345 -Verify 1 -msg".format(ts.Variables.SSLDir))
s_server.Ready = When.PortReady(12345)
tr.Processes.Default.Env = ts.Env
# Move client2.pem to replace client1.pem since cert path matters in client context mapping
diff --git a/tests/gold_tests/pluginTest/combo_handler/combo_handler.test.py b/tests/gold_tests/pluginTest/combo_handler/combo_handler.test.py
index c7b098001fc..72528e74069 100644
--- a/tests/gold_tests/pluginTest/combo_handler/combo_handler.test.py
+++ b/tests/gold_tests/pluginTest/combo_handler/combo_handler.test.py
@@ -30,6 +30,8 @@
# the file, and return the file name.
#
_data_file__file_count = 0
+
+
def data_file(data):
global _data_file__file_count
file_path = Test.RunDirectory + "/tcp_client_in_{}".format(_data_file__file_count)
@@ -40,37 +42,44 @@ def data_file(data):
# Function to return command (string) to run tcp_client.py tool. 'host' 'port', and 'file_path' are the parameters to tcp_client.
#
+
+
def tcp_client_cmd(host, port, file_path):
return "python3 {}/tcp_client.py {} {} {}".format(Test.Variables.AtsTestToolsDir, host, port, file_path)
# Function to return command (string) to run tcp_client.py tool. 'host' and 'port' are the first two parameters to tcp_client.
# 'data' is the data to put in the data file input to tcp_client.
#
+
+
def tcp_client(host, port, data):
return tcp_client_cmd(host, port, data_file(data))
+
server = Test.MakeOriginServer("server")
+
def add_server_obj(content_type, path):
request_header = {
"headers": "GET " + path + " HTTP/1.1\r\n" +
- "Host: just.any.thing\r\n\r\n",
+ "Host: just.any.thing\r\n\r\n",
"timestamp": "1469733493.993",
"body": ""
}
response_header = {
"headers": "HTTP/1.1 200 OK\r\n" +
- "Connection: close\r\n" +
- 'Etag: "359670651"\r\n' +
- "Cache-Control: public, max-age=31536000\r\n" +
- "Accept-Ranges: bytes\r\n" +
- "Content-Type: " + content_type + "\r\n" +
- "\r\n",
+ "Connection: close\r\n" +
+ 'Etag: "359670651"\r\n' +
+ "Cache-Control: public, max-age=31536000\r\n" +
+ "Accept-Ranges: bytes\r\n" +
+ "Content-Type: " + content_type + "\r\n" +
+ "\r\n",
"timestamp": "1469733493.993",
"body": "Content for " + path + "\n"
}
server.addResponse("sessionfile.log", request_header, response_header)
+
add_server_obj("text/css ; charset=utf-8", "/obj1")
add_server_obj("text/javascript", "/sub/obj2")
add_server_obj("text/argh", "/obj3")
@@ -110,22 +119,22 @@ def add_server_obj(content_type, path):
tr = Test.AddTestRun()
tr.Processes.Default.Command = tcp_client("127.0.0.1", ts.Variables.port,
- "GET /admin/v1/combo?obj1&sub:obj2&obj3 HTTP/1.1\n" +
- "Host: xyz\n" +
- "Connection: close\n" +
- "\n"
-)
+ "GET /admin/v1/combo?obj1&sub:obj2&obj3 HTTP/1.1\n" +
+ "Host: xyz\n" +
+ "Connection: close\n" +
+ "\n"
+ )
tr.Processes.Default.ReturnCode = 0
f = tr.Disk.File("_output/1-tr-Default/stream.all.txt")
f.Content = "combo_handler_files/tr1.gold"
tr = Test.AddTestRun()
tr.Processes.Default.Command = tcp_client("127.0.0.1", ts.Variables.port,
- "GET /admin/v1/combo?obj1&sub:obj2&obj4 HTTP/1.1\n" +
- "Host: xyz\n" +
- "Connection: close\n" +
- "\n"
-)
+ "GET /admin/v1/combo?obj1&sub:obj2&obj4 HTTP/1.1\n" +
+ "Host: xyz\n" +
+ "Connection: close\n" +
+ "\n"
+ )
tr.Processes.Default.ReturnCode = 0
f = tr.Disk.File("_output/2-tr-Default/stream.all.txt")
f.Content = "combo_handler_files/tr2.gold"
diff --git a/tests/gold_tests/pluginTest/compress/compress.test.py b/tests/gold_tests/pluginTest/compress/compress.test.py
index 30f62e85129..1cc2eb82437 100644
--- a/tests/gold_tests/pluginTest/compress/compress.test.py
+++ b/tests/gold_tests/pluginTest/compress/compress.test.py
@@ -32,6 +32,7 @@
server = Test.MakeOriginServer("server", options={'--load': '{}/compress_observer.py'.format(Test.TestDirectory)})
+
def repeat(str, count):
result = ""
while count > 0:
@@ -39,6 +40,7 @@ def repeat(str, count):
count -= 1
return result
+
# Need a fairly big body, otherwise the plugin will refuse to compress
body = repeat("lets go surfin now everybodys learnin how\n", 24)
body = body + "lets go surfin now everybodys learnin how"
@@ -61,6 +63,7 @@ def repeat(str, count):
}
server.addResponse("sessionfile.log", request_header, response_header)
+
def curl(ts, idx, encodingList):
return (
"curl --verbose --proxy http://127.0.0.1:{}".format(ts.Variables.port) +
@@ -69,6 +72,7 @@ def curl(ts, idx, encodingList):
" 2>> compress_long.log ; printf '\n===\n' >> compress_long.log"
)
+
waitForServer = True
waitForTs = True
diff --git a/tests/gold_tests/pluginTest/compress/compress_observer.py b/tests/gold_tests/pluginTest/compress/compress_observer.py
index b959f78be62..dbdecbf7efd 100755
--- a/tests/gold_tests/pluginTest/compress/compress_observer.py
+++ b/tests/gold_tests/pluginTest/compress/compress_observer.py
@@ -19,8 +19,10 @@
log = open('compress_userver.log', 'w')
+
def observe(headers):
log.write("{}\n".format(headers['X-Ats-Compress-Test']))
log.flush()
+
Hooks.register(Hooks.ReadRequestHook, observe)
diff --git a/tests/gold_tests/pluginTest/cookie_remap/bucketcookie.test.py b/tests/gold_tests/pluginTest/cookie_remap/bucketcookie.test.py
index 25254ec49ab..ff56f86f8b6 100644
--- a/tests/gold_tests/pluginTest/cookie_remap/bucketcookie.test.py
+++ b/tests/gold_tests/pluginTest/cookie_remap/bucketcookie.test.py
@@ -31,7 +31,8 @@
# second server is run during second test
server = Test.MakeOriginServer("server", ip='127.0.0.10')
-request_header = {"headers": "GET /cookiematches HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_header = {"headers": "GET /cookiematches HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993", "body": ""}
# expected response from the origin server
response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
@@ -39,7 +40,8 @@
server.addResponse("sessionfile.log", request_header, response_header)
server2 = Test.MakeOriginServer("server2", ip='127.0.0.11')
-request_header2 = {"headers": "GET /cookiedoesntmatch HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_header2 = {"headers": "GET /cookiedoesntmatch HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993", "body": ""}
# expected response from the origin server
response_header2 = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
@@ -59,7 +61,7 @@
config1 = config1.replace("$PORT", str(server.Variables.Port))
config1 = config1.replace("$ALTPORT", str(server2.Variables.Port))
-ts.Disk.File(ts.Variables.CONFIGDIR +"/bucketconfig.txt", exists=False, id="config1")
+ts.Disk.File(ts.Variables.CONFIGDIR + "/bucketconfig.txt", exists=False, id="config1")
ts.Disk.config1.WriteOn(config1)
ts.Disk.remap_config.AddLine(
diff --git a/tests/gold_tests/pluginTest/cookie_remap/collapseslashes.test.py b/tests/gold_tests/pluginTest/cookie_remap/collapseslashes.test.py
index e1df4fea8fe..c25ee53f9e2 100644
--- a/tests/gold_tests/pluginTest/cookie_remap/collapseslashes.test.py
+++ b/tests/gold_tests/pluginTest/cookie_remap/collapseslashes.test.py
@@ -31,7 +31,8 @@
# and verify it collapsed the double //
server = Test.MakeOriginServer("server", ip='127.0.0.10')
-request_header = {"headers": "GET /i/like/cheetos?.done=http://finance.yahoo.com HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_header = {"headers": "GET /i/like/cheetos?.done=http://finance.yahoo.com HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993", "body": ""}
# expected response from the origin server
response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
@@ -50,7 +51,7 @@
config1 = config1.replace("$PORT", str(server.Variables.Port))
-ts.Disk.File(ts.Variables.CONFIGDIR +"/collapseconfig.txt", exists=False, id="config1")
+ts.Disk.File(ts.Variables.CONFIGDIR + "/collapseconfig.txt", exists=False, id="config1")
ts.Disk.config1.WriteOn(config1)
ts.Disk.remap_config.AddLine(
diff --git a/tests/gold_tests/pluginTest/cookie_remap/connector.test.py b/tests/gold_tests/pluginTest/cookie_remap/connector.test.py
index 4d595a41529..8cd16b82d54 100644
--- a/tests/gold_tests/pluginTest/cookie_remap/connector.test.py
+++ b/tests/gold_tests/pluginTest/cookie_remap/connector.test.py
@@ -31,7 +31,8 @@
# second server is run during second test
server = Test.MakeOriginServer("server", ip='127.0.0.10')
-request_header = {"headers": "GET /cookiematches HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_header = {"headers": "GET /cookiematches HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993", "body": ""}
# expected response from the origin server
response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
@@ -39,7 +40,8 @@
server.addResponse("sessionfile.log", request_header, response_header)
server2 = Test.MakeOriginServer("server2", ip='127.0.0.11')
-request_header2 = {"headers": "GET /cookiedoesntmatch HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_header2 = {"headers": "GET /cookiedoesntmatch HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993", "body": ""}
# expected response from the origin server
response_header2 = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
@@ -59,7 +61,7 @@
config1 = config1.replace("$PORT", str(server.Variables.Port))
config1 = config1.replace("$ALTPORT", str(server2.Variables.Port))
-ts.Disk.File(ts.Variables.CONFIGDIR +"/connectorconfig.txt", exists=False, id="config1")
+ts.Disk.File(ts.Variables.CONFIGDIR + "/connectorconfig.txt", exists=False, id="config1")
ts.Disk.config1.WriteOn(config1)
ts.Disk.remap_config.AddLine(
diff --git a/tests/gold_tests/pluginTest/cookie_remap/existscookie.test.py b/tests/gold_tests/pluginTest/cookie_remap/existscookie.test.py
index 6c592e820dc..dd53fbf72da 100644
--- a/tests/gold_tests/pluginTest/cookie_remap/existscookie.test.py
+++ b/tests/gold_tests/pluginTest/cookie_remap/existscookie.test.py
@@ -31,7 +31,8 @@
# second server is run during second test
server = Test.MakeOriginServer("server", ip='127.0.0.10')
-request_header = {"headers": "GET /cookieexists HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_header = {"headers": "GET /cookieexists HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993", "body": ""}
# expected response from the origin server
response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
@@ -39,7 +40,8 @@
server.addResponse("sessionfile.log", request_header, response_header)
server2 = Test.MakeOriginServer("server2", ip='127.0.0.11')
-request_header2 = {"headers": "GET /cookiedoesntexist HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_header2 = {"headers": "GET /cookiedoesntexist HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993", "body": ""}
# expected response from the origin server
response_header2 = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
@@ -59,7 +61,7 @@
config1 = config1.replace("$PORT", str(server.Variables.Port))
config1 = config1.replace("$ALTPORT", str(server2.Variables.Port))
-ts.Disk.File(ts.Variables.CONFIGDIR +"/existsconfig.txt", exists=False, id="config1")
+ts.Disk.File(ts.Variables.CONFIGDIR + "/existsconfig.txt", exists=False, id="config1")
ts.Disk.config1.WriteOn(config1)
ts.Disk.remap_config.AddLine(
diff --git a/tests/gold_tests/pluginTest/cookie_remap/matchcookie.test.py b/tests/gold_tests/pluginTest/cookie_remap/matchcookie.test.py
index c238b259e3a..39e0a75871b 100644
--- a/tests/gold_tests/pluginTest/cookie_remap/matchcookie.test.py
+++ b/tests/gold_tests/pluginTest/cookie_remap/matchcookie.test.py
@@ -31,7 +31,8 @@
# second server is run during second test
server = Test.MakeOriginServer("server", ip='127.0.0.10')
-request_header = {"headers": "GET /cookiematches?a=1&b=2&c=3 HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_header = {"headers": "GET /cookiematches?a=1&b=2&c=3 HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993", "body": ""}
# expected response from the origin server
response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
@@ -39,7 +40,8 @@
server.addResponse("sessionfile.log", request_header, response_header)
server2 = Test.MakeOriginServer("server2", ip='127.0.0.11')
-request_header2 = {"headers": "GET /cookiedoesntmatch?a=1&b=2&c=3 HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_header2 = {"headers": "GET /cookiedoesntmatch?a=1&b=2&c=3 HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993", "body": ""}
# expected response from the origin server
response_header2 = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
@@ -59,7 +61,7 @@
config1 = config1.replace("$PORT", str(server.Variables.Port))
config1 = config1.replace("$ALTPORT", str(server2.Variables.Port))
-ts.Disk.File(ts.Variables.CONFIGDIR +"/matchconfig.txt", exists=False, id="config1")
+ts.Disk.File(ts.Variables.CONFIGDIR + "/matchconfig.txt", exists=False, id="config1")
ts.Disk.config1.WriteOn(config1)
ts.Disk.remap_config.AddLine(
diff --git a/tests/gold_tests/pluginTest/cookie_remap/matchuri.test.py b/tests/gold_tests/pluginTest/cookie_remap/matchuri.test.py
index 53c894c4966..43e20f442aa 100644
--- a/tests/gold_tests/pluginTest/cookie_remap/matchuri.test.py
+++ b/tests/gold_tests/pluginTest/cookie_remap/matchuri.test.py
@@ -31,7 +31,8 @@
# second server is run during second test
server = Test.MakeOriginServer("server", ip='127.0.0.10')
-request_header = {"headers": "GET /cookiematches HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_header = {"headers": "GET /cookiematches HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993", "body": ""}
# expected response from the origin server
response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
@@ -39,7 +40,8 @@
server.addResponse("sessionfile.log", request_header, response_header)
server2 = Test.MakeOriginServer("server2", ip='127.0.0.11')
-request_header2 = {"headers": "GET /cookiedoesntmatch HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_header2 = {"headers": "GET /cookiedoesntmatch HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993", "body": ""}
# expected response from the origin server
response_header2 = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
@@ -59,7 +61,7 @@
config1 = config1.replace("$PORT", str(server.Variables.Port))
config1 = config1.replace("$ALTPORT", str(server2.Variables.Port))
-ts.Disk.File(ts.Variables.CONFIGDIR +"/matchuriconfig.txt", exists=False, id="config1")
+ts.Disk.File(ts.Variables.CONFIGDIR + "/matchuriconfig.txt", exists=False, id="config1")
ts.Disk.config1.WriteOn(config1)
ts.Disk.remap_config.AddLine(
diff --git a/tests/gold_tests/pluginTest/cookie_remap/matrixparams.test.py b/tests/gold_tests/pluginTest/cookie_remap/matrixparams.test.py
index 1da71a683eb..404f63ff3a3 100644
--- a/tests/gold_tests/pluginTest/cookie_remap/matrixparams.test.py
+++ b/tests/gold_tests/pluginTest/cookie_remap/matrixparams.test.py
@@ -32,27 +32,34 @@
# That's why I am not adding any canned request/response
server = Test.MakeOriginServer("server", ip='127.0.0.10')
-request_header = {"headers": "GET /eighth/magic;matrix=1/eighth HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_header = {"headers": "GET /eighth/magic;matrix=1/eighth HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993", "body": ""}
response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
server.addResponse("sessionfile.log", request_header, response_header)
-request_header_2 = {"headers": "GET /eighth/magic;matrix=1/eighth?hello=10 HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_header_2 = {"headers": "GET /eighth/magic;matrix=1/eighth?hello=10 HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993", "body": ""}
response_header_2 = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
server.addResponse("sessionfile.log", request_header_2, response_header_2)
-request_header_3 = {"headers": "GET /tenth/magic/tenth;matrix=2 HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_header_3 = {"headers": "GET /tenth/magic/tenth;matrix=2 HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993", "body": ""}
response_header_3 = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
server.addResponse("sessionfile.log", request_header_3, response_header_3)
-request_header_4 = {"headers": "GET /tenth/magic/tenth;matrix=2?query=10 HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_header_4 = {"headers": "GET /tenth/magic/tenth;matrix=2?query=10 HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993", "body": ""}
response_header_4 = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
server.addResponse("sessionfile.log", request_header_4, response_header_4)
-request_header_5 = {"headers": "GET /eleventh/magic;matrix=4/eleventh;matrix=2?query=true HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_header_5 = {
+ "headers": "GET /eleventh/magic;matrix=4/eleventh;matrix=2?query=true HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""}
response_header_5 = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
server.addResponse("sessionfile.log", request_header_5, response_header_5)
@@ -69,7 +76,7 @@
config1 = config1.replace("$PORT", str(server.Variables.Port))
-ts.Disk.File(ts.Variables.CONFIGDIR +"/matrixconfig.txt", exists=False, id="config1")
+ts.Disk.File(ts.Variables.CONFIGDIR + "/matrixconfig.txt", exists=False, id="config1")
ts.Disk.config1.WriteOn(config1)
ts.Disk.remap_config.AddLine(
diff --git a/tests/gold_tests/pluginTest/cookie_remap/notexistscookie.test.py b/tests/gold_tests/pluginTest/cookie_remap/notexistscookie.test.py
index 45199372202..e96d940a2f6 100644
--- a/tests/gold_tests/pluginTest/cookie_remap/notexistscookie.test.py
+++ b/tests/gold_tests/pluginTest/cookie_remap/notexistscookie.test.py
@@ -31,7 +31,8 @@
# second server is run during second test
server = Test.MakeOriginServer("server", ip='127.0.0.10')
-request_header = {"headers": "GET /cookiedoesntexist HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_header = {"headers": "GET /cookiedoesntexist HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993", "body": ""}
# expected response from the origin server
response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
@@ -39,7 +40,8 @@
server.addResponse("sessionfile.log", request_header, response_header)
server2 = Test.MakeOriginServer("server2", ip='127.0.0.11')
-request_header2 = {"headers": "GET /cookieexists HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_header2 = {"headers": "GET /cookieexists HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993", "body": ""}
# expected response from the origin server
response_header2 = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
@@ -59,7 +61,7 @@
config1 = config1.replace("$PORT", str(server.Variables.Port))
config1 = config1.replace("$ALTPORT", str(server2.Variables.Port))
-ts.Disk.File(ts.Variables.CONFIGDIR +"/notexistsconfig.txt", exists=False, id="config1")
+ts.Disk.File(ts.Variables.CONFIGDIR + "/notexistsconfig.txt", exists=False, id="config1")
ts.Disk.config1.WriteOn(config1)
ts.Disk.remap_config.AddLine(
diff --git a/tests/gold_tests/pluginTest/cookie_remap/regexcookie.test.py b/tests/gold_tests/pluginTest/cookie_remap/regexcookie.test.py
index 27998dfd2b8..417ac319c21 100644
--- a/tests/gold_tests/pluginTest/cookie_remap/regexcookie.test.py
+++ b/tests/gold_tests/pluginTest/cookie_remap/regexcookie.test.py
@@ -31,7 +31,8 @@
# second server is run during second test
server = Test.MakeOriginServer("server", ip='127.0.0.10')
-request_header = {"headers": "GET /regexmatches?cookies=oreos-chipsahoy-icecream HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_header = {"headers": "GET /regexmatches?cookies=oreos-chipsahoy-icecream HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993", "body": ""}
# expected response from the origin server
response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
@@ -39,7 +40,8 @@
server.addResponse("sessionfile.log", request_header, response_header)
server2 = Test.MakeOriginServer("server2", ip='127.0.0.11')
-request_header2 = {"headers": "GET /regexdoesntmatch HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_header2 = {"headers": "GET /regexdoesntmatch HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993", "body": ""}
# expected response from the origin server
response_header2 = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
@@ -59,7 +61,7 @@
config1 = config1.replace("$PORT", str(server.Variables.Port))
config1 = config1.replace("$ALTPORT", str(server2.Variables.Port))
-ts.Disk.File(ts.Variables.CONFIGDIR +"/regexconfig.txt", exists=False, id="config1")
+ts.Disk.File(ts.Variables.CONFIGDIR + "/regexconfig.txt", exists=False, id="config1")
ts.Disk.config1.WriteOn(config1)
ts.Disk.remap_config.AddLine(
diff --git a/tests/gold_tests/pluginTest/cookie_remap/setstatus.test.py b/tests/gold_tests/pluginTest/cookie_remap/setstatus.test.py
index f7a298e6184..976779a30d4 100644
--- a/tests/gold_tests/pluginTest/cookie_remap/setstatus.test.py
+++ b/tests/gold_tests/pluginTest/cookie_remap/setstatus.test.py
@@ -37,7 +37,7 @@
'proxy.config.diags.debug.tags': 'cookie_remap.*|http.*|dns.*',
})
-ts.Disk.File(ts.Variables.CONFIGDIR +"/statusconfig.txt", exists=False, id="config1")
+ts.Disk.File(ts.Variables.CONFIGDIR + "/statusconfig.txt", exists=False, id="config1")
ts.Disk.config1.WriteOn(config1)
ts.Disk.remap_config.AddLine(
diff --git a/tests/gold_tests/pluginTest/cookie_remap/subcookie.test.py b/tests/gold_tests/pluginTest/cookie_remap/subcookie.test.py
index 9a636d75cbd..677dc7cbcf0 100644
--- a/tests/gold_tests/pluginTest/cookie_remap/subcookie.test.py
+++ b/tests/gold_tests/pluginTest/cookie_remap/subcookie.test.py
@@ -31,7 +31,8 @@
# second server is run during second test
server = Test.MakeOriginServer("server", ip='127.0.0.10')
-request_header = {"headers": "GET /cookiematches HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_header = {"headers": "GET /cookiematches HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993", "body": ""}
# expected response from the origin server
response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
@@ -39,7 +40,8 @@
server.addResponse("sessionfile.log", request_header, response_header)
server2 = Test.MakeOriginServer("server2", ip='127.0.0.11')
-request_header2 = {"headers": "GET /cookiedoesntmatch HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_header2 = {"headers": "GET /cookiedoesntmatch HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993", "body": ""}
# expected response from the origin server
response_header2 = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
@@ -59,7 +61,7 @@
config1 = config1.replace("$PORT", str(server.Variables.Port))
config1 = config1.replace("$ALTPORT", str(server2.Variables.Port))
-ts.Disk.File(ts.Variables.CONFIGDIR +"/subcookie.txt", exists=False, id="config1")
+ts.Disk.File(ts.Variables.CONFIGDIR + "/subcookie.txt", exists=False, id="config1")
ts.Disk.config1.WriteOn(config1)
ts.Disk.remap_config.AddLine(
@@ -70,15 +72,16 @@
tr = Test.AddTestRun("cookie value matches")
# Unlike in other places I am using a single line string because the & seems to
# be interpreted by the autest framework or the shell (tried escaping with \)
-tr.Processes.Default.Command = 'curl --proxy 127.0.0.1:{0} "http://www.example.com" -H"Cookie: fpbeta=a=1&b=2&c=3" -H "Proxy-Connection: keep-alive" --verbose '.format(ts.Variables.port)
-#tr.Processes.Default.Command = '''
-#curl
-#--proxy 127.0.0.1:{0}
-#"http://www.example.com"
-#-H\"Cookie: fpbeta=a=1&b=2&c=3\"
-#-H "Proxy-Connection: keep-alive"
-#--verbose
-#'''.format(ts.Variables.port)
+tr.Processes.Default.Command = 'curl --proxy 127.0.0.1:{0} "http://www.example.com" -H"Cookie: fpbeta=a=1&b=2&c=3" -H "Proxy-Connection: keep-alive" --verbose '.format(
+ ts.Variables.port)
+# tr.Processes.Default.Command = '''
+# curl
+# --proxy 127.0.0.1:{0}
+# "http://www.example.com"
+# -H\"Cookie: fpbeta=a=1&b=2&c=3\"
+# -H "Proxy-Connection: keep-alive"
+# --verbose
+# '''.format(ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
# time delay as proxy.config.http.wait_for_cache could be broken
tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port))
@@ -89,7 +92,8 @@
# Negative test case that doesn't remap because not all subops pass
tr = Test.AddTestRun("cookie value doesn't match")
-tr.Processes.Default.Command = 'curl --proxy 127.0.0.1:{0} "http://www.example.com" -H"Cookie: fpbeta=a=1&b=2&c=4" -H "Proxy-Connection: keep-alive" --verbose '.format(ts.Variables.port)
+tr.Processes.Default.Command = 'curl --proxy 127.0.0.1:{0} "http://www.example.com" -H"Cookie: fpbeta=a=1&b=2&c=4" -H "Proxy-Connection: keep-alive" --verbose '.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.StartBefore(server2, ready=When.PortOpen(server2.Variables.Port))
tr.StillRunningAfter = ts
diff --git a/tests/gold_tests/pluginTest/cookie_remap/substitute.test.py b/tests/gold_tests/pluginTest/cookie_remap/substitute.test.py
index 5bb358b40fd..7ecd8e4652a 100644
--- a/tests/gold_tests/pluginTest/cookie_remap/substitute.test.py
+++ b/tests/gold_tests/pluginTest/cookie_remap/substitute.test.py
@@ -29,17 +29,20 @@
server = Test.MakeOriginServer("server", ip='127.0.0.10')
-request_header = {"headers": "GET /photos/search?query=magic HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_header = {"headers": "GET /photos/search?query=magic HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993", "body": ""}
response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
server.addResponse("sessionfile.log", request_header, response_header)
-request_header_2 = {"headers": "GET /photos/search?query=/theunmatchedpath HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_header_2 = {"headers": "GET /photos/search?query=/theunmatchedpath HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993", "body": ""}
response_header_2 = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
server.addResponse("sessionfile.log", request_header_2, response_header_2)
-request_header_3 = {"headers": "GET /photos/search/magic/foobar HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+request_header_3 = {"headers": "GET /photos/search/magic/foobar HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993", "body": ""}
response_header_3 = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
server.addResponse("sessionfile.log", request_header_3, response_header_3)
@@ -56,7 +59,7 @@
config1 = config1.replace("$PORT", str(server.Variables.Port))
-ts.Disk.File(ts.Variables.CONFIGDIR +"/substituteconfig.txt", exists=False, id="config1")
+ts.Disk.File(ts.Variables.CONFIGDIR + "/substituteconfig.txt", exists=False, id="config1")
ts.Disk.config1.WriteOn(config1)
ts.Disk.remap_config.AddLine(
diff --git a/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_client.test.py b/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_client.test.py
index 53aa08541de..0ab0f880ae9 100644
--- a/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_client.test.py
+++ b/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_client.test.py
@@ -40,11 +40,11 @@
ts.Setup.CopyAs('rules/rule_client.conf', Test.RunDirectory)
ts.Disk.remap_config.AddLine(
- 'map http://www.example.com/from_path/ https://127.0.0.1:{0}/to_path/ @plugin=header_rewrite.so @pparam={1}/rule_client.conf'.format(server.Variables.Port, Test.RunDirectory)
-)
+ 'map http://www.example.com/from_path/ https://127.0.0.1:{0}/to_path/ @plugin=header_rewrite.so @pparam={1}/rule_client.conf'.format(
+ server.Variables.Port, Test.RunDirectory))
ts.Disk.remap_config.AddLine(
- 'map http://www.example.com:8080/from_path/ https://127.0.0.1:{0}/to_path/ @plugin=header_rewrite.so @pparam={1}/rule_client.conf'.format(server.Variables.Port, Test.RunDirectory)
-)
+ 'map http://www.example.com:8080/from_path/ https://127.0.0.1:{0}/to_path/ @plugin=header_rewrite.so @pparam={1}/rule_client.conf'.format(
+ server.Variables.Port, Test.RunDirectory))
# call localhost straight
tr = Test.AddTestRun()
diff --git a/tests/gold_tests/pluginTest/lua/lua_states_stats.test.py b/tests/gold_tests/pluginTest/lua/lua_states_stats.test.py
index a17182d9e55..b6a390a6640 100644
--- a/tests/gold_tests/pluginTest/lua/lua_states_stats.test.py
+++ b/tests/gold_tests/pluginTest/lua/lua_states_stats.test.py
@@ -54,14 +54,14 @@
ts.Disk.records_config.update({
'proxy.config.diags.debug.enabled': 1,
'proxy.config.diags.debug.tags': 'ts_lua',
- 'proxy.config.plugin.lua.max_states': 4,
+ 'proxy.config.plugin.lua.max_states': 4,
})
curl_and_args = 'curl -s -D /dev/stdout -o /dev/stderr -x localhost:{} '.format(ts.Variables.port)
# 0 Test - Check for configured lua states
tr = Test.AddTestRun("Lua states")
-ps = tr.Processes.Default # alias
+ps = tr.Processes.Default # alias
ps.StartBefore(server, ready=When.PortOpen(server.Variables.Port))
ps.StartBefore(Test.Processes.ts, ready=When.PortOpen(ts.Variables.port))
ps.Command = "traffic_ctl config match lua"
@@ -73,7 +73,7 @@
# 1 Test - Exercise lua script
tr = Test.AddTestRun("Lua hello")
-ps = tr.Processes.Default # alias
+ps = tr.Processes.Default # alias
ps.Command = curl_and_args + ' http://hello/hello'
ps.TimeOut = 5
ps.ReturnCode = 0
@@ -83,9 +83,9 @@
# 2 Test - Check for metrics
tr = Test.AddTestRun("Check for metrics")
-tr.DelayStart = 15 # 5s lag on metrics to update
+tr.DelayStart = 15 # 5s lag on metrics to update
tr.TimeOut = 5
-ps = tr.Processes.Default # alias
+ps = tr.Processes.Default # alias
ps.Env = ts.Env
ps.Command = "traffic_ctl metric match lua"
ps.Env = ts.Env
@@ -95,7 +95,7 @@
# 3 Test - Check for developer lifecycle stats
tr = Test.AddTestRun("Check for lifecycle stats")
-ps = tr.Processes.Default # alias
+ps = tr.Processes.Default # alias
ps.Command = "traffic_ctl plugin msg ts_lua print_stats"
ps.Env = ts.Env
ps.ReturnCode = 0
diff --git a/tests/gold_tests/pluginTest/multiplexer/multiplexer.test.py b/tests/gold_tests/pluginTest/multiplexer/multiplexer.test.py
index b634af40b2d..18a0ac73ce2 100644
--- a/tests/gold_tests/pluginTest/multiplexer/multiplexer.test.py
+++ b/tests/gold_tests/pluginTest/multiplexer/multiplexer.test.py
@@ -43,7 +43,8 @@
# For now, just make sure the plugin loads without error.
tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'curl --silent --proxy 127.0.0.1:{0} "http://www.example.com" -H "Proxy-Connection: close"'.format(ts.Variables.port)
+tr.Processes.Default.Command = 'curl --silent --proxy 127.0.0.1:{0} "http://www.example.com" -H "Proxy-Connection: close"'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port))
tr.Processes.Default.StartBefore(Test.Processes.ts)
diff --git a/tests/gold_tests/pluginTest/regex_remap/regex_remap.test.py b/tests/gold_tests/pluginTest/regex_remap/regex_remap.test.py
index 3d001f0a4d5..4828818e26b 100644
--- a/tests/gold_tests/pluginTest/regex_remap/regex_remap.test.py
+++ b/tests/gold_tests/pluginTest/regex_remap/regex_remap.test.py
@@ -21,7 +21,7 @@
Test regex_remap
'''
-## Test description:
+# Test description:
# Load up cache, ensure fresh
# Create regex reval rule, config reload:
# ensure item is staled only once.
@@ -76,7 +76,7 @@
tr = Test.AddTestRun("smoke test")
tr.Processes.Default.StartBefore(server)
tr.Processes.Default.StartBefore(Test.Processes.ts)
-creq=replay_txns[0]['client-request']
+creq = replay_txns[0]['client-request']
tr.Processes.Default.Command = curl_and_args + '--header "uuid: {}" '.format(creq["headers"]["fields"][1][1]) + creq["url"]
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "gold/regex_remap_smoke.gold"
@@ -84,9 +84,11 @@
# Crash test.
tr = Test.AddTestRun("crash test")
-creq=replay_txns[1]['client-request']
-tr.Processes.Default.Command = curl_and_args + '--header "uuid: {}" '.format(creq["headers"]["fields"][1][1]) + '"{}"'.format(creq["url"])
+creq = replay_txns[1]['client-request']
+tr.Processes.Default.Command = curl_and_args + \
+ '--header "uuid: {}" '.format(creq["headers"]["fields"][1][1]) + '"{}"'.format(creq["url"])
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "gold/regex_remap_crash.gold"
-ts.Disk.diags_log.Content = Testers.ContainsExpression('ERROR: .regex_remap. Bad regular expression result -21', "Resource limit exceeded")
+ts.Disk.diags_log.Content = Testers.ContainsExpression(
+ 'ERROR: .regex_remap. Bad regular expression result -21', "Resource limit exceeded")
tr.StillRunningAfter = ts
diff --git a/tests/gold_tests/pluginTest/regex_revalidate/regex_revalidate.test.py b/tests/gold_tests/pluginTest/regex_revalidate/regex_revalidate.test.py
index f4b79590e02..dd9babb1d1e 100644
--- a/tests/gold_tests/pluginTest/regex_revalidate/regex_revalidate.test.py
+++ b/tests/gold_tests/pluginTest/regex_revalidate/regex_revalidate.test.py
@@ -22,7 +22,7 @@
Test a basic regex_revalidate
'''
-## Test description:
+# Test description:
# Load up cache, ensure fresh
# Create regex reval rule, config reload:
# ensure item is staled only once.
@@ -44,80 +44,80 @@
# Define ATS and configure
ts = Test.MakeATSProcess("ts", command="traffic_manager", select_ports=True)
-#**testname is required**
+# **testname is required**
#testName = "regex_reval"
# default root
request_header_0 = {"headers":
- "GET / HTTP/1.1\r\n" +
- "Host: www.example.com\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": "",
-}
+ "GET / HTTP/1.1\r\n" +
+ "Host: www.example.com\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": "",
+ }
response_header_0 = {"headers":
- "HTTP/1.1 200 OK\r\n" +
- "Connection: close\r\n" +
- "Cache-Control: max-age=300\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": "xxx",
-}
+ "HTTP/1.1 200 OK\r\n" +
+ "Connection: close\r\n" +
+ "Cache-Control: max-age=300\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": "xxx",
+ }
# cache item path1
request_header_1 = {"headers":
- "GET /path1 HTTP/1.1\r\n" +
- "Host: www.example.com\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": ""
-}
+ "GET /path1 HTTP/1.1\r\n" +
+ "Host: www.example.com\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""
+ }
response_header_1 = {"headers":
- "HTTP/1.1 200 OK\r\n" +
- "Connection: close\r\n" +
- 'Etag: "path1"\r\n' +
- "Cache-Control: max-age=600,public\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": "abc"
-}
+ "HTTP/1.1 200 OK\r\n" +
+ "Connection: close\r\n" +
+ 'Etag: "path1"\r\n' +
+ "Cache-Control: max-age=600,public\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": "abc"
+ }
# cache item path1a
request_header_2 = {"headers":
- "GET /path1a HTTP/1.1\r\n" +
- "Host: www.example.com\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": ""
-}
+ "GET /path1a HTTP/1.1\r\n" +
+ "Host: www.example.com\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""
+ }
response_header_2 = {"headers":
- "HTTP/1.1 200 OK\r\n" +
- "Connection: close\r\n" +
- 'Etag: "path1a"\r\n' +
- "Cache-Control: max-age=600,public\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": "cde"
-}
+ "HTTP/1.1 200 OK\r\n" +
+ "Connection: close\r\n" +
+ 'Etag: "path1a"\r\n' +
+ "Cache-Control: max-age=600,public\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": "cde"
+ }
# cache item path2a
request_header_3 = {"headers":
- "GET /path2a HTTP/1.1\r\n" +
- "Host: www.example.com\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": ""
-}
+ "GET /path2a HTTP/1.1\r\n" +
+ "Host: www.example.com\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""
+ }
response_header_3 = {"headers":
- "HTTP/1.1 200 OK\r\n" +
- "Connection: close\r\n" +
- 'Etag: "path2a"\r\n' +
- "Cache-Control: max-age=900,public\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": "efg"
-}
+ "HTTP/1.1 200 OK\r\n" +
+ "Connection: close\r\n" +
+ 'Etag: "path2a"\r\n' +
+ "Cache-Control: max-age=900,public\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": "efg"
+ }
server.addResponse("sessionlog.json", request_header_0, response_header_0)
server.addResponse("sessionlog.json", request_header_1, response_header_1)
@@ -148,7 +148,7 @@
ts.Disk.records_config.update({
'proxy.config.diags.debug.enabled': 1,
'proxy.config.diags.debug.tags': 'regex_revalidate',
-# 'proxy.config.diags.debug.enabled': 0,
+ # 'proxy.config.diags.debug.enabled': 0,
'proxy.config.http.cache.http': 1,
'proxy.config.http.wait_for_cache': 1,
'proxy.config.http.insert_age_in_response': 0,
diff --git a/tests/gold_tests/pluginTest/slice/slice.test.py b/tests/gold_tests/pluginTest/slice/slice.test.py
index 81e1f563f5b..3c5260c2fc7 100644
--- a/tests/gold_tests/pluginTest/slice/slice.test.py
+++ b/tests/gold_tests/pluginTest/slice/slice.test.py
@@ -20,7 +20,7 @@
Basic slice plugin test
'''
-## Test description:
+# Test description:
# Preload the cache with the entire asset to be range requested.
# Reload remap rule with slice plugin
# Request content through the slice plugin
@@ -38,20 +38,20 @@
# default root
request_header_chk = {"headers":
- "GET / HTTP/1.1\r\n" +
- "Host: www.example.com\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": "",
-}
+ "GET / HTTP/1.1\r\n" +
+ "Host: www.example.com\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": "",
+ }
response_header_chk = {"headers":
- "HTTP/1.1 200 OK\r\n" +
- "Connection: close\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": "",
-}
+ "HTTP/1.1 200 OK\r\n" +
+ "Connection: close\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": "",
+ }
server.addResponse("sessionlog.json", request_header_chk, response_header_chk)
@@ -59,22 +59,22 @@
body = "lets go surfin now"
request_header = {"headers":
- "GET /path HTTP/1.1\r\n" +
- "Host: www.example.com\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": "",
-}
+ "GET /path HTTP/1.1\r\n" +
+ "Host: www.example.com\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": "",
+ }
response_header = {"headers":
- "HTTP/1.1 200 OK\r\n" +
- "Connection: close\r\n" +
- 'Etag: "path"\r\n' +
- "Cache-Control: max-age=500\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": body,
-}
+ "HTTP/1.1 200 OK\r\n" +
+ "Connection: close\r\n" +
+ 'Etag: "path"\r\n' +
+ "Cache-Control: max-age=500\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": body,
+ }
server.addResponse("sessionlog.json", request_header, response_header)
@@ -88,12 +88,12 @@
# minimal configuration
ts.Disk.records_config.update({
- 'proxy.config.diags.debug.enabled': 1,
- 'proxy.config.diags.debug.tags': 'slice',
- 'proxy.config.http.cache.http': 1,
- 'proxy.config.http.wait_for_cache': 1,
- 'proxy.config.http.insert_age_in_response': 0,
- 'proxy.config.http.response_via_str': 3,
+ 'proxy.config.diags.debug.enabled': 1,
+ 'proxy.config.diags.debug.tags': 'slice',
+ 'proxy.config.http.cache.http': 1,
+ 'proxy.config.http.wait_for_cache': 1,
+ 'proxy.config.http.insert_age_in_response': 0,
+ 'proxy.config.http.response_via_str': 3,
})
# 0 Test - Prefetch entire asset into cache
@@ -112,7 +112,7 @@
tr = Test.AddTestRun("Load Slice plugin")
remap_config_path = ts.Disk.remap_config.Name
tr.Disk.File(remap_config_path, typename="ats:config").AddLines([
- 'map / http://127.0.0.1:{}'.format(server.Variables.Port) +
+ 'map / http://127.0.0.1:{}'.format(server.Variables.Port) +
' @plugin=slice.so @pparam=--blockbytes-test={}'.format(block_bytes)
])
diff --git a/tests/gold_tests/pluginTest/slice/slice_error.test.py b/tests/gold_tests/pluginTest/slice/slice_error.test.py
index 0ae06f1f23c..b2032cd4d18 100644
--- a/tests/gold_tests/pluginTest/slice/slice_error.test.py
+++ b/tests/gold_tests/pluginTest/slice/slice_error.test.py
@@ -20,7 +20,7 @@
Slice plugin error.log test
'''
-## Test description:
+# Test description:
# Preload the cache with the entire asset to be range requested.
# Reload remap rule with slice plugin
# Request content through the slice plugin
@@ -36,25 +36,25 @@
# Define ATS and configure
ts = Test.MakeATSProcess("ts", command="traffic_manager", select_ports=True)
-body = "the quick brown fox" # len 19
+body = "the quick brown fox" # len 19
# default root
request_header_chk = {"headers":
- "GET / HTTP/1.1\r\n" +
- "Host: www.example.com\r\n" +
- "Range: bytes=0-\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": "",
-}
+ "GET / HTTP/1.1\r\n" +
+ "Host: www.example.com\r\n" +
+ "Range: bytes=0-\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": "",
+ }
response_header_chk = {"headers":
- "HTTP/1.1 206 Partial Content\r\n" +
- "Connection: close\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": body,
-}
+ "HTTP/1.1 206 Partial Content\r\n" +
+ "Connection: close\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": body,
+ }
server.addResponse("sessionlog.json", request_header_chk, response_header_chk)
@@ -69,170 +69,170 @@
# Mismatch etag
request_header_etag0 = {"headers":
- "GET /etag HTTP/1.1\r\n" +
- "Host: www.example.com\r\n" +
- "Range: bytes={}\r\n".format(range0) +
- "X-Slicer-Info: full content request\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": "",
-}
+ "GET /etag HTTP/1.1\r\n" +
+ "Host: www.example.com\r\n" +
+ "Range: bytes={}\r\n".format(range0) +
+ "X-Slicer-Info: full content request\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": "",
+ }
response_header_etag0 = {"headers":
- "HTTP/1.1 206 Partial Content\r\n" +
- "Connection: close\r\n" +
- 'Etag: "etag0"\r\n' +
- "Content-Range: bytes {}/{}\r\n".format(range0, len(body)) +
- "Cache-Control: max-age=500\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": body0,
-}
+ "HTTP/1.1 206 Partial Content\r\n" +
+ "Connection: close\r\n" +
+ 'Etag: "etag0"\r\n' +
+ "Content-Range: bytes {}/{}\r\n".format(range0, len(body)) +
+ "Cache-Control: max-age=500\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": body0,
+ }
server.addResponse("sessionlog.json", request_header_etag0, response_header_etag0)
request_header_etag1 = {"headers":
- "GET /etag HTTP/1.1\r\n" +
- "Host: www.example.com\r\n" +
- "Range: bytes={}\r\n".format(range1) +
- "X-Slicer-Info: full content request\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": "",
-}
+ "GET /etag HTTP/1.1\r\n" +
+ "Host: www.example.com\r\n" +
+ "Range: bytes={}\r\n".format(range1) +
+ "X-Slicer-Info: full content request\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": "",
+ }
response_header_etag1 = {"headers":
- "HTTP/1.1 206 Partial Content\r\n" +
- "Connection: close\r\n" +
- 'Etag: "etag1"\r\n' +
- "Content-Range: bytes {}/{}\r\n".format(range1, len(body)) +
- "Cache-Control: max-age=500\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": body1,
-}
+ "HTTP/1.1 206 Partial Content\r\n" +
+ "Connection: close\r\n" +
+ 'Etag: "etag1"\r\n' +
+ "Content-Range: bytes {}/{}\r\n".format(range1, len(body)) +
+ "Cache-Control: max-age=500\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": body1,
+ }
server.addResponse("sessionlog.json", request_header_etag1, response_header_etag1)
# mismatch Last-Modified
request_header_lm0 = {"headers":
- "GET /lastmodified HTTP/1.1\r\n" +
- "Host: www.example.com\r\n" +
- "Range: bytes={}\r\n".format(range0) +
- "X-Slicer-Info: full content request\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": "",
-}
+ "GET /lastmodified HTTP/1.1\r\n" +
+ "Host: www.example.com\r\n" +
+ "Range: bytes={}\r\n".format(range0) +
+ "X-Slicer-Info: full content request\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": "",
+ }
response_header_lm0 = {"headers":
- "HTTP/1.1 206 Partial Content\r\n" +
- "Connection: close\r\n" +
- "Last-Modified: Tue, 08 May 2018 15:49:41 GMT\r\n" +
- "Content-Range: bytes {}/{}\r\n".format(range0, len(body)) +
- "Cache-Control: max-age=500\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": body0,
-}
+ "HTTP/1.1 206 Partial Content\r\n" +
+ "Connection: close\r\n" +
+ "Last-Modified: Tue, 08 May 2018 15:49:41 GMT\r\n" +
+ "Content-Range: bytes {}/{}\r\n".format(range0, len(body)) +
+ "Cache-Control: max-age=500\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": body0,
+ }
server.addResponse("sessionlog.json", request_header_lm0, response_header_lm0)
request_header_lm1 = {"headers":
- "GET /lastmodified HTTP/1.1\r\n" +
- "Host: www.example.com\r\n" +
- "Range: bytes={}\r\n".format(range1) +
- "X-Slicer-Info: full content request\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": "",
-}
+ "GET /lastmodified HTTP/1.1\r\n" +
+ "Host: www.example.com\r\n" +
+ "Range: bytes={}\r\n".format(range1) +
+ "X-Slicer-Info: full content request\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": "",
+ }
response_header_lm1 = {"headers":
- "HTTP/1.1 206 Partial Content\r\n" +
- "Connection: close\r\n" +
- "Last-Modified: Tue, 08 Apr 2019 18:00:00 GMT\r\n" +
- "Content-Range: bytes {}/{}\r\n".format(range1, len(body)) +
- "Cache-Control: max-age=500\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": body1,
-}
+ "HTTP/1.1 206 Partial Content\r\n" +
+ "Connection: close\r\n" +
+ "Last-Modified: Tue, 08 Apr 2019 18:00:00 GMT\r\n" +
+ "Content-Range: bytes {}/{}\r\n".format(range1, len(body)) +
+ "Cache-Control: max-age=500\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": body1,
+ }
server.addResponse("sessionlog.json", request_header_lm1, response_header_lm1)
# non 206 slice block
request_header_n206_0 = {"headers":
- "GET /non206 HTTP/1.1\r\n" +
- "Host: www.example.com\r\n" +
- "Range: bytes={}\r\n".format(range0) +
- "X-Slicer-Info: full content request\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": "",
-}
+ "GET /non206 HTTP/1.1\r\n" +
+ "Host: www.example.com\r\n" +
+ "Range: bytes={}\r\n".format(range0) +
+ "X-Slicer-Info: full content request\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": "",
+ }
response_header_n206_0 = {"headers":
- "HTTP/1.1 206 Partial Content\r\n" +
- "Connection: close\r\n" +
- 'Etag: "etag"\r\n' +
- "Last-Modified: Tue, 08 May 2018 15:49:41 GMT\r\n" +
- "Content-Range: bytes {}/{}\r\n".format(range0, len(body)) +
- "Cache-Control: max-age=500\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": body0,
-}
+ "HTTP/1.1 206 Partial Content\r\n" +
+ "Connection: close\r\n" +
+ 'Etag: "etag"\r\n' +
+ "Last-Modified: Tue, 08 May 2018 15:49:41 GMT\r\n" +
+ "Content-Range: bytes {}/{}\r\n".format(range0, len(body)) +
+ "Cache-Control: max-age=500\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": body0,
+ }
server.addResponse("sessionlog.json", request_header_n206_0, response_header_n206_0)
# mismatch content-range
request_header_crr0 = {"headers":
- "GET /crr HTTP/1.1\r\n" +
- "Host: www.example.com\r\n" +
- "Range: bytes={}\r\n".format(range0) +
- "X-Slicer-Info: full content request\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": "",
-}
+ "GET /crr HTTP/1.1\r\n" +
+ "Host: www.example.com\r\n" +
+ "Range: bytes={}\r\n".format(range0) +
+ "X-Slicer-Info: full content request\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": "",
+ }
response_header_crr0 = {"headers":
- "HTTP/1.1 206 Partial Content\r\n" +
- "Connection: close\r\n" +
- "Etag: crr\r\n" +
- "Content-Range: bytes {}/{}\r\n".format(range0, len(body)) +
- "Cache-Control: max-age=500\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": body0,
-}
+ "HTTP/1.1 206 Partial Content\r\n" +
+ "Connection: close\r\n" +
+ "Etag: crr\r\n" +
+ "Content-Range: bytes {}/{}\r\n".format(range0, len(body)) +
+ "Cache-Control: max-age=500\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": body0,
+ }
server.addResponse("sessionlog.json", request_header_crr0, response_header_crr0)
request_header_crr1 = {"headers":
- "GET /crr HTTP/1.1\r\n" +
- "Host: www.example.com\r\n" +
- "Range: bytes={}\r\n".format(range1) +
- "X-Slicer-Info: full content request\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": "",
-}
+ "GET /crr HTTP/1.1\r\n" +
+ "Host: www.example.com\r\n" +
+ "Range: bytes={}\r\n".format(range1) +
+ "X-Slicer-Info: full content request\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": "",
+ }
response_header_crr1 = {"headers":
- "HTTP/1.1 206 Partial Content\r\n" +
- "Connection: close\r\n" +
- "Etag: crr\r\n" +
- "Content-Range: bytes {}/{}\r\n".format(range1, len(body) - 1) +
- "Cache-Control: max-age=500\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": body1,
-}
+ "HTTP/1.1 206 Partial Content\r\n" +
+ "Connection: close\r\n" +
+ "Etag: crr\r\n" +
+ "Content-Range: bytes {}/{}\r\n".format(range1, len(body) - 1) +
+ "Cache-Control: max-age=500\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": body1,
+ }
server.addResponse("sessionlog.json", request_header_crr1, response_header_crr1)
@@ -241,27 +241,31 @@
# set up whole asset fetch into cache
ts.Disk.remap_config.AddLine(
- 'map / http://127.0.0.1:{}'.format(server.Variables.Port) +
+ 'map / http://127.0.0.1:{}'.format(server.Variables.Port) +
' @plugin=slice.so @pparam=--blockbytes-test={}'.format(blockbytes)
)
# minimal configuration
ts.Disk.records_config.update({
- 'proxy.config.diags.debug.enabled': 0,
- 'proxy.config.diags.debug.tags': 'slice',
- 'proxy.config.http.cache.http': 0,
- 'proxy.config.http.wait_for_cache': 0,
- 'proxy.config.http.insert_age_in_response': 0,
- 'proxy.config.http.insert_request_via_str': 0,
- 'proxy.config.http.insert_response_via_str': 3,
+ 'proxy.config.diags.debug.enabled': 0,
+ 'proxy.config.diags.debug.tags': 'slice',
+ 'proxy.config.http.cache.http': 0,
+ 'proxy.config.http.wait_for_cache': 0,
+ 'proxy.config.http.insert_age_in_response': 0,
+ 'proxy.config.http.insert_request_via_str': 0,
+ 'proxy.config.http.insert_response_via_str': 3,
})
# Override builtin error check as these cases will fail
# taken from the slice plug code
ts.Disk.diags_log.Content = Testers.ContainsExpression('reason="Mismatch block Etag"', "Mismatch block etag")
ts.Disk.diags_log.Content += Testers.ContainsExpression('reason="Mismatch block Last-Modified"', "Mismatch block Last-Modified")
-ts.Disk.diags_log.Content += Testers.ContainsExpression('reason="Non 206 internal block response"', "Non 206 internal block response")
-ts.Disk.diags_log.Content += Testers.ContainsExpression('reason="Mismatch/Bad block Content-Range"', "Mismatch/Bad block Content-Range")
+ts.Disk.diags_log.Content += Testers.ContainsExpression(
+ 'reason="Non 206 internal block response"',
+ "Non 206 internal block response")
+ts.Disk.diags_log.Content += Testers.ContainsExpression(
+ 'reason="Mismatch/Bad block Content-Range"',
+ "Mismatch/Bad block Content-Range")
# 0 Test - Etag mismatch test
tr = Test.AddTestRun("Etag test")
diff --git a/tests/gold_tests/pluginTest/slice/slice_regex.test.py b/tests/gold_tests/pluginTest/slice/slice_regex.test.py
index f1a14b52952..366fee3a38c 100644
--- a/tests/gold_tests/pluginTest/slice/slice_regex.test.py
+++ b/tests/gold_tests/pluginTest/slice/slice_regex.test.py
@@ -20,7 +20,7 @@
slice regex plugin test
'''
-## Test description:
+# Test description:
# Preload the cache with the entire asset to be range requested.
# Reload remap rule with slice plugin
# Request content through the slice plugin
@@ -38,20 +38,20 @@
# default root
request_header_chk = {"headers":
- "GET / HTTP/1.1\r\n" +
- "Host: www.example.com\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": "",
-}
+ "GET / HTTP/1.1\r\n" +
+ "Host: www.example.com\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": "",
+ }
response_header_chk = {"headers":
- "HTTP/1.1 200 OK\r\n" +
- "Connection: close\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": "",
-}
+ "HTTP/1.1 200 OK\r\n" +
+ "Connection: close\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": "",
+ }
server.addResponse("sessionlog.json", request_header_chk, response_header_chk)
@@ -59,46 +59,46 @@
body = "lets go surfin now"
request_header_txt = {"headers":
- "GET /slice.txt HTTP/1.1\r\n" +
- "Host: slice\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": "",
-}
+ "GET /slice.txt HTTP/1.1\r\n" +
+ "Host: slice\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": "",
+ }
response_header_txt = {"headers":
- "HTTP/1.1 200 OK\r\n" +
- "Connection: close\r\n" +
- 'Etag: "path"\r\n' +
- "Cache-Control: max-age=500\r\n" +
- "X-Info: notsliced\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": body,
-}
+ "HTTP/1.1 200 OK\r\n" +
+ "Connection: close\r\n" +
+ 'Etag: "path"\r\n' +
+ "Cache-Control: max-age=500\r\n" +
+ "X-Info: notsliced\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": body,
+ }
server.addResponse("sessionlog.json", request_header_txt, response_header_txt)
request_header_mp4 = {"headers":
- "GET /slice.mp4 HTTP/1.1\r\n" +
- "Host: sliced\r\n" +
- "Range: bytes=0-99\r\n"
- "\r\n",
- "timestamp": "1469733493.993",
- "body": "",
-}
+ "GET /slice.mp4 HTTP/1.1\r\n" +
+ "Host: sliced\r\n" +
+ "Range: bytes=0-99\r\n"
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": "",
+ }
response_header_mp4 = {"headers":
- "HTTP/1.1 206 Partial Content\r\n" +
- "Connection: close\r\n" +
- 'Etag: "path"\r\n' +
- "Content-Range: bytes 0-{}/{}\r\n".format(len(body) - 1, len(body)) +
- "Cache-Control: max-age=500\r\n" +
- "X-Info: sliced\r\n" +
- "\r\n",
- "timestamp": "1469733493.993",
- "body": body,
-}
+ "HTTP/1.1 206 Partial Content\r\n" +
+ "Connection: close\r\n" +
+ 'Etag: "path"\r\n' +
+ "Content-Range: bytes 0-{}/{}\r\n".format(len(body) - 1, len(body)) +
+ "Cache-Control: max-age=500\r\n" +
+ "X-Info: sliced\r\n" +
+ "\r\n",
+ "timestamp": "1469733493.993",
+ "body": body,
+ }
server.addResponse("sessionlog.json", request_header_mp4, response_header_mp4)
@@ -108,28 +108,28 @@
# set up whole asset fetch into cache
ts.Disk.remap_config.AddLines([
- 'map http://exclude/ http://127.0.0.1:{}/'.format(server.Variables.Port) +
+ 'map http://exclude/ http://127.0.0.1:{}/'.format(server.Variables.Port) +
' @plugin=slice.so' +
- ' @pparam=--blockbytes-test={}'.format(block_bytes) +
- ' @pparam=--exclude-regex=\\.txt'
- ' @pparam=--remap-host=sliced',
- 'map http://include/ http://127.0.0.1:{}/'.format(server.Variables.Port) +
+ ' @pparam=--blockbytes-test={}'.format(block_bytes) +
+ ' @pparam=--exclude-regex=\\.txt'
+ ' @pparam=--remap-host=sliced',
+ 'map http://include/ http://127.0.0.1:{}/'.format(server.Variables.Port) +
' @plugin=slice.so' +
- ' @pparam=--blockbytes-test={}'.format(block_bytes) +
- ' @pparam=--include-regex=\\.mp4'
- ' @pparam=--remap-host=sliced',
- 'map http://sliced/ http://127.0.0.1:{}/'.format(server.Variables.Port),
+ ' @pparam=--blockbytes-test={}'.format(block_bytes) +
+ ' @pparam=--include-regex=\\.mp4'
+ ' @pparam=--remap-host=sliced',
+ 'map http://sliced/ http://127.0.0.1:{}/'.format(server.Variables.Port),
])
# minimal configuration
ts.Disk.records_config.update({
- 'proxy.config.diags.debug.enabled': 1,
- 'proxy.config.diags.debug.tags': 'slice',
- 'proxy.config.http.cache.http': 0,
- 'proxy.config.http.wait_for_cache': 0,
- 'proxy.config.http.insert_age_in_response': 0,
- 'proxy.config.http.response_via_str': 0,
+ 'proxy.config.diags.debug.enabled': 1,
+ 'proxy.config.diags.debug.tags': 'slice',
+ 'proxy.config.http.cache.http': 0,
+ 'proxy.config.http.wait_for_cache': 0,
+ 'proxy.config.http.insert_age_in_response': 0,
+ 'proxy.config.http.response_via_str': 0,
})
# 0 Test - Exclude: ensure txt passes through
diff --git a/tests/gold_tests/pluginTest/sslheaders/observer.py b/tests/gold_tests/pluginTest/sslheaders/observer.py
index 673a56eb1a2..93fce3c7789 100644
--- a/tests/gold_tests/pluginTest/sslheaders/observer.py
+++ b/tests/gold_tests/pluginTest/sslheaders/observer.py
@@ -19,13 +19,15 @@
log = open('sslheaders.log', 'w')
+
def observe(headers):
for h in headers.items():
if h[0].lower().startswith('ssl-'):
- log.write(h[0] + ": " + h[1] + "\n");
+ log.write(h[0] + ": " + h[1] + "\n")
log.write("-\n")
log.flush()
+
Hooks.register(Hooks.ReadRequestHook, observe)
diff --git a/tests/gold_tests/pluginTest/sslheaders/sslheaders.test.py b/tests/gold_tests/pluginTest/sslheaders/sslheaders.test.py
index 6f4d7df3e32..2ad458f61e8 100644
--- a/tests/gold_tests/pluginTest/sslheaders/sslheaders.test.py
+++ b/tests/gold_tests/pluginTest/sslheaders/sslheaders.test.py
@@ -50,12 +50,12 @@
'proxy.config.http.server_ports': (
'ipv4:{0} ipv4:{1}:proto=http2;http:ssl ipv6:{0} ipv6:{1}:proto=http2;http:ssl'
.format(ts.Variables.port, ts.Variables.ssl_port)),
-# 'proxy.config.ssl.client.verify.server': 0,
-# 'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
-# 'proxy.config.url_remap.pristine_host_hdr' : 1,
-# 'proxy.config.ssl.client.certification_level': 2,
-# 'proxy.config.ssl.CA.cert.filename': '{0}/signer.pem'.format(ts.Variables.SSLDir),
-# 'proxy.config.ssl.TLSv1_3': 0
+ # 'proxy.config.ssl.client.verify.server': 0,
+ # 'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
+ # 'proxy.config.url_remap.pristine_host_hdr' : 1,
+ # 'proxy.config.ssl.client.certification_level': 2,
+ # 'proxy.config.ssl.CA.cert.filename': '{0}/signer.pem'.format(ts.Variables.SSLDir),
+ # 'proxy.config.ssl.TLSv1_3': 0
})
ts.Disk.ssl_multicert_config.AddLine(
diff --git a/tests/gold_tests/pluginTest/test_hooks/hook_add.test.py b/tests/gold_tests/pluginTest/test_hooks/hook_add.test.py
index c5caaceed1e..5490e83b87a 100644
--- a/tests/gold_tests/pluginTest/test_hooks/hook_add.test.py
+++ b/tests/gold_tests/pluginTest/test_hooks/hook_add.test.py
@@ -23,8 +23,8 @@
server = Test.MakeOriginServer("server")
request_header = {
- "headers": "GET /argh HTTP/1.1\r\nHost: doesnotmatter\r\n\r\n", "timestamp": "1469733493.993", "body": "" }
-response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": "" }
+ "headers": "GET /argh HTTP/1.1\r\nHost: doesnotmatter\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
server.addResponse("sessionlog.json", request_header, response_header)
ts = Test.MakeATSProcess("ts", select_ports=True, enable_tls=False)
diff --git a/tests/gold_tests/pluginTest/test_hooks/test_hooks.test.py b/tests/gold_tests/pluginTest/test_hooks/test_hooks.test.py
index 4fc911d0c15..c56f0f22988 100644
--- a/tests/gold_tests/pluginTest/test_hooks/test_hooks.test.py
+++ b/tests/gold_tests/pluginTest/test_hooks/test_hooks.test.py
@@ -29,8 +29,8 @@
server = Test.MakeOriginServer("server")
request_header = {
- "headers": "GET /argh HTTP/1.1\r\nHost: doesnotmatter\r\n\r\n", "timestamp": "1469733493.993", "body": "" }
-response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": "" }
+ "headers": "GET /argh HTTP/1.1\r\nHost: doesnotmatter\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
server.addResponse("sessionlog.json", request_header, response_header)
ts = Test.MakeATSProcess("ts", select_ports=True, enable_tls=True)
diff --git a/tests/gold_tests/pluginTest/traffic_dump/traffic_dump.test.py b/tests/gold_tests/pluginTest/traffic_dump/traffic_dump.test.py
index 7ba42f2384c..7ca1ef0df2a 100644
--- a/tests/gold_tests/pluginTest/traffic_dump/traffic_dump.test.py
+++ b/tests/gold_tests/pluginTest/traffic_dump/traffic_dump.test.py
@@ -115,17 +115,17 @@
# Set up trafficserver expectations.
ts.Disk.diags_log.Content = Testers.ContainsExpression(
- "loading plugin.*traffic_dump.so",
- "Verify the traffic_dump plugin got loaded.")
+ "loading plugin.*traffic_dump.so",
+ "Verify the traffic_dump plugin got loaded.")
ts.Streams.stderr = Testers.ContainsExpression(
- "Initialized with log directory: {0}".format(replay_dir),
- "Verify traffic_dump initialized with the configured directory.")
+ "Initialized with log directory: {0}".format(replay_dir),
+ "Verify traffic_dump initialized with the configured directory.")
ts.Streams.stderr += Testers.ContainsExpression(
- "Initialized with sample pool size 1 bytes and disk limit 1000000000 bytes",
- "Verify traffic_dump initialized with the configured disk limit.")
+ "Initialized with sample pool size 1 bytes and disk limit 1000000000 bytes",
+ "Verify traffic_dump initialized with the configured disk limit.")
ts.Streams.stderr += Testers.ContainsExpression(
- "Finish a session with log file of.*bytes",
- "Verify traffic_dump sees the end of sessions and accounts for it.")
+ "Finish a session with log file of.*bytes",
+ "Verify traffic_dump sees the end of sessions and accounts for it.")
# Set up the json replay file expectations.
replay_file_session_1 = os.path.join(replay_dir, "127", "0000000000000000")
@@ -153,9 +153,9 @@
tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port))
tr.Processes.Default.StartBefore(Test.Processes.ts)
tr.Processes.Default.Command = \
- ('curl --http1.1 http://127.0.0.1:{0}/one -H"Cookie: donotlogthis" '
- '-H"Host: www.example.com" -H"X-Request-1: ultra_sensitive" --verbose'.format(
- ts.Variables.port))
+ ('curl --http1.1 http://127.0.0.1:{0}/one -H"Cookie: donotlogthis" '
+ '-H"Host: www.example.com" -H"X-Request-1: ultra_sensitive" --verbose'.format(
+ ts.Variables.port))
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stderr = "gold/200.gold"
tr.StillRunningAfter = server
@@ -165,9 +165,9 @@
# Execute the second transaction.
tr = Test.AddTestRun("Second transaction")
tr.Processes.Default.Command = \
- ('curl http://127.0.0.1:{0}/two -H"Host: www.example.com" '
- '-H"X-Request-2: also_very_sensitive" --verbose'.format(
- ts.Variables.port))
+ ('curl http://127.0.0.1:{0}/two -H"Host: www.example.com" '
+ '-H"X-Request-2: also_very_sensitive" --verbose'.format(
+ ts.Variables.port))
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stderr = "gold/200.gold"
tr.StillRunningAfter = server
@@ -177,17 +177,17 @@
tr = Test.AddTestRun("Verify the json content of the first session")
verify_replay = "verify_replay.py"
sensitive_fields_arg = (
- "--sensitive-fields cookie "
- "--sensitive-fields set-cookie "
- "--sensitive-fields x-request-1 "
- "--sensitive-fields x-request-2 ")
+ "--sensitive-fields cookie "
+ "--sensitive-fields set-cookie "
+ "--sensitive-fields x-request-1 "
+ "--sensitive-fields x-request-2 ")
tr.Setup.CopyAs(verify_replay, Test.RunDirectory)
tr.Processes.Default.Command = 'python3 {0} {1} {2} {3} --client-protocols "{4}"'.format(
- verify_replay,
- os.path.join(Test.Variables.AtsTestToolsDir, 'lib', 'replay_schema.json'),
- replay_file_session_1,
- sensitive_fields_arg,
- http_protocols)
+ verify_replay,
+ os.path.join(Test.Variables.AtsTestToolsDir, 'lib', 'replay_schema.json'),
+ replay_file_session_1,
+ sensitive_fields_arg,
+ http_protocols)
tr.Processes.Default.ReturnCode = 0
tr.StillRunningAfter = server
tr.StillRunningAfter = ts
@@ -196,10 +196,10 @@
tr = Test.AddTestRun("Verify the json content of the second session")
tr.Setup.CopyAs(verify_replay, Test.RunDirectory)
tr.Processes.Default.Command = "python3 {0} {1} {2} {3} --request-target '/two'".format(
- verify_replay,
- os.path.join(Test.Variables.AtsTestToolsDir, 'lib', 'replay_schema.json'),
- replay_file_session_2,
- sensitive_fields_arg)
+ verify_replay,
+ os.path.join(Test.Variables.AtsTestToolsDir, 'lib', 'replay_schema.json'),
+ replay_file_session_2,
+ sensitive_fields_arg)
tr.Processes.Default.ReturnCode = 0
tr.StillRunningAfter = server
tr.StillRunningAfter = ts
@@ -212,9 +212,9 @@
tr = Test.AddTestRun("Make a request with an explicit target.")
request_target = "http://localhost:{0}/candy".format(ts.Variables.port)
tr.Processes.Default.Command = (
- 'curl --request-target "{0}" '
- 'http://127.0.0.1:{1}/three -H"Host: www.example.com" --verbose'.format(
- request_target, ts.Variables.port))
+ 'curl --request-target "{0}" '
+ 'http://127.0.0.1:{1}/three -H"Host: www.example.com" --verbose'.format(
+ request_target, ts.Variables.port))
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stderr = "gold/explicit_target.gold"
tr.StillRunningAfter = server
@@ -224,11 +224,11 @@
tr.Setup.CopyAs(verify_replay, Test.RunDirectory)
tr.Processes.Default.Command = "python3 {0} {1} {2} {3} --request-target '{4}'".format(
- verify_replay,
- os.path.join(Test.Variables.AtsTestToolsDir, 'lib', 'replay_schema.json'),
- replay_file_session_3,
- sensitive_fields_arg,
- request_target)
+ verify_replay,
+ os.path.join(Test.Variables.AtsTestToolsDir, 'lib', 'replay_schema.json'),
+ replay_file_session_3,
+ sensitive_fields_arg,
+ request_target)
tr.Processes.Default.ReturnCode = 0
tr.StillRunningAfter = server
tr.StillRunningAfter = ts
@@ -243,9 +243,9 @@
# Send the replay file as the request body because it is conveniently already
# in the test run directory.
tr.Processes.Default.Command = (
- 'curl --data-binary @{0} --request-target "{1}" '
- 'http://127.0.0.1:{2} -H"Host: www.example.com" --verbose'.format(
- verify_replay, request_target, ts.Variables.port))
+ 'curl --data-binary @{0} --request-target "{1}" '
+ 'http://127.0.0.1:{2} -H"Host: www.example.com" --verbose'.format(
+ verify_replay, request_target, ts.Variables.port))
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stderr = "gold/post_with_body.gold"
tr.StillRunningAfter = server
@@ -256,12 +256,12 @@
size_of_verify_replay_file = os.path.getsize(os.path.join(Test.TestDirectory, verify_replay))
tr.Processes.Default.Command = \
- "python3 {0} {1} {2} {3} --client-request-size {4}".format(
- verify_replay,
- os.path.join(Test.Variables.AtsTestToolsDir, 'lib', 'replay_schema.json'),
- replay_file_session_4,
- sensitive_fields_arg,
- size_of_verify_replay_file)
+ "python3 {0} {1} {2} {3} --client-request-size {4}".format(
+ verify_replay,
+ os.path.join(Test.Variables.AtsTestToolsDir, 'lib', 'replay_schema.json'),
+ replay_file_session_4,
+ sensitive_fields_arg,
+ size_of_verify_replay_file)
tr.Processes.Default.ReturnCode = 0
tr.StillRunningAfter = server
tr.StillRunningAfter = ts
@@ -271,8 +271,8 @@
#
tr = Test.AddTestRun("Make a request for an uncached object.")
tr.Processes.Default.Command = \
- ('curl --http1.1 http://127.0.0.1:{0}/cache_test -H"Host: www.example.com" --verbose'.format(
- ts.Variables.port))
+ ('curl --http1.1 http://127.0.0.1:{0}/cache_test -H"Host: www.example.com" --verbose'.format(
+ ts.Variables.port))
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stderr = "gold/4_byte_response_body.gold"
tr.StillRunningAfter = server
@@ -280,8 +280,8 @@
tr = Test.AddTestRun("Repeat the previous request: should be cached now.")
tr.Processes.Default.Command = \
- ('curl --http1.1 http://127.0.0.1:{0}/cache_test -H"Host: www.example.com" --verbose'.format(
- ts.Variables.port))
+ ('curl --http1.1 http://127.0.0.1:{0}/cache_test -H"Host: www.example.com" --verbose'.format(
+ ts.Variables.port))
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stderr = "gold/4_byte_response_body.gold"
tr.StillRunningAfter = server
@@ -290,10 +290,10 @@
tr = Test.AddTestRun("Verify that the cached response's replay file looks appropriate.")
tr.Setup.CopyAs(verify_replay, Test.RunDirectory)
tr.Processes.Default.Command = 'python3 {0} {1} {2} --client-protocols "{3}"'.format(
- verify_replay,
- os.path.join(Test.Variables.AtsTestToolsDir, 'lib', 'replay_schema.json'),
- replay_file_session_6,
- http_protocols)
+ verify_replay,
+ os.path.join(Test.Variables.AtsTestToolsDir, 'lib', 'replay_schema.json'),
+ replay_file_session_6,
+ http_protocols)
tr.Processes.Default.ReturnCode = 0
tr.StillRunningAfter = server
tr.StillRunningAfter = ts
@@ -303,8 +303,8 @@
#
tr = Test.AddTestRun("Conduct two transactions in the same session.")
tr.Processes.Default.Command = \
- ('curl --http1.1 http://127.0.0.1:{0}/first -H"Host: www.example.com" --verbose --next '
- 'curl --http1.1 http://127.0.0.1:{0}/second -H"Host: www.example.com" --verbose'
+ ('curl --http1.1 http://127.0.0.1:{0}/first -H"Host: www.example.com" --verbose --next '
+ 'curl --http1.1 http://127.0.0.1:{0}/second -H"Host: www.example.com" --verbose'
.format(ts.Variables.port))
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stderr = "gold/two_transactions.gold"
@@ -314,10 +314,10 @@
tr = Test.AddTestRun("Verify that the dump file can be read.")
tr.Setup.CopyAs(verify_replay, Test.RunDirectory)
tr.Processes.Default.Command = 'python3 {0} {1} {2} --client-protocols "{3}"'.format(
- verify_replay,
- os.path.join(Test.Variables.AtsTestToolsDir, 'lib', 'replay_schema.json'),
- replay_file_session_7,
- http_protocols)
+ verify_replay,
+ os.path.join(Test.Variables.AtsTestToolsDir, 'lib', 'replay_schema.json'),
+ replay_file_session_7,
+ http_protocols)
tr.Processes.Default.ReturnCode = 0
tr.StillRunningAfter = server
tr.StillRunningAfter = ts
diff --git a/tests/gold_tests/pluginTest/traffic_dump/traffic_dump_sni_filter.test.py b/tests/gold_tests/pluginTest/traffic_dump/traffic_dump_sni_filter.test.py
index 4e269f20dd2..5d1d01b8f76 100644
--- a/tests/gold_tests/pluginTest/traffic_dump/traffic_dump_sni_filter.test.py
+++ b/tests/gold_tests/pluginTest/traffic_dump/traffic_dump_sni_filter.test.py
@@ -52,7 +52,7 @@
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.url_remap.pristine_host_hdr': 1,
'proxy.config.ssl.CA.cert.filename': '{0}/signer.pem'.format(ts.Variables.SSLDir),
'proxy.config.exec_thread.autoconfig.scale': 1.0,
@@ -86,12 +86,12 @@
# Set up trafficserver expectations.
ts.Streams.stderr += Testers.ContainsExpression(
- "Filtering to only dump connections with SNI: {}".format(sni_filter),
- "Verify filtering for the expected SNI.")
+ "Filtering to only dump connections with SNI: {}".format(sni_filter),
+ "Verify filtering for the expected SNI.")
ts.Streams.stderr += Testers.ContainsExpression(
- "Ignore HTTPS session with non-filtered SNI: dave",
- "Verify that the non-desired SNI session was filtered out.")
+ "Ignore HTTPS session with non-filtered SNI: dave",
+ "Verify that the non-desired SNI session was filtered out.")
# Set up the json replay file expectations.
replay_file_session_1 = os.path.join(replay_dir, "127", "0000000000000000")
@@ -119,8 +119,8 @@
tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port))
tr.Processes.Default.StartBefore(Test.Processes.ts)
tr.Processes.Default.Command = \
- ('curl --http2 --tls-max 1.2 -k -H"Host: bob" --resolve "bob:{0}:127.0.0.1" '
- '--cert ./signed-foo.pem --key ./signed-foo.key --verbose https://bob:{0}'.format(ts.Variables.ssl_port))
+ ('curl --http2 --tls-max 1.2 -k -H"Host: bob" --resolve "bob:{0}:127.0.0.1" '
+ '--cert ./signed-foo.pem --key ./signed-foo.key --verbose https://bob:{0}'.format(ts.Variables.ssl_port))
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stderr = "gold/200_sni_bob.gold"
tr.StillRunningAfter = server
@@ -131,8 +131,8 @@
# Execute the second transaction with an SNI of dave.
tr = Test.AddTestRun("Verify that a session of a different SNI is not dumped.")
tr.Processes.Default.Command = \
- ('curl --tls-max 1.2 -k -H"Host: dave" --resolve "dave:{0}:127.0.0.1" '
- '--cert ./signed-foo.pem --key ./signed-foo.key --verbose https://dave:{0}'.format(ts.Variables.ssl_port))
+ ('curl --tls-max 1.2 -k -H"Host: dave" --resolve "dave:{0}:127.0.0.1" '
+ '--cert ./signed-foo.pem --key ./signed-foo.key --verbose https://dave:{0}'.format(ts.Variables.ssl_port))
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stderr = "gold/200_sni_dave.gold"
tr.StillRunningAfter = server
@@ -141,8 +141,8 @@
# Execute the third transaction without any SNI.
tr = Test.AddTestRun("Verify that a session of a non-existent SNI is not dumped.")
tr.Processes.Default.Command = \
- ('curl --tls-max 1.2 -k -H"Host: bob"'
- '--cert ./signed-foo.pem --key ./signed-foo.key --verbose https://127.0.0.1:{0}'.format(ts.Variables.ssl_port))
+ ('curl --tls-max 1.2 -k -H"Host: bob"'
+ '--cert ./signed-foo.pem --key ./signed-foo.key --verbose https://127.0.0.1:{0}'.format(ts.Variables.ssl_port))
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stderr = "gold/200_bob_no_sni.gold"
tr.StillRunningAfter = server
@@ -153,11 +153,11 @@
verify_replay = "verify_replay.py"
tr.Setup.CopyAs(verify_replay, Test.RunDirectory)
tr.Processes.Default.Command = 'python3 {0} {1} {2} --client-protocols "{3}" --client-tls-features "{4}"'.format(
- verify_replay,
- os.path.join(Test.Variables.AtsTestToolsDir, 'lib', 'replay_schema.json'),
- replay_file_session_1,
- session_1_protocols,
- session_1_tls_features)
+ verify_replay,
+ os.path.join(Test.Variables.AtsTestToolsDir, 'lib', 'replay_schema.json'),
+ replay_file_session_1,
+ session_1_protocols,
+ session_1_tls_features)
tr.Processes.Default.ReturnCode = 0
tr.StillRunningAfter = server
tr.StillRunningAfter = ts
diff --git a/tests/gold_tests/pluginTest/traffic_dump/verify_replay.py b/tests/gold_tests/pluginTest/traffic_dump/verify_replay.py
index e48819ce119..a2260b191f0 100644
--- a/tests/gold_tests/pluginTest/traffic_dump/verify_replay.py
+++ b/tests/gold_tests/pluginTest/traffic_dump/verify_replay.py
@@ -140,12 +140,10 @@ def verify_sensitive_fields_not_dumped(replay_json, sensitive_fields):
def verify_client_protocols(replay_json, expected_protocol_features):
- expected_protocols_list = expected_protocol_features.split(',')
- expected_protocols_list.sort()
+ expected_protocols_list = sorted(expected_protocol_features.split(','))
try:
protocol_node = replay_json['sessions'][0]['protocol']
- protocol_list = protocol_node.copy()
- protocol_list.sort()
+ protocol_list = sorted(protocol_node.copy())
if protocol_list == expected_protocols_list:
return True
else:
diff --git a/tests/gold_tests/pluginTest/tsapi/tsapi.test.py b/tests/gold_tests/pluginTest/tsapi/tsapi.test.py
index 65d07118eac..c8466b0daea 100644
--- a/tests/gold_tests/pluginTest/tsapi/tsapi.test.py
+++ b/tests/gold_tests/pluginTest/tsapi/tsapi.test.py
@@ -29,8 +29,8 @@
server = Test.MakeOriginServer("server")
request_header = {
- "headers": "GET / HTTP/1.1\r\nHost: doesnotmatter\r\n\r\n", "timestamp": "1469733493.993", "body": "" }
-response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": "112233" }
+ "headers": "GET / HTTP/1.1\r\nHost: doesnotmatter\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
+response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": "112233"}
server.addResponse("sessionlog.json", request_header, response_header)
ts = Test.MakeATSProcess("ts", select_ports=True, enable_tls=True)
diff --git a/tests/gold_tests/pluginTest/uri_signing/uri_signing.test.py b/tests/gold_tests/pluginTest/uri_signing/uri_signing.test.py
index bdb4686498b..3aa1aed2f70 100644
--- a/tests/gold_tests/pluginTest/uri_signing/uri_signing.test.py
+++ b/tests/gold_tests/pluginTest/uri_signing/uri_signing.test.py
@@ -30,43 +30,43 @@
server = Test.MakeOriginServer("server")
# Default origin test
-req_header = { "headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
- "timestamp": "1469733493.993",
- "body": "",
-}
-res_header = { "headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n",
- "timestamp": "1469733493.993",
- "body": "",
-}
+req_header = {"headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": "",
+ }
+res_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": "",
+ }
server.addResponse("sessionfile.log", req_header, res_header)
# Test case for normal
-req_header = { "headers":
- "GET /someasset.ts HTTP/1.1\r\nHost: somehost\r\n\r\n",
- "timestamp": "1469733493.993",
- "body": "",
-}
-
-res_header = { "headers":
- "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n",
- "timestamp": "1469733493.993",
- "body": "somebody",
-}
+req_header = {"headers":
+ "GET /someasset.ts HTTP/1.1\r\nHost: somehost\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": "",
+ }
+
+res_header = {"headers":
+ "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": "somebody",
+ }
server.addResponse("sessionfile.log", req_header, res_header)
# Test case for crossdomain
-req_header = { "headers":
- "GET /crossdomain.xml HTTP/1.1\r\nHost: somehost\r\n\r\n",
- "timestamp": "1469733493.993",
- "body": "",
-}
-
-res_header = { "headers":
- "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n",
- "timestamp": "1469733493.993",
- "body": "",
-}
+req_header = {"headers":
+ "GET /crossdomain.xml HTTP/1.1\r\nHost: somehost\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": "",
+ }
+
+res_header = {"headers":
+ "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": "",
+ }
server.addResponse("sessionfile.log", req_header, res_header)
@@ -77,10 +77,10 @@
#ts = Test.MakeATSProcess("ts", "traffic_server_valgrind.sh")
ts.Disk.records_config.update({
- 'proxy.config.diags.debug.enabled': 1,
- 'proxy.config.diags.debug.tags': 'uri_signing|http',
-# 'proxy.config.diags.debug.tags': 'uri_signing',
- 'proxy.config.http.cache.http': 0, # No cache
+ 'proxy.config.diags.debug.enabled': 1,
+ 'proxy.config.diags.debug.tags': 'uri_signing|http',
+ # 'proxy.config.diags.debug.tags': 'uri_signing',
+ 'proxy.config.http.cache.http': 0, # No cache
})
# Use unchanged incoming URL.
diff --git a/tests/gold_tests/pluginTest/xdebug/x_remap/x_remap-observer.py b/tests/gold_tests/pluginTest/xdebug/x_remap/x_remap-observer.py
index 7de1b31be2d..7ff73b59695 100644
--- a/tests/gold_tests/pluginTest/xdebug/x_remap/x_remap-observer.py
+++ b/tests/gold_tests/pluginTest/xdebug/x_remap/x_remap-observer.py
@@ -19,6 +19,7 @@
log = open('x_remap.log', 'w')
+
def observe(headers):
seen = False
@@ -32,4 +33,5 @@ def observe(headers):
log.write("-\n")
log.flush()
+
Hooks.register(Hooks.ReadRequestHook, observe)
diff --git a/tests/gold_tests/pluginTest/xdebug/x_remap/x_remap.test.py b/tests/gold_tests/pluginTest/xdebug/x_remap/x_remap.test.py
index fff8b6920b9..f5ee5df0eea 100644
--- a/tests/gold_tests/pluginTest/xdebug/x_remap/x_remap.test.py
+++ b/tests/gold_tests/pluginTest/xdebug/x_remap/x_remap.test.py
@@ -21,7 +21,7 @@
server = Test.MakeOriginServer("server", options={'--load': (Test.TestDirectory + '/x_remap-observer.py')})
request_header = {
- "headers": "GET /argh HTTP/1.1\r\nHost: doesnotmatter\r\n\r\n", "timestamp": "1469733493.993", "body": "" }
+ "headers": "GET /argh HTTP/1.1\r\nHost: doesnotmatter\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n",
"timestamp": "1469733493.993", "body": ""}
server.addResponse("sessionlog.json", request_header, response_header)
@@ -54,6 +54,7 @@
Test.Variables.AtsTestToolsDir, Test.RunDirectory)
tr.Processes.Default.ReturnCode = 0
+
def sendMsg(msgFile):
tr = Test.AddTestRun()
@@ -65,6 +66,7 @@ def sendMsg(msgFile):
)
tr.Processes.Default.ReturnCode = 0
+
sendMsg('none')
sendMsg('one')
sendMsg('two')
diff --git a/tests/gold_tests/redirect/redirect.test.py b/tests/gold_tests/redirect/redirect.test.py
index 17ff76da6b8..06aff9fe71a 100644
--- a/tests/gold_tests/redirect/redirect.test.py
+++ b/tests/gold_tests/redirect/redirect.test.py
@@ -37,10 +37,10 @@
'proxy.config.dns.nameservers': '127.0.0.1:{0}'.format(dns.Variables.Port),
'proxy.config.dns.resolv_conf': 'NULL',
'proxy.config.url_remap.remap_required': 0, # need this so the domain gets a chance to be evaluated through DNS
- 'proxy.config.http.redirect.actions': 'self:follow', # redirects to self are not followed by default
+ 'proxy.config.http.redirect.actions': 'self:follow', # redirects to self are not followed by default
})
-Test.Setup.Copy(os.path.join(Test.Variables.AtsTestToolsDir,'tcp_client.py'))
+Test.Setup.Copy(os.path.join(Test.Variables.AtsTestToolsDir, 'tcp_client.py'))
redirect_request_header = {"headers": "GET /redirect HTTP/1.1\r\nHost: *\r\n\r\n", "timestamp": "5678", "body": ""}
redirect_response_header = {"headers": "HTTP/1.1 302 Found\r\nLocation: http://127.0.0.1:{0}/redirectDest\r\n\r\n".format(
@@ -62,7 +62,8 @@
# Here and below: because autest's Copy does not behave like standard cp, it's easiest to write all of our files out and copy last.
with open(os.path.join(data_path, tr.Name), 'w') as f:
f.write('GET /redirect HTTP/1.1\r\nHost: iwillredirect.test:{port}\r\n\r\n'.format(port=redirect_serv.Variables.Port))
-tr.Processes.Default.Command = "python3 tcp_client.py 127.0.0.1 {0} {1} | egrep -v '^(Date: |Server: ATS/)'".format(ts.Variables.port, os.path.join(data_dirname, tr.Name))
+tr.Processes.Default.Command = "python3 tcp_client.py 127.0.0.1 {0} {1} | egrep -v '^(Date: |Server: ATS/)'".format(
+ ts.Variables.port, os.path.join(data_dirname, tr.Name))
tr.Processes.Default.StartBefore(ts)
tr.Processes.Default.StartBefore(redirect_serv)
tr.Processes.Default.StartBefore(dest_serv)
@@ -71,7 +72,6 @@
tr.Processes.Default.ReturnCode = 0
-
redirect_request_header = {"headers": "GET /redirect-relative-path HTTP/1.1\r\nHost: *\r\n\r\n", "timestamp": "5678", "body": ""}
redirect_response_header = {"headers": "HTTP/1.1 302 Found\r\nLocation: /redirect\r\n\r\n", "timestamp": "5678", "body": ""}
redirect_serv.addResponse("sessionfile.log", redirect_request_header, redirect_response_header)
@@ -82,8 +82,10 @@
tr = Test.AddTestRun("FollowsRedirectWithRelativeLocationURI")
with open(os.path.join(data_path, tr.Name), 'w') as f:
- f.write('GET /redirect-relative-path HTTP/1.1\r\nHost: iwillredirect.test:{port}\r\n\r\n'.format(port=redirect_serv.Variables.Port))
-tr.Processes.Default.Command = "python3 tcp_client.py 127.0.0.1 {0} {1} | egrep -v '^(Date: |Server: ATS/)'".format(ts.Variables.port, os.path.join(data_dirname, tr.Name))
+ f.write(
+ 'GET /redirect-relative-path HTTP/1.1\r\nHost: iwillredirect.test:{port}\r\n\r\n'.format(port=redirect_serv.Variables.Port))
+tr.Processes.Default.Command = "python3 tcp_client.py 127.0.0.1 {0} {1} | egrep -v '^(Date: |Server: ATS/)'".format(
+ ts.Variables.port, os.path.join(data_dirname, tr.Name))
tr.StillRunningAfter = ts
tr.StillRunningAfter = redirect_serv
tr.StillRunningAfter = dest_serv
@@ -92,15 +94,17 @@
tr.Processes.Default.ReturnCode = 0
-
-redirect_request_header = {"headers": "GET /redirect-relative-path-no-leading-slash HTTP/1.1\r\nHost: *\r\n\r\n", "timestamp": "5678", "body": ""}
+redirect_request_header = {
+ "headers": "GET /redirect-relative-path-no-leading-slash HTTP/1.1\r\nHost: *\r\n\r\n", "timestamp": "5678", "body": ""}
redirect_response_header = {"headers": "HTTP/1.1 302 Found\r\nLocation: redirect\r\n\r\n", "timestamp": "5678", "body": ""}
redirect_serv.addResponse("sessionfile.log", redirect_request_header, redirect_response_header)
tr = Test.AddTestRun("FollowsRedirectWithRelativeLocationURIMissingLeadingSlash")
with open(os.path.join(data_path, tr.Name), 'w') as f:
- f.write('GET /redirect-relative-path-no-leading-slash HTTP/1.1\r\nHost: iwillredirect.test:{port}\r\n\r\n'.format(port=redirect_serv.Variables.Port))
-tr.Processes.Default.Command = "python3 tcp_client.py 127.0.0.1 {0} {1} | egrep -v '^(Date: |Server: ATS/)'".format(ts.Variables.port, os.path.join(data_dirname, tr.Name))
+ f.write(
+ 'GET /redirect-relative-path-no-leading-slash HTTP/1.1\r\nHost: iwillredirect.test:{port}\r\n\r\n'.format(port=redirect_serv.Variables.Port))
+tr.Processes.Default.Command = "python3 tcp_client.py 127.0.0.1 {0} {1} | egrep -v '^(Date: |Server: ATS/)'".format(
+ ts.Variables.port, os.path.join(data_dirname, tr.Name))
tr.StillRunningAfter = ts
tr.StillRunningAfter = redirect_serv
tr.StillRunningAfter = dest_serv
@@ -109,37 +113,37 @@
tr.Processes.Default.ReturnCode = 0
-for status,phrase in sorted({
- 301:'Moved Permanently',
- 302:'Found',
- 303:'See Other',
- 305:'Use Proxy',
- 307:'Temporary Redirect',
- 308:'Permanent Redirect',
- }.items()):
+for status, phrase in sorted({
+ 301: 'Moved Permanently',
+ 302: 'Found',
+ 303: 'See Other',
+ 305: 'Use Proxy',
+ 307: 'Temporary Redirect',
+ 308: 'Permanent Redirect',
+}.items()):
redirect_request_header = {
- "headers": ("GET /redirect{0} HTTP/1.1\r\n"
- "Host: *\r\n\r\n").\
- format(status),
- "timestamp": "5678",
- "body": ""}
+ "headers": ("GET /redirect{0} HTTP/1.1\r\n"
+ "Host: *\r\n\r\n").
+ format(status),
+ "timestamp": "5678",
+ "body": ""}
redirect_response_header = {
- "headers": ("HTTP/1.1 {0} {1}\r\n"
- "Connection: close\r\n"
- "Location: /redirect\r\n\r\n").\
- format(status, phrase),
- "timestamp": "5678",
- "body": ""}
+ "headers": ("HTTP/1.1 {0} {1}\r\n"
+ "Connection: close\r\n"
+ "Location: /redirect\r\n\r\n").
+ format(status, phrase),
+ "timestamp": "5678",
+ "body": ""}
redirect_serv.addResponse("sessionfile.log", redirect_request_header, redirect_response_header)
tr = Test.AddTestRun("FollowsRedirect{0}".format(status))
with open(os.path.join(data_path, tr.Name), 'w') as f:
f.write(('GET /redirect{0} HTTP/1.1\r\n'
- 'Host: iwillredirect.test:{1}\r\n\r\n').\
- format(status, redirect_serv.Variables.Port))
+ 'Host: iwillredirect.test:{1}\r\n\r\n').
+ format(status, redirect_serv.Variables.Port))
tr.Processes.Default.Command = "python3 tcp_client.py 127.0.0.1 {0} {1} | egrep -v '^(Date: |Server: ATS/)'".\
- format(ts.Variables.port, os.path.join(data_dirname, tr.Name))
+ format(ts.Variables.port, os.path.join(data_dirname, tr.Name))
tr.StillRunningAfter = ts
tr.StillRunningAfter = redirect_serv
tr.StillRunningAfter = dest_serv
diff --git a/tests/gold_tests/redirect/redirect_actions.test.py b/tests/gold_tests/redirect/redirect_actions.test.py
index 6603c27b544..8b8b93c2432 100644
--- a/tests/gold_tests/redirect/redirect_actions.test.py
+++ b/tests/gold_tests/redirect/redirect_actions.test.py
@@ -27,7 +27,7 @@
Test.ContinueOnFail = False
-Test.Setup.Copy(os.path.join(Test.Variables.AtsTestToolsDir,'tcp_client.py'))
+Test.Setup.Copy(os.path.join(Test.Variables.AtsTestToolsDir, 'tcp_client.py'))
dns = Test.MakeDNServer('dns')
# This record is used in each test case to get the initial redirect response from the origin that we will handle.
@@ -36,45 +36,46 @@
host = socket.gethostname()
ipv4addrs = set()
try:
- ipv4addrs = set([ip for \
- (family,_,_,_,(ip,*_)) in \
- socket.getaddrinfo(host,port=None) if \
- socket.AF_INET == family])
+ ipv4addrs = set([ip for
+ (family, _, _, _, (ip, *_)) in
+ socket.getaddrinfo(host, port=None) if
+ socket.AF_INET == family])
except socket.gaierror:
pass
ipv6addrs = set()
try:
- ipv6addrs = set(["[{0}]".format(ip.split('%')[0]) for \
- (family,_,_,_,(ip,*_)) in \
- socket.getaddrinfo(host,port=None) if \
- socket.AF_INET6 == family and 'fe80' != ip[0:4]]) # Skip link-local addresses.
+ ipv6addrs = set(["[{0}]".format(ip.split('%')[0]) for
+ (family, _, _, _, (ip, *_)) in
+ socket.getaddrinfo(host, port=None) if
+ socket.AF_INET6 == family and 'fe80' != ip[0:4]]) # Skip link-local addresses.
except socket.gaierror:
pass
origin = Test.MakeOriginServer('origin', ip='0.0.0.0')
-ArbitraryTimestamp='12345678'
+ArbitraryTimestamp = '12345678'
# This is for cases when the content is actually fetched from the invalid address.
request_header = {
- 'headers': ('GET / HTTP/1.1\r\n'
- 'Host: *\r\n\r\n'),
- 'timestamp': ArbitraryTimestamp,
- 'body': ''}
+ 'headers': ('GET / HTTP/1.1\r\n'
+ 'Host: *\r\n\r\n'),
+ 'timestamp': ArbitraryTimestamp,
+ 'body': ''}
response_header = {
- 'headers': ('HTTP/1.1 204 No Content\r\n'
- 'Connection: close\r\n\r\n'),
- 'timestamp': ArbitraryTimestamp,
- 'body': ''}
+ 'headers': ('HTTP/1.1 204 No Content\r\n'
+ 'Connection: close\r\n\r\n'),
+ 'timestamp': ArbitraryTimestamp,
+ 'body': ''}
origin.addResponse('sessionfile.log', request_header, response_header)
# Map scenarios to trafficserver processes.
-trafficservers={}
+trafficservers = {}
data_dirname = 'generated_test_data'
data_path = os.path.join(Test.TestDirectory, data_dirname)
os.makedirs(data_path, exist_ok=True)
+
def normalizeForAutest(value):
'''
autest uses "test run" names to build file and directory names, so we must transform them in case there are incompatible or
@@ -85,6 +86,7 @@ def normalizeForAutest(value):
return None
return re.sub(r'[^a-z0-9-]', '_', value, flags=re.I)
+
def makeTestCase(redirectTarget, expectedAction, scenario):
'''
Helper method that creates a "meta-test" from which autest generates a test case.
@@ -93,7 +95,7 @@ def makeTestCase(redirectTarget, expectedAction, scenario):
:param scenario: Defines the ACL to configure and the addresses to test.
'''
- config = ','.join(':'.join(t) for t in sorted((addr.name.lower(),action.name.lower()) for (addr,action) in scenario.items()))
+ config = ','.join(':'.join(t) for t in sorted((addr.name.lower(), action.name.lower()) for (addr, action) in scenario.items()))
normRedirectTarget = normalizeForAutest(redirectTarget)
normConfig = normalizeForAutest(config)
@@ -109,15 +111,15 @@ def makeTestCase(redirectTarget, expectedAction, scenario):
if config not in trafficservers:
trafficservers[config] = Test.MakeATSProcess('ts_{0}'.format(normConfig))
trafficservers[config].Disk.records_config.update({
- 'proxy.config.diags.debug.enabled': 1,
- 'proxy.config.diags.debug.tags': 'http|dns|redirect',
- 'proxy.config.http.number_of_redirections': 1,
- 'proxy.config.http.cache.http': 0,
- 'proxy.config.dns.nameservers': '127.0.0.1:{0}'.format(dns.Variables.Port),
- 'proxy.config.dns.resolv_conf': 'NULL',
- 'proxy.config.url_remap.remap_required': 0,
- 'proxy.config.http.redirect.actions': config,
- 'proxy.config.http.connect_attempts_timeout': 5,
+ 'proxy.config.diags.debug.enabled': 1,
+ 'proxy.config.diags.debug.tags': 'http|dns|redirect',
+ 'proxy.config.http.number_of_redirections': 1,
+ 'proxy.config.http.cache.http': 0,
+ 'proxy.config.dns.nameservers': '127.0.0.1:{0}'.format(dns.Variables.Port),
+ 'proxy.config.dns.resolv_conf': 'NULL',
+ 'proxy.config.url_remap.remap_required': 0,
+ 'proxy.config.http.redirect.actions': config,
+ 'proxy.config.http.connect_attempts_timeout': 5,
'proxy.config.http.connect_attempts_max_retries': 0,
})
tr.Processes.Default.StartBefore(trafficservers[config])
@@ -132,29 +134,29 @@ def makeTestCase(redirectTarget, expectedAction, scenario):
# A GET request parameterized on the config and on the target.
request_header = {
- 'headers': ('GET /redirect?config={0}&target={1} HTTP/1.1\r\n'
- 'Host: *\r\n\r\n').\
- format(normConfig, normRedirectTarget),
- 'timestamp': ArbitraryTimestamp,
- 'body': ''}
+ 'headers': ('GET /redirect?config={0}&target={1} HTTP/1.1\r\n'
+ 'Host: *\r\n\r\n').
+ format(normConfig, normRedirectTarget),
+ 'timestamp': ArbitraryTimestamp,
+ 'body': ''}
# Returns a redirect to the test domain for the given target & the port number for the TS of the given config.
response_header = {
- 'headers': ('HTTP/1.1 307 Temporary Redirect\r\n'
- 'Location: http://{0}:{1}/\r\n'
- 'Connection: close\r\n\r\n').\
- format(testDomain, origin.Variables.Port),
- 'timestamp': ArbitraryTimestamp,
- 'body': ''}
+ 'headers': ('HTTP/1.1 307 Temporary Redirect\r\n'
+ 'Location: http://{0}:{1}/\r\n'
+ 'Connection: close\r\n\r\n').
+ format(testDomain, origin.Variables.Port),
+ 'timestamp': ArbitraryTimestamp,
+ 'body': ''}
origin.addResponse('sessionfile.log', request_header, response_header)
# Generate the request data file.
with open(os.path.join(data_path, tr.Name), 'w') as f:
f.write(('GET /redirect?config={0}&target={1} HTTP/1.1\r\n'
- 'Host: iwillredirect.test:{2}\r\n\r\n').\
- format(normConfig, normRedirectTarget, origin.Variables.Port))
+ 'Host: iwillredirect.test:{2}\r\n\r\n').
+ format(normConfig, normRedirectTarget, origin.Variables.Port))
# Set the command with the appropriate URL.
tr.Processes.Default.Command = "bash -o pipefail -c 'python3 tcp_client.py 127.0.0.1 {0} {1} | head -n 1'".\
- format(trafficservers[config].Variables.port, os.path.join(data_dirname, tr.Name))
+ format(trafficservers[config].Variables.port, os.path.join(data_dirname, tr.Name))
tr.Processes.Default.ReturnCode = 0
# Generate and set the 'gold file' to check stdout
goldFilePath = os.path.join(data_path, '{0}.gold'.format(tr.Name))
@@ -162,67 +164,70 @@ def makeTestCase(redirectTarget, expectedAction, scenario):
f.write(expectedAction.value['expectedStatusLine'])
tr.Processes.Default.Streams.stdout = goldFilePath
+
class AddressE(Enum):
'''
Classes of addresses are mapped to example addresses.
'''
- Private = ('10.0.0.1', '[fc00::1]')
- Loopback = (['127.1.2.3']) # [::1] is ommitted here because it is likely overwritten by Self, and there are no others in IPv6.
- Multicast = ('224.1.2.3', '[ff42::]')
+ Private = ('10.0.0.1', '[fc00::1]')
+ Loopback = (['127.1.2.3']) # [::1] is ommitted here because it is likely overwritten by Self, and there are no others in IPv6.
+ Multicast = ('224.1.2.3', '[ff42::]')
Linklocal = ('169.254.0.1', '[fe80::]')
- Routable = ('72.30.35.10', '[2001:4998:58:1836::10]') # Do not Follow redirects to these in an automated test.
- Self = ipv4addrs | ipv6addrs # Addresses of this host.
- Default = None # All addresses apply, nothing in particular to test.
+ Routable = ('72.30.35.10', '[2001:4998:58:1836::10]') # Do not Follow redirects to these in an automated test.
+ Self = ipv4addrs | ipv6addrs # Addresses of this host.
+ Default = None # All addresses apply, nothing in particular to test.
+
class ActionE(Enum):
# Title case because 'return' is a Python keyword.
- Return = {'config':'return', 'expectedStatusLine':'HTTP/1.1 307 Temporary Redirect\r\n'}
- Reject = {'config':'reject', 'expectedStatusLine':'HTTP/1.1 403 Forbidden\r\n'}
- Follow = {'config':'follow', 'expectedStatusLine':'HTTP/1.1 204 No Content\r\n'}
+ Return = {'config': 'return', 'expectedStatusLine': 'HTTP/1.1 307 Temporary Redirect\r\n'}
+ Reject = {'config': 'reject', 'expectedStatusLine': 'HTTP/1.1 403 Forbidden\r\n'}
+ Follow = {'config': 'follow', 'expectedStatusLine': 'HTTP/1.1 204 No Content\r\n'}
# Added to test failure modes.
- Break = {'expectedStatusLine': 'HTTP/1.1 502 Cannot find server.\r\n'}
+ Break = {'expectedStatusLine': 'HTTP/1.1 502 Cannot find server.\r\n'}
+
scenarios = [
{
# Follow to loopback, but alternately reject/return others.
- AddressE.Private: ActionE.Reject,
- AddressE.Loopback: ActionE.Follow,
+ AddressE.Private: ActionE.Reject,
+ AddressE.Loopback: ActionE.Follow,
AddressE.Multicast: ActionE.Reject,
AddressE.Linklocal: ActionE.Return,
- AddressE.Routable: ActionE.Reject,
- AddressE.Self: ActionE.Return,
- AddressE.Default: ActionE.Reject,
- },
+ AddressE.Routable: ActionE.Reject,
+ AddressE.Self: ActionE.Return,
+ AddressE.Default: ActionE.Reject,
+ },
{
# Follow to loopback, but alternately reject/return others, flipped from the previous scenario.
- AddressE.Private: ActionE.Return,
- AddressE.Loopback: ActionE.Follow,
+ AddressE.Private: ActionE.Return,
+ AddressE.Loopback: ActionE.Follow,
AddressE.Multicast: ActionE.Return,
AddressE.Linklocal: ActionE.Reject,
- AddressE.Routable: ActionE.Return,
- AddressE.Self: ActionE.Reject,
- AddressE.Default: ActionE.Return,
+ AddressE.Routable: ActionE.Return,
+ AddressE.Self: ActionE.Reject,
+ AddressE.Default: ActionE.Return,
},
{
# Return loopback, but reject everything else.
- AddressE.Loopback: ActionE.Return,
- AddressE.Default: ActionE.Reject,
+ AddressE.Loopback: ActionE.Return,
+ AddressE.Default: ActionE.Reject,
},
{
# Reject loopback, but return everything else.
- AddressE.Loopback: ActionE.Reject,
- AddressE.Default: ActionE.Return,
+ AddressE.Loopback: ActionE.Reject,
+ AddressE.Default: ActionE.Return,
},
{
# Return everything.
- AddressE.Default: ActionE.Return,
+ AddressE.Default: ActionE.Return,
},
- ]
+]
for scenario in scenarios:
for addressClass in AddressE:
diff --git a/tests/gold_tests/redirect/redirect_post.test.py b/tests/gold_tests/redirect/redirect_post.test.py
index ce5f5bfbf85..c3073efe079 100644
--- a/tests/gold_tests/redirect/redirect_post.test.py
+++ b/tests/gold_tests/redirect/redirect_post.test.py
@@ -36,21 +36,30 @@
ts.Disk.records_config.update({
'proxy.config.http.number_of_redirections': MAX_REDIRECT,
- 'proxy.config.http.post_copy_size' : 919430601,
+ 'proxy.config.http.post_copy_size': 919430601,
'proxy.config.http.cache.http': 0,
- 'proxy.config.http.redirect.actions': 'self:follow', # redirects to self are not followed by default
+ 'proxy.config.http.redirect.actions': 'self:follow', # redirects to self are not followed by default
# 'proxy.config.diags.debug.enabled': 1,
})
-redirect_request_header = {"headers": "POST /redirect1 HTTP/1.1\r\nHost: *\r\nContent-Length: 52428800\r\n\r\n", "timestamp": "5678", "body": ""}
+redirect_request_header = {
+ "headers": "POST /redirect1 HTTP/1.1\r\nHost: *\r\nContent-Length: 52428800\r\n\r\n",
+ "timestamp": "5678",
+ "body": ""}
redirect_response_header = {"headers": "HTTP/1.1 302 Found\r\nLocation: http://127.0.0.1:{0}/redirect2\r\n\r\n".format(
redirect_serv2.Variables.Port), "timestamp": "5678", "body": ""}
-redirect_request_header2 = {"headers": "POST /redirect2 HTTP/1.1\r\nHost: *\r\nContent-Length: 52428800\r\n\r\n", "timestamp": "5678", "body": ""}
+redirect_request_header2 = {
+ "headers": "POST /redirect2 HTTP/1.1\r\nHost: *\r\nContent-Length: 52428800\r\n\r\n",
+ "timestamp": "5678",
+ "body": ""}
redirect_response_header2 = {"headers": "HTTP/1.1 302 Found\r\nLocation: http://127.0.0.1:{0}/redirectDest\r\n\r\n".format(
dest_serv.Variables.Port), "timestamp": "5678", "body": ""}
-dest_request_header = {"headers": "POST /redirectDest HTTP/1.1\r\nHost: *\r\nContent-Length: 52428800\r\n\r\n", "timestamp": "11", "body": ""}
+dest_request_header = {
+ "headers": "POST /redirectDest HTTP/1.1\r\nHost: *\r\nContent-Length: 52428800\r\n\r\n",
+ "timestamp": "11",
+ "body": ""}
dest_response_header = {"headers": "HTTP/1.1 204 No Content\r\n\r\n", "timestamp": "22", "body": ""}
redirect_serv1.addResponse("sessionfile.log", redirect_request_header, redirect_response_header)
@@ -62,7 +71,8 @@
)
tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'touch largefile.txt && truncate largefile.txt -s 50M && curl -i http://127.0.0.1:{0}/redirect1 -F "filename=@./largefile.txt" && rm -f largefile.txt'.format(ts.Variables.port)
+tr.Processes.Default.Command = 'touch largefile.txt && truncate largefile.txt -s 50M && curl -i http://127.0.0.1:{0}/redirect1 -F "filename=@./largefile.txt" && rm -f largefile.txt'.format(
+ ts.Variables.port)
tr.Processes.Default.StartBefore(ts)
tr.Processes.Default.StartBefore(redirect_serv1)
tr.Processes.Default.StartBefore(redirect_serv2)
diff --git a/tests/gold_tests/remap/remap_http.test.py b/tests/gold_tests/remap/remap_http.test.py
index cabcc02b2db..f46a3512f6b 100644
--- a/tests/gold_tests/remap/remap_http.test.py
+++ b/tests/gold_tests/remap/remap_http.test.py
@@ -24,7 +24,7 @@
# Define default ATS
ts = Test.MakeATSProcess("ts")
server = Test.MakeOriginServer("server")
-server2 = Test.MakeOriginServer("server2",lookup_key="{%Host}{PATH}")
+server2 = Test.MakeOriginServer("server2", lookup_key="{%Host}{PATH}")
dns = Test.MakeDNServer("dns")
Test.testName = ""
@@ -42,7 +42,7 @@
# add response to the server dictionary
server.addResponse("sessionfile.log", request_header, response_header)
-server2.addResponse("sessionfile.log",request_header2, response_header2)
+server2.addResponse("sessionfile.log", request_header2, response_header2)
ts.Disk.records_config.update({
'proxy.config.diags.debug.enabled': 1,
'proxy.config.diags.debug.tags': 'http.*|dns|conf_remap',
@@ -68,8 +68,8 @@
)
ts.Disk.remap_config.AddLine(
- 'map http://www.testexample.com http://127.0.0.1:{0} @plugin=conf_remap.so @pparam=proxy.config.url_remap.pristine_host_hdr=1'.format(server2.Variables.Port)
-)
+ 'map http://www.testexample.com http://127.0.0.1:{0} @plugin=conf_remap.so @pparam=proxy.config.url_remap.pristine_host_hdr=1'.format(
+ server2.Variables.Port))
dns.addRecords(records={"audrey.hepburn.com.": ["127.0.0.1"]})
dns.addRecords(records={"whatever.com.": ["127.0.0.1"]})
@@ -149,7 +149,8 @@
# microserver lookup test
tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'curl --proxy 127.0.0.1:{0} "http://www.testexample.com/test" -H "Host: www.testexample.com" --verbose'.format(ts.Variables.port)
+tr.Processes.Default.Command = 'curl --proxy 127.0.0.1:{0} "http://www.testexample.com/test" -H "Host: www.testexample.com" --verbose'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.StartBefore(server2)
tr.Processes.Default.Streams.stderr = "gold/lookupTest.gold"
diff --git a/tests/gold_tests/remap/remap_https.test.py b/tests/gold_tests/remap/remap_https.test.py
index 1ceaf3d7b8c..45feb1ddd83 100644
--- a/tests/gold_tests/remap/remap_https.test.py
+++ b/tests/gold_tests/remap/remap_https.test.py
@@ -26,7 +26,7 @@
server = Test.MakeOriginServer("server")
server2 = Test.MakeOriginServer("server2", ssl=True)
-#**testname is required**
+# **testname is required**
testName = ""
request_header = {"headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
"timestamp": "1469733493.993", "body": ""}
@@ -48,7 +48,7 @@
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
# enable ssl port
'proxy.config.http.server_ports': '{0} {1}:proto=http2;http:ssl'.format(ts.Variables.port, ts.Variables.ssl_port),
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
})
@@ -59,7 +59,7 @@
'map https://www.example.com:{1} http://127.0.0.1:{0}'.format(server.Variables.Port, ts.Variables.ssl_port)
)
ts.Disk.remap_config.AddLine(
- 'map https://www.anotherexample.com https://127.0.0.1:{0}'.format(server2.Variables.SSL_Port,ts.Variables.ssl_port)
+ 'map https://www.anotherexample.com https://127.0.0.1:{0}'.format(server2.Variables.SSL_Port, ts.Variables.ssl_port)
)
diff --git a/tests/gold_tests/remap/remap_ip_resolve.test.py b/tests/gold_tests/remap/remap_ip_resolve.test.py
index a740275c141..679d3c53c3e 100644
--- a/tests/gold_tests/remap/remap_ip_resolve.test.py
+++ b/tests/gold_tests/remap/remap_ip_resolve.test.py
@@ -50,15 +50,15 @@
ts.Disk.remap_config.AddLine(
- 'map http://testDNS.com http://test.ipv4.only.com:{0} @plugin=conf_remap.so @pparam=proxy.config.hostdb.ip_resolve=ipv6;ipv4;client'.format(server.Variables.Port)
-)
+ 'map http://testDNS.com http://test.ipv4.only.com:{0} @plugin=conf_remap.so @pparam=proxy.config.hostdb.ip_resolve=ipv6;ipv4;client'.format(
+ server.Variables.Port))
ts.Disk.remap_config.AddLine(
- 'map http://testDNS2.com http://test.ipv6.only.com:{0} @plugin=conf_remap.so @pparam=proxy.config.hostdb.ip_resolve=ipv6;only'.format(server_v6.Variables.Port)
-)
+ 'map http://testDNS2.com http://test.ipv6.only.com:{0} @plugin=conf_remap.so @pparam=proxy.config.hostdb.ip_resolve=ipv6;only'.format(
+ server_v6.Variables.Port))
dns.addRecords(records={"test.ipv4.only.com.": ["127.0.0.1"]})
-dns.addRecords(records={"test.ipv6.only.com": ["127.0.0.1","::1"]})
+dns.addRecords(records={"test.ipv6.only.com": ["127.0.0.1", "::1"]})
tr = Test.AddTestRun()
tr.Processes.Default.Command = 'curl --proxy 127.0.0.1:{0} "http://testDNS.com" --verbose'.format(ts.Variables.port)
@@ -67,7 +67,7 @@
tr.Processes.Default.StartBefore(dns)
tr.Processes.Default.StartBefore(Test.Processes.ts)
tr.Processes.Default.Streams.stderr = "gold/remap-DNS-200.gold"
-tr.StillRunningAfter=server
+tr.StillRunningAfter = server
tr = Test.AddTestRun()
@@ -75,5 +75,4 @@
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.StartBefore(server_v6)
tr.Processes.Default.Streams.stderr = "gold/remap-DNS-ipv6-200.gold"
-tr.StillRunningAfter=server_v6
-
+tr.StillRunningAfter = server_v6
diff --git a/tests/gold_tests/remap/remap_ws.test.py b/tests/gold_tests/remap/remap_ws.test.py
index 5379c4d6518..21104128dc2 100644
--- a/tests/gold_tests/remap/remap_ws.test.py
+++ b/tests/gold_tests/remap/remap_ws.test.py
@@ -28,8 +28,9 @@
testName = "Test WebSocket Remaps"
request_header = {"headers": "GET /chat HTTP/1.1\r\nHost: www.example.com\r\nUpgrade: websocket\r\nConnection: Upgrade\r\n\r\n",
"body": None}
-response_header = {"headers": "HTTP/1.1 101 OK\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n\r\n",
- "body": None}
+response_header = {
+ "headers": "HTTP/1.1 101 OK\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n\r\n",
+ "body": None}
server.addResponse("sessionlog.json", request_header, response_header)
ts.addSSLfile("ssl/server.pem")
@@ -54,7 +55,8 @@
tr = Test.AddTestRun()
tr.Processes.Default.StartBefore(server)
tr.Processes.Default.StartBefore(Test.Processes.ts, ready=1)
-tr.Processes.Default.Command = 'curl --max-time 2 -v -s -q -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==" -H "Sec-WebSocket-Version: 13" --http1.1 --resolve www.example.com:{0}:127.0.0.1 -k https://www.example.com:{0}/chat'.format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = 'curl --max-time 2 -v -s -q -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==" -H "Sec-WebSocket-Version: 13" --http1.1 --resolve www.example.com:{0}:127.0.0.1 -k https://www.example.com:{0}/chat'.format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 28
tr.Processes.Default.Streams.stderr = "gold/remap-ws-upgrade.gold"
tr.StillRunningAfter = server
@@ -62,7 +64,8 @@
# ws mapping
tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'curl --max-time 2 -v -s -q -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==" -H "Sec-WebSocket-Version: 13" --http1.1 --resolve www.example.com:{0}:127.0.0.1 -k http://www.example.com:{0}/chat'.format(ts.Variables.port)
+tr.Processes.Default.Command = 'curl --max-time 2 -v -s -q -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==" -H "Sec-WebSocket-Version: 13" --http1.1 --resolve www.example.com:{0}:127.0.0.1 -k http://www.example.com:{0}/chat'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 28
tr.Processes.Default.Streams.stderr = "gold/remap-ws-upgrade.gold"
tr.StillRunningAfter = server
@@ -70,7 +73,8 @@
# Missing required headers (should result in 400)
tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'curl --max-time 2 -v -s -q -H "Connection: Upgrade" -H "Upgrade: websocket" --http1.1 --resolve www.example.com:{0}:127.0.0.1 -k http://www.example.com:{0}/chat'.format(ts.Variables.port)
+tr.Processes.Default.Command = 'curl --max-time 2 -v -s -q -H "Connection: Upgrade" -H "Upgrade: websocket" --http1.1 --resolve www.example.com:{0}:127.0.0.1 -k http://www.example.com:{0}/chat'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stderr = "gold/remap-ws-upgrade-400.gold"
tr.StillRunningAfter = server
diff --git a/tests/gold_tests/runroot/runroot_verify.test.py b/tests/gold_tests/runroot/runroot_verify.test.py
index 8c316b757b4..f35a72a3627 100644
--- a/tests/gold_tests/runroot/runroot_verify.test.py
+++ b/tests/gold_tests/runroot/runroot_verify.test.py
@@ -28,14 +28,14 @@
if bindir.startswith(prefix):
# get the bin directory based on removing the common prefix
- binsuffix = bindir[len(prefix)+1:]
+ binsuffix = bindir[len(prefix) + 1:]
else:
# given a custom setup this might work.. or it might not
binsuffix = bindir
if logdir.startswith(prefix):
# get the bin directory based on removing the common prefix
- logsuffix = bindir[len(prefix)+1:]
+ logsuffix = bindir[len(prefix) + 1:]
else:
# given a custom setup this might work.. or it might not
logsuffix = logdir
diff --git a/tests/gold_tests/session_sharing/session_match.test.py b/tests/gold_tests/session_sharing/session_match.test.py
index 20dcd618d83..2d95d7c3ebf 100644
--- a/tests/gold_tests/session_sharing/session_match.test.py
+++ b/tests/gold_tests/session_sharing/session_match.test.py
@@ -20,6 +20,7 @@
class SessionMatchTest:
TestCounter = 0
+
def __init__(self, TestSummary, sharingMatchValue):
SessionMatchTest.TestCounter += 1
self._MyTestCount = SessionMatchTest.TestCounter
@@ -70,10 +71,10 @@ def setupTS(self):
def _runTraffic(self):
self._tr.Processes.Default.Command = (
- 'curl -v -H\'Host: www.example.com\' -H\'Connection: close\' http://127.0.0.1:{port}/one &&'
- 'curl -v -H\'Host: www.example.com\' -H\'Connection: close\' http://127.0.0.1:{port}/two &&'
- 'curl -v -H\'Host: www.example.com\' -H\'Connection: close\' http://127.0.0.1:{port}/three'.format(
- port = self._ts.Variables.port))
+ 'curl -v -H\'Host: www.example.com\' -H\'Connection: close\' http://127.0.0.1:{port}/one &&'
+ 'curl -v -H\'Host: www.example.com\' -H\'Connection: close\' http://127.0.0.1:{port}/two &&'
+ 'curl -v -H\'Host: www.example.com\' -H\'Connection: close\' http://127.0.0.1:{port}/three'.format(
+ port=self._ts.Variables.port))
self._tr.Processes.Default.ReturnCode = 0
self._tr.Processes.Default.StartBefore(self._server)
self._tr.Processes.Default.StartBefore(self._ts)
diff --git a/tests/gold_tests/shutdown/emergency.test.py b/tests/gold_tests/shutdown/emergency.test.py
index ab8a6b0d557..5092412902f 100644
--- a/tests/gold_tests/shutdown/emergency.test.py
+++ b/tests/gold_tests/shutdown/emergency.test.py
@@ -46,6 +46,6 @@
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.StartBefore(ts)
ts.ReturnCode = 33
-ts.Ready = 0 # Need this to be 0 because we are testing shutdown, this is to make autest not think ats went away for a bad reason.
+ts.Ready = 0 # Need this to be 0 because we are testing shutdown, this is to make autest not think ats went away for a bad reason.
ts.Streams.All = Testers.ExcludesExpression('failed to shutdown', 'should NOT contain "failed to shutdown"')
ts.Disk.diags_log.Content = Testers.IncludesExpression('testing emergency shutdown', 'should contain "testing emergency shutdown"')
diff --git a/tests/gold_tests/shutdown/fatal.test.py b/tests/gold_tests/shutdown/fatal.test.py
index 6ba763d922f..3a892398212 100644
--- a/tests/gold_tests/shutdown/fatal.test.py
+++ b/tests/gold_tests/shutdown/fatal.test.py
@@ -46,6 +46,6 @@
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.StartBefore(ts)
ts.ReturnCode = 70
-ts.Ready = 0 # Need this to be 0 because we are testing shutdown, this is to make autest not think ats went away for a bad reason.
+ts.Ready = 0 # Need this to be 0 because we are testing shutdown, this is to make autest not think ats went away for a bad reason.
ts.Streams.All = Testers.ExcludesExpression('failed to shutdown', 'should NOT contain "failed to shutdown"')
ts.Disk.diags_log.Content = Testers.IncludesExpression('testing fatal shutdown', 'should contain "testing fatal shutdown"')
diff --git a/tests/gold_tests/slow_post/slow_post.test.py b/tests/gold_tests/slow_post/slow_post.test.py
index d958708f9aa..f683c2b98d3 100644
--- a/tests/gold_tests/slow_post/slow_post.test.py
+++ b/tests/gold_tests/slow_post/slow_post.test.py
@@ -34,8 +34,10 @@ def setupOriginServer(self):
response_header = {"headers": "HTTP/1.1 200 OK\r\nServer: microserver\r\nConnection: close\r\n\r\n",
"timestamp": "1469733493.993", "body": ""}
self._server.addResponse("sessionlog.json", request_header, response_header)
- request_header2 = {"headers": "POST / HTTP/1.1\r\nTransfer-Encoding: chunked\r\nHost: www.example.com\r\nConnection: keep-alive\r\n\r\n",
- "timestamp": "1469733493.993", "body": "a\r\na\r\na\r\n\r\n"}
+ request_header2 = {
+ "headers": "POST / HTTP/1.1\r\nTransfer-Encoding: chunked\r\nHost: www.example.com\r\nConnection: keep-alive\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": "a\r\na\r\na\r\n\r\n"}
response_header2 = {"headers": "HTTP/1.1 200 OK\r\nServer: microserver\r\nConnection: close\r\n\r\n",
"timestamp": "1469733493.993", "body": ""}
self._server.addResponse("sessionlog.json", request_header2, response_header2)
diff --git a/tests/gold_tests/thread_config/check_threads.py b/tests/gold_tests/thread_config/check_threads.py
index 716d6bac55d..7cc46c9dd65 100755
--- a/tests/gold_tests/thread_config/check_threads.py
+++ b/tests/gold_tests/thread_config/check_threads.py
@@ -79,8 +79,10 @@ def count_threads(ts_path, etnet_threads, accept_threads):
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-t', '--ts-path', type=str, dest='ts_path', help='path to traffic_server binary', required=True)
- parser.add_argument('-e', '--etnet-threads', type=int, dest='etnet_threads', help='expected number of ET_NET threads', required=True)
- parser.add_argument('-a', '--accept-threads', type=int, dest='accept_threads', help='expected number of accept threads', required=True)
+ parser.add_argument('-e', '--etnet-threads', type=int, dest='etnet_threads',
+ help='expected number of ET_NET threads', required=True)
+ parser.add_argument('-a', '--accept-threads', type=int, dest='accept_threads',
+ help='expected number of accept threads', required=True)
args = parser.parse_args()
exit(count_threads(args.ts_path, args.etnet_threads, args.accept_threads))
diff --git a/tests/gold_tests/thread_config/thread_100_0.test.py b/tests/gold_tests/thread_config/thread_100_0.test.py
index 955dc7e8cb9..c4eb395e464 100644
--- a/tests/gold_tests/thread_config/thread_100_0.test.py
+++ b/tests/gold_tests/thread_config/thread_100_0.test.py
@@ -51,7 +51,8 @@
ts.Setup.CopyAs('check_threads.py', Test.RunDirectory)
tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'curl --proxy http://127.0.0.1:{0} http://www.example.com -H "Proxy-Connection: Keep-Alive" --verbose'.format(ts.Variables.port)
+tr.Processes.Default.Command = 'curl --proxy http://127.0.0.1:{0} http://www.example.com -H "Proxy-Connection: Keep-Alive" --verbose'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.StartBefore(ts)
tr.Processes.Default.StartBefore(server)
diff --git a/tests/gold_tests/thread_config/thread_100_1.test.py b/tests/gold_tests/thread_config/thread_100_1.test.py
index d2f962d30e3..d3c94ae1404 100644
--- a/tests/gold_tests/thread_config/thread_100_1.test.py
+++ b/tests/gold_tests/thread_config/thread_100_1.test.py
@@ -51,7 +51,8 @@
ts.Setup.CopyAs('check_threads.py', Test.RunDirectory)
tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'curl --proxy http://127.0.0.1:{0} http://www.example.com -H "Proxy-Connection: Keep-Alive" --verbose'.format(ts.Variables.port)
+tr.Processes.Default.Command = 'curl --proxy http://127.0.0.1:{0} http://www.example.com -H "Proxy-Connection: Keep-Alive" --verbose'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.StartBefore(ts)
tr.Processes.Default.StartBefore(server)
diff --git a/tests/gold_tests/thread_config/thread_100_10.test.py b/tests/gold_tests/thread_config/thread_100_10.test.py
index 2ec2204a37e..1551c178c1f 100644
--- a/tests/gold_tests/thread_config/thread_100_10.test.py
+++ b/tests/gold_tests/thread_config/thread_100_10.test.py
@@ -51,7 +51,8 @@
ts.Setup.CopyAs('check_threads.py', Test.RunDirectory)
tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'curl --proxy http://127.0.0.1:{0} http://www.example.com -H "Proxy-Connection: Keep-Alive" --verbose'.format(ts.Variables.port)
+tr.Processes.Default.Command = 'curl --proxy http://127.0.0.1:{0} http://www.example.com -H "Proxy-Connection: Keep-Alive" --verbose'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.StartBefore(ts)
tr.Processes.Default.StartBefore(server)
diff --git a/tests/gold_tests/thread_config/thread_1_0.test.py b/tests/gold_tests/thread_config/thread_1_0.test.py
index e394ab0c7c8..af542e34e17 100644
--- a/tests/gold_tests/thread_config/thread_1_0.test.py
+++ b/tests/gold_tests/thread_config/thread_1_0.test.py
@@ -51,7 +51,8 @@
ts.Setup.CopyAs('check_threads.py', Test.RunDirectory)
tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'curl --proxy http://127.0.0.1:{0} http://www.example.com -H "Proxy-Connection: Keep-Alive" --verbose'.format(ts.Variables.port)
+tr.Processes.Default.Command = 'curl --proxy http://127.0.0.1:{0} http://www.example.com -H "Proxy-Connection: Keep-Alive" --verbose'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.StartBefore(ts)
tr.Processes.Default.StartBefore(server)
diff --git a/tests/gold_tests/thread_config/thread_1_1.test.py b/tests/gold_tests/thread_config/thread_1_1.test.py
index a3f7608adab..e11ee263673 100644
--- a/tests/gold_tests/thread_config/thread_1_1.test.py
+++ b/tests/gold_tests/thread_config/thread_1_1.test.py
@@ -51,7 +51,8 @@
ts.Setup.CopyAs('check_threads.py', Test.RunDirectory)
tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'curl --proxy http://127.0.0.1:{0} http://www.example.com -H "Proxy-Connection: Keep-Alive" --verbose'.format(ts.Variables.port)
+tr.Processes.Default.Command = 'curl --proxy http://127.0.0.1:{0} http://www.example.com -H "Proxy-Connection: Keep-Alive" --verbose'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.StartBefore(ts)
tr.Processes.Default.StartBefore(server)
diff --git a/tests/gold_tests/thread_config/thread_1_10.test.py b/tests/gold_tests/thread_config/thread_1_10.test.py
index 07252f3d0d3..ed2d0668a66 100644
--- a/tests/gold_tests/thread_config/thread_1_10.test.py
+++ b/tests/gold_tests/thread_config/thread_1_10.test.py
@@ -51,7 +51,8 @@
ts.Setup.CopyAs('check_threads.py', Test.RunDirectory)
tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'curl --proxy http://127.0.0.1:{0} http://www.example.com -H "Proxy-Connection: Keep-Alive" --verbose'.format(ts.Variables.port)
+tr.Processes.Default.Command = 'curl --proxy http://127.0.0.1:{0} http://www.example.com -H "Proxy-Connection: Keep-Alive" --verbose'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.StartBefore(ts)
tr.Processes.Default.StartBefore(server)
diff --git a/tests/gold_tests/thread_config/thread_2_0.test.py b/tests/gold_tests/thread_config/thread_2_0.test.py
index 9935e6c7ad2..b8891436fa8 100644
--- a/tests/gold_tests/thread_config/thread_2_0.test.py
+++ b/tests/gold_tests/thread_config/thread_2_0.test.py
@@ -51,7 +51,8 @@
ts.Setup.CopyAs('check_threads.py', Test.RunDirectory)
tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'curl --proxy http://127.0.0.1:{0} http://www.example.com -H "Proxy-Connection: Keep-Alive" --verbose'.format(ts.Variables.port)
+tr.Processes.Default.Command = 'curl --proxy http://127.0.0.1:{0} http://www.example.com -H "Proxy-Connection: Keep-Alive" --verbose'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.StartBefore(ts)
tr.Processes.Default.StartBefore(server)
diff --git a/tests/gold_tests/thread_config/thread_2_1.test.py b/tests/gold_tests/thread_config/thread_2_1.test.py
index 641e7e83ae3..701975c4468 100644
--- a/tests/gold_tests/thread_config/thread_2_1.test.py
+++ b/tests/gold_tests/thread_config/thread_2_1.test.py
@@ -51,7 +51,8 @@
ts.Setup.CopyAs('check_threads.py', Test.RunDirectory)
tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'curl --proxy http://127.0.0.1:{0} http://www.example.com -H "Proxy-Connection: Keep-Alive" --verbose'.format(ts.Variables.port)
+tr.Processes.Default.Command = 'curl --proxy http://127.0.0.1:{0} http://www.example.com -H "Proxy-Connection: Keep-Alive" --verbose'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.StartBefore(ts)
tr.Processes.Default.StartBefore(server)
diff --git a/tests/gold_tests/thread_config/thread_2_10.test.py b/tests/gold_tests/thread_config/thread_2_10.test.py
index fd725cec2b7..9d1799b37c2 100644
--- a/tests/gold_tests/thread_config/thread_2_10.test.py
+++ b/tests/gold_tests/thread_config/thread_2_10.test.py
@@ -51,7 +51,8 @@
ts.Setup.CopyAs('check_threads.py', Test.RunDirectory)
tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'curl --proxy http://127.0.0.1:{0} http://www.example.com -H "Proxy-Connection: Keep-Alive" --verbose'.format(ts.Variables.port)
+tr.Processes.Default.Command = 'curl --proxy http://127.0.0.1:{0} http://www.example.com -H "Proxy-Connection: Keep-Alive" --verbose'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.StartBefore(ts)
tr.Processes.Default.StartBefore(server)
diff --git a/tests/gold_tests/thread_config/thread_32_0.test.py b/tests/gold_tests/thread_config/thread_32_0.test.py
index 2e62129b990..eb42be40c8e 100644
--- a/tests/gold_tests/thread_config/thread_32_0.test.py
+++ b/tests/gold_tests/thread_config/thread_32_0.test.py
@@ -51,7 +51,8 @@
ts.Setup.CopyAs('check_threads.py', Test.RunDirectory)
tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'curl --proxy http://127.0.0.1:{0} http://www.example.com -H "Proxy-Connection: Keep-Alive" --verbose'.format(ts.Variables.port)
+tr.Processes.Default.Command = 'curl --proxy http://127.0.0.1:{0} http://www.example.com -H "Proxy-Connection: Keep-Alive" --verbose'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.StartBefore(ts)
tr.Processes.Default.StartBefore(server)
diff --git a/tests/gold_tests/thread_config/thread_32_1.test.py b/tests/gold_tests/thread_config/thread_32_1.test.py
index b44fd8e9562..666fa155180 100644
--- a/tests/gold_tests/thread_config/thread_32_1.test.py
+++ b/tests/gold_tests/thread_config/thread_32_1.test.py
@@ -51,7 +51,8 @@
ts.Setup.CopyAs('check_threads.py', Test.RunDirectory)
tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'curl --proxy http://127.0.0.1:{0} http://www.example.com -H "Proxy-Connection: Keep-Alive" --verbose'.format(ts.Variables.port)
+tr.Processes.Default.Command = 'curl --proxy http://127.0.0.1:{0} http://www.example.com -H "Proxy-Connection: Keep-Alive" --verbose'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.StartBefore(ts)
tr.Processes.Default.StartBefore(server)
diff --git a/tests/gold_tests/thread_config/thread_32_10.test.py b/tests/gold_tests/thread_config/thread_32_10.test.py
index be20467ca46..29c9f5eb41b 100644
--- a/tests/gold_tests/thread_config/thread_32_10.test.py
+++ b/tests/gold_tests/thread_config/thread_32_10.test.py
@@ -51,7 +51,8 @@
ts.Setup.CopyAs('check_threads.py', Test.RunDirectory)
tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'curl --proxy http://127.0.0.1:{0} http://www.example.com -H "Proxy-Connection: Keep-Alive" --verbose'.format(ts.Variables.port)
+tr.Processes.Default.Command = 'curl --proxy http://127.0.0.1:{0} http://www.example.com -H "Proxy-Connection: Keep-Alive" --verbose'.format(
+ ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.StartBefore(ts)
tr.Processes.Default.StartBefore(server)
diff --git a/tests/gold_tests/timeout/active_timeout.test.py b/tests/gold_tests/timeout/active_timeout.test.py
index b3b0e36f359..d88af2de5ea 100644
--- a/tests/gold_tests/timeout/active_timeout.test.py
+++ b/tests/gold_tests/timeout/active_timeout.test.py
@@ -53,10 +53,10 @@
tr.Processes.Default.Command = 'curl -i http://127.0.0.1:{0}/file'.format(ts.Variables.port)
tr.Processes.Default.Streams.stdout = Testers.ContainsExpression("Activity Timeout", "Request should fail with active timeout")
-tr2= Test.AddTestRun("tr")
+tr2 = Test.AddTestRun("tr")
tr2.Processes.Default.Command = 'curl -k -i --http1.1 https://127.0.0.1:{0}/file'.format(ts.Variables.ssl_port)
tr2.Processes.Default.Streams.stdout = Testers.ContainsExpression("Activity Timeout", "Request should fail with active timeout")
-tr3= Test.AddTestRun("tr")
+tr3 = Test.AddTestRun("tr")
tr3.Processes.Default.Command = 'curl -k -i --http2 https://127.0.0.1:{0}/file'.format(ts.Variables.ssl_port)
tr3.Processes.Default.Streams.stdout = Testers.ContainsExpression("Activity Timeout", "Request should fail with active timeout")
diff --git a/tests/gold_tests/timeout/inactive_timeout.test.py b/tests/gold_tests/timeout/inactive_timeout.test.py
index 33e22e8a7e3..5ddfc200de4 100644
--- a/tests/gold_tests/timeout/inactive_timeout.test.py
+++ b/tests/gold_tests/timeout/inactive_timeout.test.py
@@ -51,12 +51,15 @@
tr.Processes.Default.StartBefore(server)
tr.Processes.Default.StartBefore(ts, ready=When.PortOpen(ts.Variables.port))
tr.Processes.Default.Command = 'curl -i http://127.0.0.1:{0}/file'.format(ts.Variables.port)
-tr.Processes.Default.Streams.stdout = Testers.ContainsExpression("Inactivity Timeout", "Request should fail with inactivity timeout")
+tr.Processes.Default.Streams.stdout = Testers.ContainsExpression(
+ "Inactivity Timeout", "Request should fail with inactivity timeout")
-tr2= Test.AddTestRun("tr")
+tr2 = Test.AddTestRun("tr")
tr2.Processes.Default.Command = 'curl -k -i --http1.1 https://127.0.0.1:{0}/file'.format(ts.Variables.ssl_port)
-tr2.Processes.Default.Streams.stdout = Testers.ContainsExpression("Inactivity Timeout", "Request should fail with inactivity timeout")
+tr2.Processes.Default.Streams.stdout = Testers.ContainsExpression(
+ "Inactivity Timeout", "Request should fail with inactivity timeout")
-tr3= Test.AddTestRun("tr")
+tr3 = Test.AddTestRun("tr")
tr3.Processes.Default.Command = 'curl -k -i --http2 https://127.0.0.1:{0}/file'.format(ts.Variables.ssl_port)
-tr3.Processes.Default.Streams.stdout = Testers.ContainsExpression("Inactivity Timeout", "Request should fail with inactivity timeout")
+tr3.Processes.Default.Streams.stdout = Testers.ContainsExpression(
+ "Inactivity Timeout", "Request should fail with inactivity timeout")
diff --git a/tests/gold_tests/timeout/timeout.test.py b/tests/gold_tests/timeout/timeout.test.py
index 29094d73f85..fe0653a913a 100644
--- a/tests/gold_tests/timeout/timeout.test.py
+++ b/tests/gold_tests/timeout/timeout.test.py
@@ -38,5 +38,6 @@
tr.Processes.Default.StartBefore(server)
tr.Processes.Default.StartBefore(ts, ready=When.PortOpen(ts.Variables.port))
tr.Processes.Default.StartBefore(dns)
-tr.Processes.Default.Command = 'curl -i -x http://127.0.0.1:{0} http://127.0.0.1:{1}/file'.format(ts.Variables.port, server.Variables.Port)
+tr.Processes.Default.Command = 'curl -i -x http://127.0.0.1:{0} http://127.0.0.1:{1}/file'.format(
+ ts.Variables.port, server.Variables.Port)
tr.Processes.Default.Streams.stdout = "timeout.gold"
diff --git a/tests/gold_tests/tls/h2_early_decode.py b/tests/gold_tests/tls/h2_early_decode.py
index 7f8752760a9..264905c3b5f 100755
--- a/tests/gold_tests/tls/h2_early_decode.py
+++ b/tests/gold_tests/tls/h2_early_decode.py
@@ -23,6 +23,7 @@
import hpack
import sys
+
class Http2FrameDefs:
RESERVE_BIT_MASK = 0x7fffffff
@@ -200,6 +201,7 @@ def print(self):
def __str__(self):
return self.print()
+
class Decoder:
def read_frame_header(self, data):
frame = Http2Frame(
@@ -226,10 +228,14 @@ def decode(self, data):
temp_data = temp_data[9 + frame.length:]
return frames
+
def main():
# input file is output from openssl s_client.
# sample command to get this output:
- # openssl s_client -bind 127.0.0.1:61991 -connect 127.0.0.1:61992 -tls1_3 -quiet -sess_out /home/duke/Dev/ats-test/sess.dat -sess_in /home/duke/Dev/ats-test/sess.dat -early_data ./gold_tests/tls/early2.txt >! _sandbox/tls_0rtt_server/early2_out.txt 2>&1
+ # openssl s_client -bind 127.0.0.1:61991 -connect 127.0.0.1:61992 -tls1_3
+ # -quiet -sess_out /home/duke/Dev/ats-test/sess.dat -sess_in
+ # /home/duke/Dev/ats-test/sess.dat -early_data ./gold_tests/tls/early2.txt
+ # >! _sandbox/tls_0rtt_server/early2_out.txt 2>&1
if len(sys.argv) < 2:
print('Error: No input file to decode.')
@@ -242,8 +248,8 @@ def main():
data = b''
for line in lines:
if line.startswith(bytes('SSL_connect:', 'utf-8')) or \
- line.startswith(bytes('SSL3 alert', 'utf-8')) or \
- bytes('Can\'t use SSL_get_servername', 'utf-8') in line:
+ line.startswith(bytes('SSL3 alert', 'utf-8')) or \
+ bytes('Can\'t use SSL_get_servername', 'utf-8') in line:
continue
data += line
@@ -253,5 +259,6 @@ def main():
print(frame)
exit(0)
+
if __name__ == "__main__":
main()
diff --git a/tests/gold_tests/tls/h2_early_gen.py b/tests/gold_tests/tls/h2_early_gen.py
index 37e63c23f6c..aef85a9f1f9 100755
--- a/tests/gold_tests/tls/h2_early_gen.py
+++ b/tests/gold_tests/tls/h2_early_gen.py
@@ -57,11 +57,13 @@
CURRENT_SCRIPT_PATH = os.path.dirname(os.path.abspath(__file__))
+
def encode_payload(data):
encoder = hpack.Encoder()
data_encoded = encoder.encode(data)
return data_encoded
+
def make_frame(frame_length, frame_type, frame_flags, frame_stream_id, frame_payload):
frame_length = bytes.fromhex('{0:06x}'.format(frame_length))
frame_type = bytes.fromhex('{0:02x}'.format(frame_type))
@@ -75,6 +77,7 @@ def make_frame(frame_length, frame_type, frame_flags, frame_stream_id, frame_pay
return frame
+
def make_settins_frame(ack=False, empty=False):
payload = ''
if not ack and not empty:
@@ -84,28 +87,30 @@ def make_settins_frame(ack=False, empty=False):
payload = bytes.fromhex(payload)
frame = make_frame(
- frame_length = len(payload),
- frame_type = TYPE_SETTINGS_FRAME,
- frame_flags = 1 if ack else 0,
- frame_stream_id = 0,
- frame_payload = payload
+ frame_length=len(payload),
+ frame_type=TYPE_SETTINGS_FRAME,
+ frame_flags=1 if ack else 0,
+ frame_stream_id=0,
+ frame_payload=payload
)
return frame
+
def make_window_update_frame():
payload = '{0:08x}'.format(RESERVED_BIT_MASK & 1073676289)
payload = bytes.fromhex(payload)
frame = make_frame(
- frame_length = len(payload),
- frame_type = TYPE_WINDOW_UPDATE_FRAME,
- frame_flags = 0,
- frame_stream_id = 0,
- frame_payload = payload
+ frame_length=len(payload),
+ frame_type=TYPE_WINDOW_UPDATE_FRAME,
+ frame_flags=0,
+ frame_stream_id=0,
+ frame_payload=payload
)
return frame
+
def make_headers_frame(method, path='', stream_id=0x01):
headers = []
if method == 'get':
@@ -131,15 +136,16 @@ def make_headers_frame(method, path='', stream_id=0x01):
headers_encoded = encode_payload(headers)
frame = make_frame(
- frame_length = len(headers_encoded),
- frame_type = TYPE_HEADERS_FRAME,
- frame_flags = HEADERS_FLAG_END_STREAM | HEADERS_FLAG_END_HEADERS,
- frame_stream_id = stream_id,
- frame_payload = headers_encoded
+ frame_length=len(headers_encoded),
+ frame_type=TYPE_HEADERS_FRAME,
+ frame_flags=HEADERS_FLAG_END_STREAM | HEADERS_FLAG_END_HEADERS,
+ frame_stream_id=stream_id,
+ frame_payload=headers_encoded
)
return frame
+
def make_h2_req(test):
h2_req = H2_PREFACE
if test == 'get' or test == 'post':
@@ -171,15 +177,18 @@ def make_h2_req(test):
pass
return h2_req
+
def write_to_file(data, file_name):
with open(file_name, 'wb') as out_file:
out_file.write(data)
return
+
def main():
test = sys.argv[1]
write_to_file(make_h2_req(test), os.path.join(CURRENT_SCRIPT_PATH, 'early_h2_{0}.txt'.format(test)))
exit(0)
+
if __name__ == '__main__':
main()
diff --git a/tests/gold_tests/tls/test-0rtt-s_client.py b/tests/gold_tests/tls/test-0rtt-s_client.py
index 05c71651b27..d2a90447c87 100644
--- a/tests/gold_tests/tls/test-0rtt-s_client.py
+++ b/tests/gold_tests/tls/test-0rtt-s_client.py
@@ -22,6 +22,7 @@
import shlex
import h2_early_decode
+
def main():
ats_port = sys.argv[1]
http_ver = sys.argv[2]
@@ -29,17 +30,21 @@ def main():
sess_file_path = os.path.join(sys.argv[4], 'sess.dat')
early_data_file_path = os.path.join(sys.argv[4], 'early_{0}_{1}.txt'.format(http_ver, test))
- s_client_cmd_1 = shlex.split('openssl s_client -connect 127.0.0.1:{0} -tls1_3 -quiet -sess_out {1}'.format(ats_port, sess_file_path))
- s_client_cmd_2 = shlex.split('openssl s_client -connect 127.0.0.1:{0} -tls1_3 -quiet -sess_in {1} -early_data {2}'.format(ats_port, sess_file_path, early_data_file_path))
+ s_client_cmd_1 = shlex.split(
+ 'openssl s_client -connect 127.0.0.1:{0} -tls1_3 -quiet -sess_out {1}'.format(ats_port, sess_file_path))
+ s_client_cmd_2 = shlex.split(
+ 'openssl s_client -connect 127.0.0.1:{0} -tls1_3 -quiet -sess_in {1} -early_data {2}'.format(ats_port, sess_file_path, early_data_file_path))
- create_sess_proc = subprocess.Popen(s_client_cmd_1, env=os.environ.copy(), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ create_sess_proc = subprocess.Popen(s_client_cmd_1, env=os.environ.copy(
+ ), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
try:
output = create_sess_proc.communicate(timeout=1)[0]
except subprocess.TimeoutExpired:
create_sess_proc.kill()
output = create_sess_proc.communicate()[0]
- reuse_sess_proc = subprocess.Popen(s_client_cmd_2, env=os.environ.copy(), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ reuse_sess_proc = subprocess.Popen(s_client_cmd_2, env=os.environ.copy(
+ ), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
try:
output = reuse_sess_proc.communicate(timeout=1)[0]
except subprocess.TimeoutExpired:
@@ -52,8 +57,8 @@ def main():
for line in lines:
line += b'\n'
if line.startswith(bytes('SSL_connect:', 'utf-8')) or \
- line.startswith(bytes('SSL3 alert', 'utf-8')) or \
- bytes('Can\'t use SSL_get_servername', 'utf-8') in line:
+ line.startswith(bytes('SSL3 alert', 'utf-8')) or \
+ bytes('Can\'t use SSL_get_servername', 'utf-8') in line:
continue
data += line
d = h2_early_decode.Decoder()
@@ -65,5 +70,6 @@ def main():
exit(0)
+
if __name__ == '__main__':
main()
diff --git a/tests/gold_tests/tls/tls.test.py b/tests/gold_tests/tls/tls.test.py
index baba71ef327..1285007ec22 100644
--- a/tests/gold_tests/tls/tls.test.py
+++ b/tests/gold_tests/tls/tls.test.py
@@ -25,7 +25,7 @@
server = Test.MakeOriginServer("server")
# build test code
-tr=Test.Build(target='ssl-post',sources=['ssl-post.c'])
+tr = Test.Build(target='ssl-post', sources=['ssl-post.c'])
tr.Setup.Copy('ssl-post.c')
requestLocation = "test2"
@@ -48,8 +48,12 @@
# Add info the origin server responses
server.addResponse("sessionlog.json",
- {"headers": header_string, "timestamp": "1469733493.993", "body": post_body},
- {"headers": "HTTP/1.1 200 OK\r\nServer: microserver\r\nConnection: close\r\nCache-Control: max-age=3600\r\nContent-Length: 2\r\n\r\n", "timestamp": "1469733493.993", "body": "ok"})
+ {"headers": header_string,
+ "timestamp": "1469733493.993",
+ "body": post_body},
+ {"headers": "HTTP/1.1 200 OK\r\nServer: microserver\r\nConnection: close\r\nCache-Control: max-age=3600\r\nContent-Length: 2\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": "ok"})
# add ssl materials like key, certificates for the server
ts.addSSLfile("ssl/server.pem")
@@ -62,12 +66,8 @@
ts.Disk.ssl_multicert_config.AddLine(
'dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key'
)
-ts.Disk.records_config.update({
- 'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.exec_thread.autoconfig.scale': 1.0,
- 'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
-})
+ts.Disk.records_config.update({'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir), 'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir), 'proxy.config.exec_thread.autoconfig.scale': 1.0, 'proxy.config.ssl.server.cipher_suite':
+ 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2', })
tr = Test.AddTestRun("Run-Test")
tr.Command = './ssl-post 127.0.0.1 40 {0} {1}'.format(header_count, ts.Variables.ssl_port)
diff --git a/tests/gold_tests/tls/tls_0rtt_server.test.py b/tests/gold_tests/tls/tls_0rtt_server.test.py
index e4388461c3a..9b96341198c 100644
--- a/tests/gold_tests/tls/tls_0rtt_server.test.py
+++ b/tests/gold_tests/tls/tls_0rtt_server.test.py
@@ -141,7 +141,8 @@
tr.StillRunningAfter += ts
tr = Test.AddTestRun('TLSv1.3 0-RTT Support (HTTP/1.1 GET)')
-tr.Processes.Default.Command = 'python3 test-0rtt-s_client.py {0} {1} {2} {3}'.format(ts.Variables.ssl_port, 'h1', 'get', Test.RunDirectory)
+tr.Processes.Default.Command = 'python3 test-0rtt-s_client.py {0} {1} {2} {3}'.format(
+ ts.Variables.ssl_port, 'h1', 'get', Test.RunDirectory)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ContainsExpression('early data accepted', '')
tr.Processes.Default.Streams.All += Testers.ExcludesExpression('curl test', '')
@@ -149,7 +150,8 @@
tr.StillRunningAfter += ts
tr = Test.AddTestRun('TLSv1.3 0-RTT Support (HTTP/1.1 POST)')
-tr.Processes.Default.Command = 'python3 test-0rtt-s_client.py {0} {1} {2} {3}'.format(ts.Variables.ssl_port, 'h1', 'post', Test.RunDirectory)
+tr.Processes.Default.Command = 'python3 test-0rtt-s_client.py {0} {1} {2} {3}'.format(
+ ts.Variables.ssl_port, 'h1', 'post', Test.RunDirectory)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ContainsExpression('HTTP/1.1 425 Too Early', '')
tr.Processes.Default.Streams.All += Testers.ExcludesExpression('curl test', '')
@@ -158,7 +160,8 @@
tr.StillRunningAfter += ts
tr = Test.AddTestRun('TLSv1.3 0-RTT Support (HTTP/2 GET)')
-tr.Processes.Default.Command = 'python3 test-0rtt-s_client.py {0} {1} {2} {3}'.format(ts.Variables.ssl_port, 'h2', 'get', Test.RunDirectory)
+tr.Processes.Default.Command = 'python3 test-0rtt-s_client.py {0} {1} {2} {3}'.format(
+ ts.Variables.ssl_port, 'h2', 'get', Test.RunDirectory)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ContainsExpression('early data accepted', '')
tr.Processes.Default.Streams.All += Testers.ExcludesExpression('curl test', '')
@@ -166,7 +169,8 @@
tr.StillRunningAfter += ts
tr = Test.AddTestRun('TLSv1.3 0-RTT Support (HTTP/2 POST)')
-tr.Processes.Default.Command = 'python3 test-0rtt-s_client.py {0} {1} {2} {3}'.format(ts.Variables.ssl_port, 'h2', 'post', Test.RunDirectory)
+tr.Processes.Default.Command = 'python3 test-0rtt-s_client.py {0} {1} {2} {3}'.format(
+ ts.Variables.ssl_port, 'h2', 'post', Test.RunDirectory)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ContainsExpression(':status 425', 'Only safe methods are allowed')
tr.Processes.Default.Streams.All += Testers.ExcludesExpression('curl test', '')
@@ -175,7 +179,8 @@
tr.StillRunningAfter += ts
tr = Test.AddTestRun('TLSv1.3 0-RTT Support (HTTP/2 Multiplex)')
-tr.Processes.Default.Command = 'python3 test-0rtt-s_client.py {0} {1} {2} {3}'.format(ts.Variables.ssl_port, 'h2', 'multi1', Test.RunDirectory)
+tr.Processes.Default.Command = 'python3 test-0rtt-s_client.py {0} {1} {2} {3}'.format(
+ ts.Variables.ssl_port, 'h2', 'multi1', Test.RunDirectory)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ContainsExpression('early data accepted multi_1', '')
tr.Processes.Default.Streams.All += Testers.ContainsExpression('early data accepted multi_2', '')
@@ -185,7 +190,8 @@
tr.StillRunningAfter += ts
tr = Test.AddTestRun('TLSv1.3 0-RTT Support (HTTP/2 Multiplex with POST)')
-tr.Processes.Default.Command = 'python3 test-0rtt-s_client.py {0} {1} {2} {3}'.format(ts.Variables.ssl_port, 'h2', 'multi2', Test.RunDirectory)
+tr.Processes.Default.Command = 'python3 test-0rtt-s_client.py {0} {1} {2} {3}'.format(
+ ts.Variables.ssl_port, 'h2', 'multi2', Test.RunDirectory)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ContainsExpression('early data accepted multi_1', '')
tr.Processes.Default.Streams.All += Testers.ContainsExpression(':status 425', 'Only safe methods are allowed')
diff --git a/tests/gold_tests/tls/tls_check_cert_selection.test.py b/tests/gold_tests/tls/tls_check_cert_selection.test.py
index aa027ac85aa..7d091b1dd07 100644
--- a/tests/gold_tests/tls/tls_check_cert_selection.test.py
+++ b/tests/gold_tests/tls/tls_check_cert_selection.test.py
@@ -70,7 +70,8 @@
tr = Test.AddTestRun("bar.com cert")
tr.Setup.Copy("ssl/signer.pem")
tr.Setup.Copy("ssl/signer2.pem")
-tr.Processes.Default.Command = "curl -v --cacert ./signer2.pem --resolve 'bar.com:{0}:127.0.0.1' https://bar.com:{0}".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl -v --cacert ./signer2.pem --resolve 'bar.com:{0}:127.0.0.1' https://bar.com:{0}".format(
+ ts.Variables.ssl_port)
tr.ReturnCode = 0
tr.Processes.Default.StartBefore(server)
tr.Processes.Default.StartBefore(dns)
@@ -84,7 +85,8 @@
# Should receive a foo.com cert
tr2 = Test.AddTestRun("foo.com cert")
-tr2.Processes.Default.Command = "curl -v --cacert ./signer.pem --resolve 'foo.com:{0}:127.0.0.1' https://foo.com:{0}".format(ts.Variables.ssl_port)
+tr2.Processes.Default.Command = "curl -v --cacert ./signer.pem --resolve 'foo.com:{0}:127.0.0.1' https://foo.com:{0}".format(
+ ts.Variables.ssl_port)
tr2.ReturnCode = 0
tr2.StillRunningAfter = server
tr2.StillRunningAfter = ts
@@ -95,7 +97,8 @@
# Should receive random.server.com
tr2 = Test.AddTestRun("random.server.com cert")
-tr2.Processes.Default.Command = "curl -v -k --resolve 'random.server.com:{0}:127.0.0.1' https://random.server.com:{0}".format(ts.Variables.ssl_port)
+tr2.Processes.Default.Command = "curl -v -k --resolve 'random.server.com:{0}:127.0.0.1' https://random.server.com:{0}".format(
+ ts.Variables.ssl_port)
tr2.ReturnCode = 0
tr2.StillRunningAfter = server
tr2.StillRunningAfter = ts
@@ -108,7 +111,8 @@
# No SNI match should match specific IP address, foo.com
# SNI name and returned cert name will not match, so must use -k to avoid cert verification
tr2 = Test.AddTestRun("Bad SNI")
-tr2.Processes.Default.Command = "curl -v -k --cacert ./signer.pem --resolve 'bad.sni.com:{0}:127.0.0.1' https://bad.sni.com:{0}".format(ts.Variables.ssl_port)
+tr2.Processes.Default.Command = "curl -v -k --cacert ./signer.pem --resolve 'bad.sni.com:{0}:127.0.0.1' https://bad.sni.com:{0}".format(
+ ts.Variables.ssl_port)
tr2.ReturnCode = 0
tr2.StillRunningAfter = server
tr2.StillRunningAfter = ts
diff --git a/tests/gold_tests/tls/tls_check_dual_cert_selection.test.py b/tests/gold_tests/tls/tls_check_dual_cert_selection.test.py
index 5a1ca7f6e3c..9256e2e5355 100644
--- a/tests/gold_tests/tls/tls_check_dual_cert_selection.test.py
+++ b/tests/gold_tests/tls/tls_check_dual_cert_selection.test.py
@@ -16,13 +16,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import os
+import re
+
Test.Summary = '''
Test ATS offering both RSA and EC certificates
'''
-import os
-import re
-
# Define default ATS
ts = Test.MakeATSProcess("ts", select_ports=True, enable_tls=True)
server = Test.MakeOriginServer("server", ssl=True)
@@ -76,19 +76,19 @@
foo_rsa_string = ""
san_ec_string = ""
san_rsa_string = ""
-with open(os.path.join(Test.TestDirectory,'ssl', 'signed-foo-ec.pem'), 'r') as myfile:
+with open(os.path.join(Test.TestDirectory, 'ssl', 'signed-foo-ec.pem'), 'r') as myfile:
file_string = myfile.read()
cert_end = file_string.find("END CERTIFICATE-----")
foo_ec_string = re.escape(file_string[0:cert_end])
-with open(os.path.join(Test.TestDirectory,'ssl', 'signed-foo.pem'), 'r') as myfile:
+with open(os.path.join(Test.TestDirectory, 'ssl', 'signed-foo.pem'), 'r') as myfile:
file_string = myfile.read()
cert_end = file_string.find("END CERTIFICATE-----")
foo_rsa_string = re.escape(file_string[0:cert_end])
-with open(os.path.join(Test.TestDirectory,'ssl', 'signed-san-ec.pem'), 'r') as myfile:
+with open(os.path.join(Test.TestDirectory, 'ssl', 'signed-san-ec.pem'), 'r') as myfile:
file_string = myfile.read()
cert_end = file_string.find("END CERTIFICATE-----")
san_ec_string = re.escape(file_string[0:cert_end])
-with open(os.path.join(Test.TestDirectory,'ssl', 'signed-san.pem'), 'r') as myfile:
+with open(os.path.join(Test.TestDirectory, 'ssl', 'signed-san.pem'), 'r') as myfile:
file_string = myfile.read()
cert_end = file_string.find("END CERTIFICATE-----")
san_rsa_string = re.escape(file_string[0:cert_end])
@@ -96,56 +96,61 @@
# Should receive a EC cert since ATS cipher list prefers EC
tr = Test.AddTestRun("Default for foo should return EC cert")
tr.Setup.Copy("ssl/signer.pem")
-tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername foo.com -connect 127.0.0.1:{0}".format(ts.Variables.ssl_port, foo_ec_string)
+tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername foo.com -connect 127.0.0.1:{0}".format(
+ ts.Variables.ssl_port, foo_ec_string)
tr.ReturnCode = 0
tr.Processes.Default.StartBefore(server)
tr.Processes.Default.StartBefore(dns)
tr.Processes.Default.StartBefore(Test.Processes.ts, ready=When.PortOpen(ts.Variables.ssl_port))
tr.StillRunningAfter = server
tr.StillRunningAfter = ts
-tr.Processes.Default.Streams.All += Testers.ContainsExpression(foo_ec_string, "Should select EC cert",reflags=re.S | re.M)
+tr.Processes.Default.Streams.All += Testers.ContainsExpression(foo_ec_string, "Should select EC cert", reflags=re.S | re.M)
# Should receive a RSA cert
tr = Test.AddTestRun("Only offer RSA ciphers, should receive RSA cert")
-tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername foo.com -cipher 'ECDHE-RSA-AES128-GCM-SHA256' -connect 127.0.0.1:{0}".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername foo.com -cipher 'ECDHE-RSA-AES128-GCM-SHA256' -connect 127.0.0.1:{0}".format(
+ ts.Variables.ssl_port)
tr.ReturnCode = 0
tr.StillRunningAfter = server
tr.StillRunningAfter = ts
-tr.Processes.Default.Streams.All += Testers.ContainsExpression(foo_rsa_string, "Should select RSA cert",reflags=re.S | re.M)
+tr.Processes.Default.Streams.All += Testers.ContainsExpression(foo_rsa_string, "Should select RSA cert", reflags=re.S | re.M)
# Should receive a EC cert
tr = Test.AddTestRun("Default for two.com should return EC cert")
-tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername two.com -connect 127.0.0.1:{0}".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername two.com -connect 127.0.0.1:{0}".format(
+ ts.Variables.ssl_port)
tr.ReturnCode = 0
tr.StillRunningAfter = server
tr.StillRunningAfter = ts
tr.Processes.Default.Streams.All += Testers.ContainsExpression(san_ec_string, "Should select EC cert", reflags=re.S | re.M)
-tr.Processes.Default.Streams.All += Testers.ContainsExpression("CN = group.com", "Should select a group SAN");
+tr.Processes.Default.Streams.All += Testers.ContainsExpression("CN = group.com", "Should select a group SAN")
# Should receive a RSA cert
tr = Test.AddTestRun("Only offer RSA ciphers, should receive RSA cert")
-tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername two.com -cipher 'ECDHE-RSA-AES128-GCM-SHA256' -connect 127.0.0.1:{0}".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername two.com -cipher 'ECDHE-RSA-AES128-GCM-SHA256' -connect 127.0.0.1:{0}".format(
+ ts.Variables.ssl_port)
tr.ReturnCode = 0
tr.StillRunningAfter = server
tr.StillRunningAfter = ts
-tr.Processes.Default.Streams.All += Testers.ContainsExpression(san_rsa_string, "Should select RSA cert", reflags=re.S | re.M)
-tr.Processes.Default.Streams.All += Testers.ContainsExpression("CN = group.com", "Should select a group SAN");
+tr.Processes.Default.Streams.All += Testers.ContainsExpression(san_rsa_string, "Should select RSA cert", reflags=re.S | re.M)
+tr.Processes.Default.Streams.All += Testers.ContainsExpression("CN = group.com", "Should select a group SAN")
# Should receive a RSA cert
tr = Test.AddTestRun("rsa.com only in rsa cert")
-tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername rsa.com -connect 127.0.0.1:{0}".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername rsa.com -connect 127.0.0.1:{0}".format(
+ ts.Variables.ssl_port)
tr.ReturnCode = 0
tr.StillRunningAfter = server
tr.StillRunningAfter = ts
tr.Processes.Default.Streams.All += Testers.ContainsExpression(san_rsa_string, "Should select RSA cert", reflags=re.S | re.M)
-tr.Processes.Default.Streams.All += Testers.ContainsExpression("CN = group.com", "Should select a group SAN");
+tr.Processes.Default.Streams.All += Testers.ContainsExpression("CN = group.com", "Should select a group SAN")
# Should receive a EC cert
tr = Test.AddTestRun("ec.com only in ec cert")
-tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername ec.com -connect 127.0.0.1:{0}".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername ec.com -connect 127.0.0.1:{0}".format(
+ ts.Variables.ssl_port)
tr.ReturnCode = 0
tr.StillRunningAfter = server
tr.StillRunningAfter = ts
tr.Processes.Default.Streams.All += Testers.ContainsExpression(san_ec_string, "Should select EC cert", reflags=re.S | re.M)
-tr.Processes.Default.Streams.All += Testers.ContainsExpression("CN = group.com", "Should select a group SAN");
-
+tr.Processes.Default.Streams.All += Testers.ContainsExpression("CN = group.com", "Should select a group SAN")
diff --git a/tests/gold_tests/tls/tls_check_dual_cert_selection2.test.py b/tests/gold_tests/tls/tls_check_dual_cert_selection2.test.py
index e74ff81f0c3..394068b7cea 100644
--- a/tests/gold_tests/tls/tls_check_dual_cert_selection2.test.py
+++ b/tests/gold_tests/tls/tls_check_dual_cert_selection2.test.py
@@ -16,14 +16,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import os
+import re
+
Test.Summary = '''
Test ATS offering both RSA and EC certificates
Combined key and cert files. Faulty key path
'''
-import os
-import re
-
# Define default ATS
ts = Test.MakeATSProcess("ts", select_ports=True, enable_tls=True)
server = Test.MakeOriginServer("server", ssl=True)
@@ -60,7 +60,7 @@
# override for foo.com policy=enforced properties=all
ts.Disk.records_config.update({
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.ssl.server.private_key.path': '/tmp', # Faulty key path should not matter, since there are no key files
+ 'proxy.config.ssl.server.private_key.path': '/tmp', # Faulty key path should not matter, since there are no key files
'proxy.config.ssl.server.cipher_suite': 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256',
'proxy.config.url_remap.pristine_host_hdr': 1,
'proxy.config.dns.nameservers': '127.0.0.1:{0}'.format(dns.Variables.Port),
@@ -79,90 +79,97 @@
san_rsa_string = ""
combo_ec_string = ""
combo_rsa_string = ""
-with open(os.path.join(Test.TestDirectory,'ssl', 'signed-foo-ec.pem'), 'r') as myfile:
+with open(os.path.join(Test.TestDirectory, 'ssl', 'signed-foo-ec.pem'), 'r') as myfile:
file_string = myfile.read()
cert_end = file_string.find("END CERTIFICATE-----")
foo_ec_string = re.escape(file_string[0:cert_end])
-with open(os.path.join(Test.TestDirectory,'ssl', 'signed-foo.pem'), 'r') as myfile:
+with open(os.path.join(Test.TestDirectory, 'ssl', 'signed-foo.pem'), 'r') as myfile:
file_string = myfile.read()
cert_end = file_string.find("END CERTIFICATE-----")
foo_rsa_string = re.escape(file_string[0:cert_end])
-with open(os.path.join(Test.TestDirectory,'ssl', 'signed-san-ec.pem'), 'r') as myfile:
+with open(os.path.join(Test.TestDirectory, 'ssl', 'signed-san-ec.pem'), 'r') as myfile:
file_string = myfile.read()
cert_end = file_string.find("END CERTIFICATE-----")
san_ec_string = re.escape(file_string[0:cert_end])
-with open(os.path.join(Test.TestDirectory,'ssl', 'signed-san.pem'), 'r') as myfile:
+with open(os.path.join(Test.TestDirectory, 'ssl', 'signed-san.pem'), 'r') as myfile:
file_string = myfile.read()
cert_end = file_string.find("END CERTIFICATE-----")
san_rsa_string = re.escape(file_string[0:cert_end])
-with open(os.path.join(Test.TestDirectory,'ssl', 'combined-ec.pem'), 'r') as myfile:
+with open(os.path.join(Test.TestDirectory, 'ssl', 'combined-ec.pem'), 'r') as myfile:
file_string = myfile.read()
cert_end = file_string.find("END CERTIFICATE-----")
- combo_ec_string = re.escape(file_string[0 : cert_end])
-with open(os.path.join(Test.TestDirectory,'ssl', 'combined.pem'), 'r') as myfile:
+ combo_ec_string = re.escape(file_string[0: cert_end])
+with open(os.path.join(Test.TestDirectory, 'ssl', 'combined.pem'), 'r') as myfile:
file_string = myfile.read()
cert_end = file_string.find("END CERTIFICATE-----")
- combo_rsa_string = re.escape(file_string[0 : cert_end])
+ combo_rsa_string = re.escape(file_string[0: cert_end])
# Should receive a EC cert since ATS cipher list prefers EC
tr = Test.AddTestRun("Default for foo should return EC cert")
tr.Setup.Copy("ssl/signer.pem")
-tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername foo.com -connect 127.0.0.1:{0}".format(ts.Variables.ssl_port, foo_ec_string)
+tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername foo.com -connect 127.0.0.1:{0}".format(
+ ts.Variables.ssl_port, foo_ec_string)
tr.ReturnCode = 0
tr.Processes.Default.StartBefore(server)
tr.Processes.Default.StartBefore(dns)
tr.Processes.Default.StartBefore(Test.Processes.ts, ready=When.PortOpen(ts.Variables.ssl_port))
tr.StillRunningAfter = server
tr.StillRunningAfter = ts
-tr.Processes.Default.Streams.All += Testers.ContainsExpression(foo_ec_string, "Should select EC cert",reflags=re.S | re.M)
+tr.Processes.Default.Streams.All += Testers.ContainsExpression(foo_ec_string, "Should select EC cert", reflags=re.S | re.M)
# Should receive a RSA cert
tr = Test.AddTestRun("Only offer RSA ciphers, should receive RSA cert")
-tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername foo.com -cipher 'ECDHE-RSA-AES128-GCM-SHA256' -connect 127.0.0.1:{0}".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername foo.com -cipher 'ECDHE-RSA-AES128-GCM-SHA256' -connect 127.0.0.1:{0}".format(
+ ts.Variables.ssl_port)
tr.ReturnCode = 0
tr.StillRunningAfter = server
tr.StillRunningAfter = ts
-tr.Processes.Default.Streams.All += Testers.ContainsExpression(foo_rsa_string, "Should select RSA cert",reflags=re.S | re.M)
+tr.Processes.Default.Streams.All += Testers.ContainsExpression(foo_rsa_string, "Should select RSA cert", reflags=re.S | re.M)
# Should receive a EC cert
tr = Test.AddTestRun("Default for two.com should return EC cert")
-tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername two.com -connect 127.0.0.1:{0}".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername two.com -connect 127.0.0.1:{0}".format(
+ ts.Variables.ssl_port)
tr.ReturnCode = 0
tr.StillRunningAfter = server
tr.StillRunningAfter = ts
tr.Processes.Default.Streams.All += Testers.ContainsExpression(san_ec_string, "Should select EC cert", reflags=re.S | re.M)
-tr.Processes.Default.Streams.All += Testers.ContainsExpression("CN = group.com", "Should select a group SAN");
+tr.Processes.Default.Streams.All += Testers.ContainsExpression("CN = group.com", "Should select a group SAN")
# Should receive a RSA cert
tr = Test.AddTestRun("Only offer RSA ciphers, should receive RSA cert")
-tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername two.com -cipher 'ECDHE-RSA-AES128-GCM-SHA256' -connect 127.0.0.1:{0}".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername two.com -cipher 'ECDHE-RSA-AES128-GCM-SHA256' -connect 127.0.0.1:{0}".format(
+ ts.Variables.ssl_port)
tr.ReturnCode = 0
tr.StillRunningAfter = server
tr.StillRunningAfter = ts
-tr.Processes.Default.Streams.All += Testers.ContainsExpression(san_rsa_string, "Should select RSA cert", reflags=re.S | re.M)
-tr.Processes.Default.Streams.All += Testers.ContainsExpression("CN = group.com", "Should select a group SAN");
+tr.Processes.Default.Streams.All += Testers.ContainsExpression(san_rsa_string, "Should select RSA cert", reflags=re.S | re.M)
+tr.Processes.Default.Streams.All += Testers.ContainsExpression("CN = group.com", "Should select a group SAN")
# Should receive a RSA cert
tr = Test.AddTestRun("rsa.com only in rsa cert")
-tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername rsa.com -connect 127.0.0.1:{0}".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername rsa.com -connect 127.0.0.1:{0}".format(
+ ts.Variables.ssl_port)
tr.ReturnCode = 0
tr.StillRunningAfter = server
tr.StillRunningAfter = ts
tr.Processes.Default.Streams.All += Testers.ContainsExpression(san_rsa_string, "Should select RSA cert", reflags=re.S | re.M)
-tr.Processes.Default.Streams.All += Testers.ContainsExpression("CN = group.com", "Should select a group SAN");
+tr.Processes.Default.Streams.All += Testers.ContainsExpression("CN = group.com", "Should select a group SAN")
# Should receive a EC cert
tr = Test.AddTestRun("ec.com only in ec cert")
-tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername ec.com -connect 127.0.0.1:{0}".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername ec.com -connect 127.0.0.1:{0}".format(
+ ts.Variables.ssl_port)
tr.ReturnCode = 0
tr.StillRunningAfter = server
tr.StillRunningAfter = ts
tr.Processes.Default.Streams.All += Testers.ContainsExpression(san_ec_string, "Should select EC cert", reflags=re.S | re.M)
-tr.Processes.Default.Streams.All += Testers.ContainsExpression("CN = group.com", "Should select a group SAN");
+tr.Processes.Default.Streams.All += Testers.ContainsExpression("CN = group.com", "Should select a group SAN")
# Should receive a EC cert
tr = Test.AddTestRun("Default for combined.com should return EC cert")
-tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername combined.com -connect 127.0.0.1:{0}".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername combined.com -connect 127.0.0.1:{0}".format(
+ ts.Variables.ssl_port)
tr.ReturnCode = 0
tr.StillRunningAfter = server
tr.StillRunningAfter = ts
@@ -171,10 +178,10 @@
# Should receive a RSA cert
tr = Test.AddTestRun("Only offer RSA ciphers, should receive RSA cert")
-tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername combined.com -cipher 'ECDHE-RSA-AES128-GCM-SHA256' -connect 127.0.0.1:{0}".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "echo foo | openssl s_client -tls1_2 -servername combined.com -cipher 'ECDHE-RSA-AES128-GCM-SHA256' -connect 127.0.0.1:{0}".format(
+ ts.Variables.ssl_port)
tr.ReturnCode = 0
tr.StillRunningAfter = server
tr.StillRunningAfter = ts
-tr.Processes.Default.Streams.All += Testers.ContainsExpression(combo_rsa_string, "Should select RSA cert", reflags=re.S | re.M)
+tr.Processes.Default.Streams.All += Testers.ContainsExpression(combo_rsa_string, "Should select RSA cert", reflags=re.S | re.M)
tr.Processes.Default.Streams.All += Testers.ContainsExpression("CN = combined.com", "Should select combined pem")
-
diff --git a/tests/gold_tests/tls/tls_client_cert.test.py b/tests/gold_tests/tls/tls_client_cert.test.py
index c607b32408d..ca9e5a24821 100644
--- a/tests/gold_tests/tls/tls_client_cert.test.py
+++ b/tests/gold_tests/tls/tls_client_cert.test.py
@@ -25,8 +25,18 @@
cafile = "{0}/signer.pem".format(Test.RunDirectory)
cafile2 = "{0}/signer2.pem".format(Test.RunDirectory)
# --clientverify: "" empty string because microserver does store_true for argparse, but options is a dictionary
-server = Test.MakeOriginServer("server", ssl=True, options = { "--clientCA": cafile, "--clientverify": ""}, clientcert="{0}/signed-foo.pem".format(Test.RunDirectory), clientkey="{0}/signed-foo.key".format(Test.RunDirectory))
-server2 = Test.MakeOriginServer("server2", ssl=True, options = { "--clientCA": cafile2, "--clientverify": ""}, clientcert="{0}/signed2-bar.pem".format(Test.RunDirectory), clientkey="{0}/signed-bar.key".format(Test.RunDirectory))
+server = Test.MakeOriginServer("server",
+ ssl=True,
+ options={"--clientCA": cafile,
+ "--clientverify": ""},
+ clientcert="{0}/signed-foo.pem".format(Test.RunDirectory),
+ clientkey="{0}/signed-foo.key".format(Test.RunDirectory))
+server2 = Test.MakeOriginServer("server2",
+ ssl=True,
+ options={"--clientCA": cafile2,
+ "--clientverify": ""},
+ clientcert="{0}/signed2-bar.pem".format(Test.RunDirectory),
+ clientkey="{0}/signed-bar.key".format(Test.RunDirectory))
server3 = Test.MakeOriginServer("server3")
server4 = Test.MakeOriginServer("server4")
server.Setup.Copy("ssl/signer.pem")
@@ -71,7 +81,7 @@
'proxy.config.ssl.client.private_key.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.client.private_key.filename': 'signed-foo.key',
'proxy.config.exec_thread.autoconfig.scale': 1.0,
- 'proxy.config.url_remap.pristine_host_hdr' : 1,
+ 'proxy.config.url_remap.pristine_host_hdr': 1,
})
ts.Disk.ssl_multicert_config.AddLine(
@@ -95,7 +105,7 @@
' client_key: {0}/signed-bar.key'.format(ts.Variables.SSLDir))
ts.Disk.logging_yaml.AddLines(
-'''
+ '''
logging:
formats:
- name: testformat
@@ -119,7 +129,7 @@
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = Testers.ExcludesExpression("Could Not Connect", "Check response")
-#Should fail
+# Should fail
trfail = Test.AddTestRun("Connect with first client cert to second server")
trfail.StillRunningAfter = ts
trfail.StillRunningAfter = server
@@ -137,7 +147,7 @@
trbar.Processes.Default.ReturnCode = 0
trbar.Processes.Default.Streams.stdout = Testers.ExcludesExpression("Could Not Connect", "Check response")
-#Should fail
+# Should fail
trbarfail = Test.AddTestRun("Connect with signed2 bar cert to first server")
trbarfail.StillRunningAfter = ts
trbarfail.StillRunningAfter = server
@@ -150,7 +160,7 @@
# Update the SNI config
snipath = ts.Disk.sni_yaml.AbsPath
recordspath = ts.Disk.records_config.AbsPath
-tr2.Disk.File(snipath, id = "sni_yaml", typename="ats:config"),
+tr2.Disk.File(snipath, id="sni_yaml", typename="ats:config"),
tr2.Disk.sni_yaml.AddLine(
'sni:')
tr2.Disk.sni_yaml.AddLine(
@@ -160,7 +170,7 @@
tr2.Disk.sni_yaml.AddLine(
' client_key: {0}/signed-bar.key'.format(ts.Variables.SSLDir))
# recreate the records.config with the cert filename changed
-tr2.Disk.File(recordspath, id = "records_config", typename="ats:config:records"),
+tr2.Disk.File(recordspath, id="records_config", typename="ats:config:records"),
tr2.Disk.records_config.update({
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
@@ -169,7 +179,7 @@
'proxy.config.ssl.client.cert.filename': 'signed2-foo.pem',
'proxy.config.ssl.client.private_key.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.client.private_key.filename': 'signed-foo.key',
- 'proxy.config.url_remap.pristine_host_hdr' : 1,
+ 'proxy.config.url_remap.pristine_host_hdr': 1,
})
tr2.StillRunningAfter = ts
tr2.StillRunningAfter = server
@@ -189,7 +199,7 @@
tr2reload.Processes.Default.ReturnCode = 0
-#Should succeed
+# Should succeed
tr3bar = Test.AddTestRun("Make request with other bar cert to first server")
# Wait for the reload to complete
tr3bar.Processes.Default.StartBefore(server3, ready=When.FileContains(ts.Disk.diags_log.Name, 'sni.yaml finished loading', 2))
@@ -200,7 +210,7 @@
tr3bar.Processes.Default.ReturnCode = 0
tr3bar.Processes.Default.Streams.stdout = Testers.ExcludesExpression("Could Not Connect", "Check response")
-#Should fail
+# Should fail
tr3barfail = Test.AddTestRun("Make request with other bar cert to second server")
tr3barfail.StillRunningAfter = ts
tr3barfail.StillRunningAfter = server
@@ -209,7 +219,7 @@
tr3barfail.Processes.Default.ReturnCode = 0
tr3barfail.Processes.Default.Streams.stdout = Testers.ContainsExpression("Could Not Connect", "Check response")
-#Should succeed
+# Should succeed
tr3 = Test.AddTestRun("Make request with other cert to second server")
# Wait for the reload to complete
tr3.StillRunningAfter = ts
@@ -219,7 +229,7 @@
tr3.Processes.Default.ReturnCode = 0
tr3.Processes.Default.Streams.stdout = Testers.ExcludesExpression("Could Not Connect", "Check response")
-#Should fail
+# Should fail
tr3fail = Test.AddTestRun("Make request with other cert to first server")
tr3fail.StillRunningAfter = ts
tr3fail.StillRunningAfter = server
@@ -238,7 +248,8 @@
trupdate.Setup.CopyAs("ssl/signed2-bar.pem", ".", "{0}/signed-bar.pem".format(ts.Variables.SSLDir))
# in the config/ssl directory for records.config
trupdate.Setup.CopyAs("ssl/signed-foo.pem", ".", "{0}/signed2-foo.pem".format(ts.Variables.SSLDir))
-trupdate.Processes.Default.Command = 'traffic_ctl config set proxy.config.ssl.client.cert.path {0}/; touch {1}'.format(ts.Variables.SSLDir,snipath)
+trupdate.Processes.Default.Command = 'traffic_ctl config set proxy.config.ssl.client.cert.path {0}/; touch {1}'.format(
+ ts.Variables.SSLDir, snipath)
# Need to copy over the environment so traffic_ctl knows where to find the unix domain socket
trupdate.Processes.Default.Env = ts.Env
trupdate.Processes.Default.ReturnCode = 0
@@ -251,7 +262,7 @@
trreload.Processes.Default.Env = ts.Env
trreload.Processes.Default.ReturnCode = 0
-#Should succeed
+# Should succeed
tr4bar = Test.AddTestRun("Make request with renamed bar cert to second server")
# Wait for the reload to complete
tr4bar.DelayStart = 10
@@ -262,7 +273,7 @@
tr4bar.Processes.Default.ReturnCode = 0
tr4bar.Processes.Default.Streams.stdout = Testers.ExcludesExpression("Could Not Connect", "Check response")
-#Should fail
+# Should fail
tr4barfail = Test.AddTestRun("Make request with renamed bar cert to first server")
tr4barfail.StillRunningAfter = ts
tr4barfail.StillRunningAfter = server
@@ -271,7 +282,7 @@
tr4barfail.Processes.Default.ReturnCode = 0
tr4barfail.Processes.Default.Streams.stdout = Testers.ContainsExpression("Could Not Connect", "Check response")
-#Should succeed
+# Should succeed
tr4 = Test.AddTestRun("Make request with renamed foo cert to first server")
tr4.StillRunningAfter = ts
tr4.StillRunningAfter = server
@@ -280,7 +291,7 @@
tr4.Processes.Default.ReturnCode = 0
tr4.Processes.Default.Streams.stdout = Testers.ExcludesExpression("Could Not Connect", "Check response")
-#Should fail
+# Should fail
tr4fail = Test.AddTestRun("Make request with renamed foo cert to second server")
tr4fail.StillRunningAfter = ts
tr4fail.StillRunningAfter = server
diff --git a/tests/gold_tests/tls/tls_client_cert2.test.py b/tests/gold_tests/tls/tls_client_cert2.test.py
index 0872cb07038..1b2fe8478ed 100644
--- a/tests/gold_tests/tls/tls_client_cert2.test.py
+++ b/tests/gold_tests/tls/tls_client_cert2.test.py
@@ -24,8 +24,18 @@
ts = Test.MakeATSProcess("ts", command="traffic_server", select_ports=True)
cafile = "{0}/signer.pem".format(Test.RunDirectory)
cafile2 = "{0}/signer2.pem".format(Test.RunDirectory)
-server = Test.MakeOriginServer("server", ssl=True, options = { "--clientCA": cafile, "--clientverify": ""}, clientcert="{0}/signed-foo.pem".format(Test.RunDirectory), clientkey="{0}/signed-foo.key".format(Test.RunDirectory))
-server2 = Test.MakeOriginServer("server2", ssl=True, options = { "--clientCA": cafile2, "--clientverify": ""}, clientcert="{0}/signed2-bar.pem".format(Test.RunDirectory), clientkey="{0}/signed-bar.key".format(Test.RunDirectory))
+server = Test.MakeOriginServer("server",
+ ssl=True,
+ options={"--clientCA": cafile,
+ "--clientverify": ""},
+ clientcert="{0}/signed-foo.pem".format(Test.RunDirectory),
+ clientkey="{0}/signed-foo.key".format(Test.RunDirectory))
+server2 = Test.MakeOriginServer("server2",
+ ssl=True,
+ options={"--clientCA": cafile2,
+ "--clientverify": ""},
+ clientcert="{0}/signed2-bar.pem".format(Test.RunDirectory),
+ clientkey="{0}/signed-bar.key".format(Test.RunDirectory))
server4 = Test.MakeOriginServer("server4")
server.Setup.Copy("ssl/signer.pem")
server.Setup.Copy("ssl/signer2.pem")
@@ -66,7 +76,7 @@
'proxy.config.ssl.client.private_key.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
'proxy.config.exec_thread.autoconfig.scale': 1.0,
- 'proxy.config.url_remap.pristine_host_hdr' : 1,
+ 'proxy.config.url_remap.pristine_host_hdr': 1,
})
ts.Disk.ssl_multicert_config.AddLine(
@@ -96,7 +106,7 @@
])
ts.Disk.logging_yaml.AddLines(
-'''
+ '''
logging:
formats:
- name: testformat
@@ -120,7 +130,7 @@
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = Testers.ExcludesExpression("Could Not Connect", "Check response")
-#Should fail
+# Should fail
trfail = Test.AddTestRun("bob.bar.com to server 2")
trfail.StillRunningAfter = ts
trfail.StillRunningAfter = server
@@ -138,7 +148,7 @@
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = Testers.ExcludesExpression("Could Not Connect", "Check response")
-#Should fail
+# Should fail
trfail = Test.AddTestRun("bob.foo.com to server 2")
trfail.StillRunningAfter = ts
trfail.StillRunningAfter = server
@@ -156,7 +166,7 @@
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = Testers.ExcludesExpression("Could Not Connect", "Check response")
-#Should fail
+# Should fail
trfail = Test.AddTestRun("random.bar.com to server 1")
trfail.StillRunningAfter = ts
trfail.StillRunningAfter = server
@@ -174,7 +184,7 @@
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = Testers.ContainsExpression("Could Not Connect", "Check response")
-#Should fail
+# Should fail
trfail = Test.AddTestRun("random.foo.com to server 1")
trfail.StillRunningAfter = ts
trfail.StillRunningAfter = server
diff --git a/tests/gold_tests/tls/tls_client_cert_override.test.py b/tests/gold_tests/tls/tls_client_cert_override.test.py
index 86cfea345fc..f04f357ae05 100644
--- a/tests/gold_tests/tls/tls_client_cert_override.test.py
+++ b/tests/gold_tests/tls/tls_client_cert_override.test.py
@@ -24,8 +24,18 @@
ts = Test.MakeATSProcess("ts", command="traffic_manager", select_ports=True)
cafile = "{0}/signer.pem".format(Test.RunDirectory)
cafile2 = "{0}/signer2.pem".format(Test.RunDirectory)
-server = Test.MakeOriginServer("server", ssl=True, options = { "--clientCA": cafile, "--clientverify": ""}, clientcert="{0}/signed-foo.pem".format(Test.RunDirectory), clientkey="{0}/signed-foo.key".format(Test.RunDirectory))
-server2 = Test.MakeOriginServer("server2", ssl=True, options = { "--clientCA": cafile2, "--clientverify": ""}, clientcert="{0}/signed2-bar.pem".format(Test.RunDirectory), clientkey="{0}/signed-bar.key".format(Test.RunDirectory))
+server = Test.MakeOriginServer("server",
+ ssl=True,
+ options={"--clientCA": cafile,
+ "--clientverify": ""},
+ clientcert="{0}/signed-foo.pem".format(Test.RunDirectory),
+ clientkey="{0}/signed-foo.key".format(Test.RunDirectory))
+server2 = Test.MakeOriginServer("server2",
+ ssl=True,
+ options={"--clientCA": cafile2,
+ "--clientverify": ""},
+ clientcert="{0}/signed2-bar.pem".format(Test.RunDirectory),
+ clientkey="{0}/signed-bar.key".format(Test.RunDirectory))
server.Setup.Copy("ssl/signer.pem")
server.Setup.Copy("ssl/signer2.pem")
server.Setup.Copy("ssl/signed-foo.pem")
@@ -66,7 +76,7 @@
'proxy.config.ssl.client.private_key.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.client.private_key.filename': 'signed-foo.key',
'proxy.config.exec_thread.autoconfig.scale': 1.0,
- 'proxy.config.url_remap.pristine_host_hdr' : 1,
+ 'proxy.config.url_remap.pristine_host_hdr': 1,
})
ts.Disk.ssl_multicert_config.AddLine(
@@ -74,17 +84,25 @@
)
ts.Disk.remap_config.AddLine(
- 'map /case1 https://127.0.0.1:{0}/ @plugin=conf_remap.so @pparam=proxy.config.ssl.client.cert.filename={1} plugin=conf_remap.so @pparam=proxy.config.ssl.client.private_key.filename={2}'.format(server.Variables.SSL_Port, "signed-foo.pem", "signed-foo.key")
-)
+ 'map /case1 https://127.0.0.1:{0}/ @plugin=conf_remap.so @pparam=proxy.config.ssl.client.cert.filename={1} plugin=conf_remap.so @pparam=proxy.config.ssl.client.private_key.filename={2}'.format(
+ server.Variables.SSL_Port,
+ "signed-foo.pem",
+ "signed-foo.key"))
ts.Disk.remap_config.AddLine(
- 'map /badcase1 https://127.0.0.1:{0}/ @plugin=conf_remap.so @pparam=proxy.config.ssl.client.cert.filename={1} plugin=conf_remap.so @pparam=proxy.config.ssl.client.private_key.filename={2}'.format(server.Variables.SSL_Port, "signed2-foo.pem", "signed-foo.key")
-)
+ 'map /badcase1 https://127.0.0.1:{0}/ @plugin=conf_remap.so @pparam=proxy.config.ssl.client.cert.filename={1} plugin=conf_remap.so @pparam=proxy.config.ssl.client.private_key.filename={2}'.format(
+ server.Variables.SSL_Port,
+ "signed2-foo.pem",
+ "signed-foo.key"))
ts.Disk.remap_config.AddLine(
- 'map /case2 https://127.0.0.1:{0}/ @plugin=conf_remap.so @pparam=proxy.config.ssl.client.cert.filename={1} plugin=conf_remap.so @pparam=proxy.config.ssl.client.private_key.filename={2}'.format(server2.Variables.SSL_Port, "signed2-foo.pem", "signed-foo.key")
-)
+ 'map /case2 https://127.0.0.1:{0}/ @plugin=conf_remap.so @pparam=proxy.config.ssl.client.cert.filename={1} plugin=conf_remap.so @pparam=proxy.config.ssl.client.private_key.filename={2}'.format(
+ server2.Variables.SSL_Port,
+ "signed2-foo.pem",
+ "signed-foo.key"))
ts.Disk.remap_config.AddLine(
- 'map /badcase2 https://127.0.0.1:{0}/ @plugin=conf_remap.so @pparam=proxy.config.ssl.client.cert.filename={1} plugin=conf_remap.so @pparam=proxy.config.ssl.client.private_key.filename={2}'.format(server2.Variables.SSL_Port, "signed-foo.pem", "signed-foo.key")
-)
+ 'map /badcase2 https://127.0.0.1:{0}/ @plugin=conf_remap.so @pparam=proxy.config.ssl.client.cert.filename={1} plugin=conf_remap.so @pparam=proxy.config.ssl.client.private_key.filename={2}'.format(
+ server2.Variables.SSL_Port,
+ "signed-foo.pem",
+ "signed-foo.key"))
# Should succeed
tr = Test.AddTestRun("Connect with correct client cert to first server")
@@ -98,7 +116,7 @@
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = Testers.ExcludesExpression("Could Not Connect", "Check response")
-#Should fail
+# Should fail
trfail = Test.AddTestRun("Connect with bad client cert to first server")
trfail.StillRunningAfter = ts
trfail.StillRunningAfter = server
@@ -116,7 +134,7 @@
trbar.Processes.Default.ReturnCode = 0
trbar.Processes.Default.Streams.stdout = Testers.ExcludesExpression("Could Not Connect", "Check response")
-#Should fail
+# Should fail
trbarfail = Test.AddTestRun("Connect with bad client cert to second server")
trbarfail.StillRunningAfter = ts
trbarfail.StillRunningAfter = server
diff --git a/tests/gold_tests/tls/tls_client_verify.test.py b/tests/gold_tests/tls/tls_client_verify.test.py
index 06392cf2fb0..e231c019d85 100644
--- a/tests/gold_tests/tls/tls_client_verify.test.py
+++ b/tests/gold_tests/tls/tls_client_verify.test.py
@@ -43,7 +43,7 @@
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
- 'proxy.config.url_remap.pristine_host_hdr' : 1,
+ 'proxy.config.url_remap.pristine_host_hdr': 1,
'proxy.config.ssl.client.certification_level': 2,
'proxy.config.ssl.CA.cert.filename': '{0}/signer.pem'.format(ts.Variables.SSLDir),
'proxy.config.exec_thread.autoconfig.scale': 1.0,
@@ -73,7 +73,7 @@
])
ts.Disk.logging_yaml.AddLines(
-'''
+ '''
logging:
formats:
- name: testformat
@@ -91,7 +91,8 @@
tr.Processes.Default.StartBefore(server)
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --resolve 'foo.com:{0}:127.0.0.1' https://foo.com:{0}/case1".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --resolve 'foo.com:{0}:127.0.0.1' https://foo.com:{0}/case1".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 35
tr = Test.AddTestRun("Connect to foo.com with bad cert")
@@ -99,7 +100,8 @@
tr.Setup.Copy("ssl/server.key")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./server.pem --key ./server.key --resolve 'foo.com:{0}:127.0.0.1' https://foo.com:{0}/case2".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./server.pem --key ./server.key --resolve 'foo.com:{0}:127.0.0.1' https://foo.com:{0}/case2".format(
+ ts.Variables.ssl_port)
# Should fail with badly signed certs
tr.Processes.Default.ReturnCode = 35
@@ -108,14 +110,16 @@
tr.Setup.Copy("ssl/signed-foo.key")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-foo.pem --key ./signed-foo.key --resolve 'foo.com:{0}:127.0.0.1' https://foo.com:{0}/case3".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-foo.pem --key ./signed-foo.key --resolve 'foo.com:{0}:127.0.0.1' https://foo.com:{0}/case3".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ExcludesExpression("error", "Check response")
tr = Test.AddTestRun("Connect to bob.bar.com without cert")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --resolve 'bob.bar.com:{0}:127.0.0.1' https://bob.bar.com:{0}/case4".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --resolve 'bob.bar.com:{0}:127.0.0.1' https://bob.bar.com:{0}/case4".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ExcludesExpression("alert", "TLS handshake should succeed")
@@ -124,7 +128,8 @@
tr.Setup.Copy("ssl/signed-bar.key")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-bob-bar.pem --key ./signed-bar.key --resolve 'bob.bar.com:{0}:127.0.0.1' https://bob.bar.com:{0}/case5".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-bob-bar.pem --key ./signed-bar.key --resolve 'bob.bar.com:{0}:127.0.0.1' https://bob.bar.com:{0}/case5".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ExcludesExpression("error", "Check response")
@@ -133,14 +138,16 @@
tr.Setup.Copy("ssl/server.key")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./server.pem --key ./server.key --resolve 'bob.bar.com:{0}:127.0.0.1' https://bob.bar.com:{0}/case6".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./server.pem --key ./server.key --resolve 'bob.bar.com:{0}:127.0.0.1' https://bob.bar.com:{0}/case6".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ExcludesExpression("error", "Check response")
tr = Test.AddTestRun("Connect to bob.foo.com without cert")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --resolve 'bob.foo.com:{0}:127.0.0.1' https://bob.foo.com:{0}/case7".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --resolve 'bob.foo.com:{0}:127.0.0.1' https://bob.foo.com:{0}/case7".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ExcludesExpression("alert", "TLS handshake should succeed")
@@ -149,7 +156,8 @@
tr.Setup.Copy("ssl/signed-foo.key")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-bob-foo.pem --key ./signed-foo.key --resolve 'bob.foo.com:{0}:127.0.0.1' https://bob.foo.com:{0}/case8".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-bob-foo.pem --key ./signed-foo.key --resolve 'bob.foo.com:{0}:127.0.0.1' https://bob.foo.com:{0}/case8".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ExcludesExpression("error", "Check response")
@@ -158,14 +166,16 @@
tr.Setup.Copy("ssl/server.key")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./server.pem --key ./server.key --resolve 'bob.foo.com:{0}:127.0.0.1' https://bob.foo.com:{0}/case9".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./server.pem --key ./server.key --resolve 'bob.foo.com:{0}:127.0.0.1' https://bob.foo.com:{0}/case9".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ExcludesExpression("error", "Check response")
tr = Test.AddTestRun("Connect to bar.com without cert")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --resolve 'bar.com:{0}:127.0.0.1' https://bar.com:{0}/case10".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --resolve 'bar.com:{0}:127.0.0.1' https://bar.com:{0}/case10".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 35
tr = Test.AddTestRun("Connect to bar.com with cert")
@@ -173,7 +183,8 @@
tr.Setup.Copy("ssl/signed-bar.key")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-bar.pem --key ./signed-bar.key --resolve 'bar.com:{0}:127.0.0.1' https://bar.com:{0}/case11".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-bar.pem --key ./signed-bar.key --resolve 'bar.com:{0}:127.0.0.1' https://bar.com:{0}/case11".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ExcludesExpression("error", "TLS handshake should succeed")
@@ -182,7 +193,8 @@
tr.Setup.Copy("ssl/server.key")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./server.pem --key ./server.key --resolve 'bar.com:{0}:127.0.0.1' https://bar.com:{0}/case12".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./server.pem --key ./server.key --resolve 'bar.com:{0}:127.0.0.1' https://bar.com:{0}/case12".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 35
@@ -190,13 +202,15 @@
tr = Test.AddTestRun("Connect to bob.com without cert, should fail")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --resolve 'bob.com:{0}:127.0.0.1' https://bob.com:{0}/case13".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --resolve 'bob.com:{0}:127.0.0.1' https://bob.com:{0}/case13".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 35
tr = Test.AddTestRun("Connect to bob.com.com without cert, should succeed")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --resolve 'bob.com.com:{0}:127.0.0.1' https://bob.com.com:{0}/case14".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --resolve 'bob.com.com:{0}:127.0.0.1' https://bob.com.com:{0}/case14".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr = Test.AddTestRun("Wait for the access log to write out")
diff --git a/tests/gold_tests/tls/tls_client_verify2.test.py b/tests/gold_tests/tls/tls_client_verify2.test.py
index 2285898fe8d..a265af76044 100644
--- a/tests/gold_tests/tls/tls_client_verify2.test.py
+++ b/tests/gold_tests/tls/tls_client_verify2.test.py
@@ -41,7 +41,7 @@
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
- 'proxy.config.url_remap.pristine_host_hdr' : 1,
+ 'proxy.config.url_remap.pristine_host_hdr': 1,
'proxy.config.ssl.client.certification_level': 0,
'proxy.config.ssl.CA.cert.path': '',
'proxy.config.exec_thread.autoconfig.scale': 1.0,
@@ -74,7 +74,8 @@
tr.Processes.Default.StartBefore(server)
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --resolve 'foo.com:{0}:127.0.0.1' https://foo.com:{0}/case1".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --resolve 'foo.com:{0}:127.0.0.1' https://foo.com:{0}/case1".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ExcludesExpression("error", "Check response")
@@ -83,14 +84,16 @@
tr.Setup.Copy("ssl/signed-foo.key")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-foo.pem --key ./signed-foo.key --resolve 'foo.com:{0}:127.0.0.1' https://foo.com:{0}/case1".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-foo.pem --key ./signed-foo.key --resolve 'foo.com:{0}:127.0.0.1' https://foo.com:{0}/case1".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ExcludesExpression("error", "Check response")
tr = Test.AddTestRun("Connect to bob.bar.com without cert")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --resolve 'bob.bar.com:{0}:127.0.0.1' https://bob.bar.com:{0}/case1".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --resolve 'bob.bar.com:{0}:127.0.0.1' https://bob.bar.com:{0}/case1".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 35
tr = Test.AddTestRun("Connect to bob.bar.com with cert")
@@ -98,7 +101,8 @@
tr.Setup.Copy("ssl/signed-bar.key")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-bob-bar.pem --key ./signed-bar.key --resolve 'bob.bar.com:{0}:127.0.0.1' https://bob.bar.com:{0}/case1".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-bob-bar.pem --key ./signed-bar.key --resolve 'bob.bar.com:{0}:127.0.0.1' https://bob.bar.com:{0}/case1".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ExcludesExpression("error", "TLS handshake should succeed")
@@ -107,13 +111,15 @@
tr.Setup.Copy("ssl/server.key")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./server.pem --key ./server.key --resolve 'bob.bar.com:{0}:127.0.0.1' https://bob.bar.com:{0}/case1".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./server.pem --key ./server.key --resolve 'bob.bar.com:{0}:127.0.0.1' https://bob.bar.com:{0}/case1".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 35
tr = Test.AddTestRun("Connect to bob.foo.com without cert")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --resolve 'bob.foo.com:{0}:127.0.0.1' https://bob.foo.com:{0}/case1".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --resolve 'bob.foo.com:{0}:127.0.0.1' https://bob.foo.com:{0}/case1".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 35
tr = Test.AddTestRun("Connect to bob.foo.com with cert")
@@ -121,7 +127,8 @@
tr.Setup.Copy("ssl/signed-foo.key")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-bob-foo.pem --key ./signed-foo.key --resolve 'bob.foo.com:{0}:127.0.0.1' https://bob.foo.com:{0}/case1".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-bob-foo.pem --key ./signed-foo.key --resolve 'bob.foo.com:{0}:127.0.0.1' https://bob.foo.com:{0}/case1".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ExcludesExpression("error", "TLS handshake should succeed")
@@ -130,13 +137,15 @@
tr.Setup.Copy("ssl/server.key")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./server.pem --key ./server.key --resolve 'bob.foo.com:{0}:127.0.0.1' https://bob.foo.com:{0}/case1".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./server.pem --key ./server.key --resolve 'bob.foo.com:{0}:127.0.0.1' https://bob.foo.com:{0}/case1".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 35
tr = Test.AddTestRun("Connect to bar.com without cert")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --resolve 'bar.com:{0}:127.0.0.1' https://bar.com:{0}/case1".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --resolve 'bar.com:{0}:127.0.0.1' https://bar.com:{0}/case1".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ExcludesExpression("alert", "TLS handshake should succeed")
@@ -145,7 +154,8 @@
tr.Setup.Copy("ssl/signed-bar.key")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-bar.pem --key ./signed-bar.key --resolve 'bar.com:{0}:127.0.0.1' https://bar.com:{0}/case1".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-bar.pem --key ./signed-bar.key --resolve 'bar.com:{0}:127.0.0.1' https://bar.com:{0}/case1".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ExcludesExpression("error", "Check response")
@@ -154,6 +164,7 @@
tr.Setup.Copy("ssl/server.key")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./server.pem --key ./server.key --resolve 'bar.com:{0}:127.0.0.1' https://bar.com:{0}/case1".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./server.pem --key ./server.key --resolve 'bar.com:{0}:127.0.0.1' https://bar.com:{0}/case1".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ExcludesExpression("alert unknown ca", "TLS handshake should succeed")
diff --git a/tests/gold_tests/tls/tls_client_versions.test.py b/tests/gold_tests/tls/tls_client_versions.test.py
index 2c44f4cb1e2..8f1085a51a5 100644
--- a/tests/gold_tests/tls/tls_client_versions.test.py
+++ b/tests/gold_tests/tls/tls_client_versions.test.py
@@ -62,33 +62,37 @@
# bar.com should terminate.
# empty SNI should tunnel to server_bar
ts.Disk.sni_yaml.AddLines([
- 'sni:',
- '- fqdn: foo.com',
- ' valid_tls_versions_in: [ TLSv1, TLSv1_1 ]'
+ 'sni:',
+ '- fqdn: foo.com',
+ ' valid_tls_versions_in: [ TLSv1, TLSv1_1 ]'
])
# Target foo.com for TLSv1_2. Should fail
tr = Test.AddTestRun("foo.com TLSv1_2")
tr.Processes.Default.StartBefore(server)
tr.Processes.Default.StartBefore(Test.Processes.ts)
-tr.Processes.Default.Command = "curl -v --tls-max 1.2 --tlsv1.2 --resolve 'foo.com:{0}:127.0.0.1' -k https://foo.com:{0}".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl -v --tls-max 1.2 --tlsv1.2 --resolve 'foo.com:{0}:127.0.0.1' -k https://foo.com:{0}".format(
+ ts.Variables.ssl_port)
tr.ReturnCode = 35
tr.StillRunningAfter = ts
# Target foo.com for TLSv1. Should succeed
tr = Test.AddTestRun("foo.com TLSv1")
-tr.Processes.Default.Command = "curl -v --tls-max 1.0 --tlsv1 --resolve 'foo.com:{0}:127.0.0.1' -k https://foo.com:{0}".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl -v --tls-max 1.0 --tlsv1 --resolve 'foo.com:{0}:127.0.0.1' -k https://foo.com:{0}".format(
+ ts.Variables.ssl_port)
tr.ReturnCode = 0
tr.StillRunningAfter = ts
# Target bar.com for TLSv1. Should fail
tr = Test.AddTestRun("bar.com TLSv1")
-tr.Processes.Default.Command = "curl -v --tls-max 1.0 --tlsv1 --resolve 'bar.com:{0}:127.0.0.1' -k https://bar.com:{0}".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl -v --tls-max 1.0 --tlsv1 --resolve 'bar.com:{0}:127.0.0.1' -k https://bar.com:{0}".format(
+ ts.Variables.ssl_port)
tr.ReturnCode = 35
tr.StillRunningAfter = ts
# Target bar.com for TLSv1_2. Should succeed
tr = Test.AddTestRun("bar.com TLSv1_2")
-tr.Processes.Default.Command = "curl -v --tls-max 1.2 --tlsv1.2 --resolve 'bar.com:{0}:127.0.0.1' -k https://bar.com:{0}".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl -v --tls-max 1.2 --tlsv1.2 --resolve 'bar.com:{0}:127.0.0.1' -k https://bar.com:{0}".format(
+ ts.Variables.ssl_port)
tr.ReturnCode = 0
tr.StillRunningAfter = ts
diff --git a/tests/gold_tests/tls/tls_engine.test.py b/tests/gold_tests/tls/tls_engine.test.py
index f883828f418..5be9f7c0e6f 100644
--- a/tests/gold_tests/tls/tls_engine.test.py
+++ b/tests/gold_tests/tls/tls_engine.test.py
@@ -39,8 +39,12 @@
# Add info the origin server responses
server.addResponse("sessionlog.json",
- {"headers": "GET / HTTP/1.1\r\nuuid: basic\r\n\r\n", "timestamp": "1469733493.993", "body": ""},
- {"headers": "HTTP/1.1 200 OK\r\nServer: microserver\r\nConnection: close\r\nCache-Control: max-age=3600\r\nContent-Length: 2\r\n\r\n", "timestamp": "1469733493.993", "body": "ok"})
+ {"headers": "GET / HTTP/1.1\r\nuuid: basic\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": ""},
+ {"headers": "HTTP/1.1 200 OK\r\nServer: microserver\r\nConnection: close\r\nCache-Control: max-age=3600\r\nContent-Length: 2\r\n\r\n",
+ "timestamp": "1469733493.993",
+ "body": "ok"})
# add ssl materials like key, certificates for the server
ts.addSSLfile("ssl/server.pem")
@@ -91,7 +95,7 @@
tr.ReturnCode = 0
tr.Processes.Default.StartBefore(server)
tr.Processes.Default.StartBefore(Test.Processes.ts, ready=When.PortOpen(ts.Variables.ssl_port))
-tr.Processes.Default.Streams.All = Testers.ContainsExpression("HTTP/(2|1\.1) 200", "Request succeeds")
+tr.Processes.Default.Streams.All = Testers.ContainsExpression(r"HTTP/(2|1\.1) 200", "Request succeeds")
tr.StillRunningAfter = server
ts.Streams.All += Testers.ContainsExpression("Send signal to ", "The Async engine triggers")
diff --git a/tests/gold_tests/tls/tls_forward_nonhttp.test.py b/tests/gold_tests/tls/tls_forward_nonhttp.test.py
index bd1887bfe70..891cf1a0d25 100644
--- a/tests/gold_tests/tls/tls_forward_nonhttp.test.py
+++ b/tests/gold_tests/tls/tls_forward_nonhttp.test.py
@@ -49,10 +49,10 @@
# foo.com should not terminate. Just tunnel to server_foo
# bar.com should terminate. Forward its tcp stream to server_bar
ts.Disk.sni_yaml.AddLines([
- "sni:",
- "- fqdn: bar.com",
- " forward_route: localhost:4444"
- ])
+ "sni:",
+ "- fqdn: bar.com",
+ " forward_route: localhost:4444"
+])
tr = Test.AddTestRun("forward-non-http")
tr.Setup.Copy("test-nc-s_client.sh")
@@ -61,5 +61,5 @@
tr.Processes.Default.StartBefore(Test.Processes.ts)
tr.StillRunningAfter = ts
testout_path = os.path.join(Test.RunDirectory, "test.out")
-tr.Disk.File(testout_path, id = "testout")
+tr.Disk.File(testout_path, id="testout")
tr.Processes.Default.Streams.All += Testers.IncludesExpression("This is a reply", "s_client should get response")
diff --git a/tests/gold_tests/tls/tls_hooks_client_verify.test.py b/tests/gold_tests/tls/tls_hooks_client_verify.test.py
index becb6a9ace6..5073a091872 100644
--- a/tests/gold_tests/tls/tls_hooks_client_verify.test.py
+++ b/tests/gold_tests/tls/tls_hooks_client_verify.test.py
@@ -70,7 +70,13 @@
' verify_client: STRICT',
])
-Test.PreparePlugin(os.path.join(Test.Variables.AtsTestToolsDir, 'plugins', 'ssl_client_verify_test.cc'), ts, '-count=2 -good=foo.com')
+Test.PreparePlugin(
+ os.path.join(
+ Test.Variables.AtsTestToolsDir,
+ 'plugins',
+ 'ssl_client_verify_test.cc'),
+ ts,
+ '-count=2 -good=foo.com')
tr = Test.AddTestRun("request good name")
tr.Setup.Copy("ssl/signed-foo.pem")
@@ -81,7 +87,8 @@
tr.Processes.Default.StartBefore(Test.Processes.ts)
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-foo.pem --key ./signed-foo.key --resolve 'foo.com:{0}:127.0.0.1' https://foo.com:{0}/case1".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-foo.pem --key ./signed-foo.key --resolve 'foo.com:{0}:127.0.0.1' https://foo.com:{0}/case1".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.all = Testers.ExcludesExpression("Could Not Connect", "Curl attempt should have succeeded")
@@ -89,7 +96,8 @@
tr2 = Test.AddTestRun("request bad name")
tr2.StillRunningAfter = ts
tr2.StillRunningAfter = server
-tr2.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-bar.pem --key ./signed-bar.key --resolve 'foo.com:{0}:127.0.0.1' https://foo.com:{0}/case1".format(ts.Variables.ssl_port)
+tr2.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-bar.pem --key ./signed-bar.key --resolve 'foo.com:{0}:127.0.0.1' https://foo.com:{0}/case1".format(
+ ts.Variables.ssl_port)
tr2.Processes.Default.ReturnCode = 35
tr2.Processes.Default.Streams.all = Testers.ContainsExpression("error", "Curl attempt should have failed")
@@ -98,11 +106,16 @@
tr3.Setup.Copy("ssl/server.key")
tr3.StillRunningAfter = ts
tr3.StillRunningAfter = server
-tr3.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./server.pem --key ./server.key --resolve 'foo.com:{0}:127.0.0.1' https://foo.com:{0}/case1".format(ts.Variables.ssl_port)
+tr3.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./server.pem --key ./server.key --resolve 'foo.com:{0}:127.0.0.1' https://foo.com:{0}/case1".format(
+ ts.Variables.ssl_port)
tr3.Processes.Default.ReturnCode = 35
tr3.Processes.Default.Streams.all = Testers.ContainsExpression("error", "Curl attempt should have failed")
-ts.Streams.All += Testers.ContainsExpression("Client verify callback 0 [\da-fx]+? - event is good good HS", "verify callback happens 2 times")
-ts.Streams.All += Testers.ContainsExpression("Client verify callback 1 [\da-fx]+? - event is good good HS", "verify callback happens 2 times")
-ts.Streams.All += Testers.ContainsExpression("Client verify callback 0 [\da-fx]+? - event is good error HS", "verify callback happens 2 times")
-ts.Streams.All += Testers.ContainsExpression("Client verify callback 1 [\da-fx]+? - event is good error HS", "verify callback happens 2 times")
+ts.Streams.All += Testers.ContainsExpression(
+ "Client verify callback 0 [\da-fx]+? - event is good good HS", "verify callback happens 2 times")
+ts.Streams.All += Testers.ContainsExpression(
+ "Client verify callback 1 [\da-fx]+? - event is good good HS", "verify callback happens 2 times")
+ts.Streams.All += Testers.ContainsExpression(
+ "Client verify callback 0 [\da-fx]+? - event is good error HS", "verify callback happens 2 times")
+ts.Streams.All += Testers.ContainsExpression(
+ "Client verify callback 1 [\da-fx]+? - event is good error HS", "verify callback happens 2 times")
diff --git a/tests/gold_tests/tls/tls_hooks_verify.test.py b/tests/gold_tests/tls/tls_hooks_verify.test.py
index 33e1f15814b..a17be4fb52e 100644
--- a/tests/gold_tests/tls/tls_hooks_verify.test.py
+++ b/tests/gold_tests/tls/tls_hooks_verify.test.py
@@ -55,17 +55,23 @@
'map https://bar.com:{1}/ https://127.0.0.1:{0}'.format(server.Variables.SSL_Port, ts.Variables.ssl_port)
)
ts.Disk.remap_config.AddLine(
- 'map https://random.com:{1}/ https://127.0.0.1:{0}'.format(server.Variables.SSL_Port,ts.Variables.ssl_port)
+ 'map https://random.com:{1}/ https://127.0.0.1:{0}'.format(server.Variables.SSL_Port, ts.Variables.ssl_port)
)
ts.Disk.sni_yaml.AddLine(
- 'sni:')
+ 'sni:')
ts.Disk.sni_yaml.AddLine(
- '- fqdn: bar.com')
+ '- fqdn: bar.com')
ts.Disk.sni_yaml.AddLine(
- ' verify_server_policy: PERMISSIVE')
+ ' verify_server_policy: PERMISSIVE')
-Test.PreparePlugin(os.path.join(Test.Variables.AtsTestToolsDir, 'plugins', 'ssl_verify_test.cc'), ts, '-count=2 -bad=random.com -bad=bar.com')
+Test.PreparePlugin(
+ os.path.join(
+ Test.Variables.AtsTestToolsDir,
+ 'plugins',
+ 'ssl_verify_test.cc'),
+ ts,
+ '-count=2 -bad=random.com -bad=bar.com')
tr = Test.AddTestRun("request good name")
tr.Processes.Default.StartBefore(server)
@@ -80,7 +86,8 @@
tr2 = Test.AddTestRun("request bad name")
tr2.StillRunningAfter = ts
tr2.StillRunningAfter = server
-tr2.Processes.Default.Command = "curl --resolve \"random.com:{0}:127.0.0.1\" -k https://random.com:{0}".format(ts.Variables.ssl_port)
+tr2.Processes.Default.Command = "curl --resolve \"random.com:{0}:127.0.0.1\" -k https://random.com:{0}".format(
+ ts.Variables.ssl_port)
tr2.Processes.Default.ReturnCode = 0
tr2.Processes.Default.Streams.stdout = Testers.ContainsExpression("Could Not Connect", "Curl attempt should have failed")
@@ -92,13 +99,29 @@
tr3.Processes.Default.Streams.stdout = Testers.ExcludesExpression("Could Not Connect", "Curl attempt should have failed")
# Over riding the built in ERROR check since we expect tr2 to fail
-ts.Disk.diags_log.Content = Testers.ContainsExpression("WARNING: TS_EVENT_SSL_VERIFY_SERVER plugin failed the origin certificate check for 127.0.0.1. Action=Terminate SNI=random.com", "random.com should fail")
-ts.Disk.diags_log.Content += Testers.ContainsExpression("WARNING: TS_EVENT_SSL_VERIFY_SERVER plugin failed the origin certificate check for 127.0.0.1. Action=Continue SNI=bar.com", "bar.com should fail but continue")
+ts.Disk.diags_log.Content = Testers.ContainsExpression(
+ "WARNING: TS_EVENT_SSL_VERIFY_SERVER plugin failed the origin certificate check for 127.0.0.1. Action=Terminate SNI=random.com",
+ "random.com should fail")
+ts.Disk.diags_log.Content += Testers.ContainsExpression(
+ "WARNING: TS_EVENT_SSL_VERIFY_SERVER plugin failed the origin certificate check for 127.0.0.1. Action=Continue SNI=bar.com",
+ "bar.com should fail but continue")
ts.Disk.diags_log.Content += Testers.ExcludesExpression("SNI=foo.com", "foo.com should not fail in any way")
-ts.Streams.All += Testers.ContainsExpression("Server verify callback 0 [\da-fx]+? - event is good SNI=foo.com good HS", "verify callback happens 2 times")
-ts.Streams.All += Testers.ContainsExpression("Server verify callback 1 [\da-fx]+? - event is good SNI=foo.com good HS", "verify callback happens 2 times")
-ts.Streams.All += Testers.ContainsExpression("Server verify callback 0 [\da-fx]+? - event is good SNI=random.com error HS", "verify callback happens 2 times")
-ts.Streams.All += Testers.ContainsExpression("Server verify callback 1 [\da-fx]+? - event is good SNI=random.com error HS", "verify callback happens 2 times")
-ts.Streams.All += Testers.ContainsExpression("Server verify callback 0 [\da-fx]+? - event is good SNI=bar.com error HS", "verify callback happens 2 times")
-ts.Streams.All += Testers.ContainsExpression("Server verify callback 1 [\da-fx]+? - event is good SNI=bar.com error HS", "verify callback happens 2 times")
+ts.Streams.All += Testers.ContainsExpression(
+ r"Server verify callback 0 [\da-fx]+? - event is good SNI=foo.com good HS",
+ "verify callback happens 2 times")
+ts.Streams.All += Testers.ContainsExpression(
+ r"Server verify callback 1 [\da-fx]+? - event is good SNI=foo.com good HS",
+ "verify callback happens 2 times")
+ts.Streams.All += Testers.ContainsExpression(
+ r"Server verify callback 0 [\da-fx]+? - event is good SNI=random.com error HS",
+ "verify callback happens 2 times")
+ts.Streams.All += Testers.ContainsExpression(
+ r"Server verify callback 1 [\da-fx]+? - event is good SNI=random.com error HS",
+ "verify callback happens 2 times")
+ts.Streams.All += Testers.ContainsExpression(
+ r"Server verify callback 0 [\da-fx]+? - event is good SNI=bar.com error HS",
+ "verify callback happens 2 times")
+ts.Streams.All += Testers.ContainsExpression(
+ r"Server verify callback 1 [\da-fx]+? - event is good SNI=bar.com error HS",
+ "verify callback happens 2 times")
diff --git a/tests/gold_tests/tls/tls_keepalive.test.py b/tests/gold_tests/tls/tls_keepalive.test.py
index 11d39aa1f32..b2014638bb8 100644
--- a/tests/gold_tests/tls/tls_keepalive.test.py
+++ b/tests/gold_tests/tls/tls_keepalive.test.py
@@ -55,7 +55,7 @@
)
ts.Disk.logging_yaml.AddLines(
-'''
+ '''
logging:
formats:
- name: testformat
@@ -74,25 +74,29 @@
tr.Processes.Default.StartBefore(Test.Processes.ts)
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = 'curl -k -v --http1.1 -H \'host:example.com:{0}\' https://127.0.0.1:{0} https://127.0.0.1:{0}'.format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = 'curl -k -v --http1.1 -H \'host:example.com:{0}\' https://127.0.0.1:{0} https://127.0.0.1:{0}'.format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr = Test.AddTestRun("Test two HTTP/1.1 requests over two TLS connections")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = 'curl -k -v --http1.1 -H \'host:example.com:{0}\' https://127.0.0.1:{0}; curl -k -v --http1.1 -H \'host:example.com:{0}\' https://127.0.0.1:{0}'.format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = 'curl -k -v --http1.1 -H \'host:example.com:{0}\' https://127.0.0.1:{0}; curl -k -v --http1.1 -H \'host:example.com:{0}\' https://127.0.0.1:{0}'.format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr = Test.AddTestRun("Test two HTTP/2 requests over one TLS connection")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = 'curl -k -v --http2 -H \'host:example.com:{0}\' https://127.0.0.1:{0} https://127.0.0.1:{0}'.format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = 'curl -k -v --http2 -H \'host:example.com:{0}\' https://127.0.0.1:{0} https://127.0.0.1:{0}'.format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr = Test.AddTestRun("Test two HTTP/2 requests over two TLS connections")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = 'curl -k -v --http2 -H \'host:example.com:{0}\' https://127.0.0.1:{0}; curl -k -v --http1.1 -H \'host:example.com:{0}\' https://127.0.0.1:{0}'.format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = 'curl -k -v --http2 -H \'host:example.com:{0}\' https://127.0.0.1:{0}; curl -k -v --http1.1 -H \'host:example.com:{0}\' https://127.0.0.1:{0}'.format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
# Just a check to flush out the traffic log until we have a clean shutdown for traffic_server
diff --git a/tests/gold_tests/tls/tls_ocsp.test.py b/tests/gold_tests/tls/tls_ocsp.test.py
index 127071b1eac..12d91e4246e 100644
--- a/tests/gold_tests/tls/tls_ocsp.test.py
+++ b/tests/gold_tests/tls/tls_ocsp.test.py
@@ -66,5 +66,6 @@
tr.Processes.Default.StartBefore(Test.Processes.ts)
tr.StillRunningAfter = server
tr.StillRunningAfter = ts
-tr.Processes.Default.Command = "curl -v --cacert {0} --cert-status -H \"host:example.com\" https://127.0.0.1:{1}".format(os.path.join(ts.Variables.SSLDir, "ca.ocsp.pem"), ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl -v --cacert {0} --cert-status -H \"host:example.com\" https://127.0.0.1:{1}".format(
+ os.path.join(ts.Variables.SSLDir, "ca.ocsp.pem"), ts.Variables.ssl_port)
tr.ReturnCode = 0
diff --git a/tests/gold_tests/tls/tls_partial_blind_tunnel.test.py b/tests/gold_tests/tls/tls_partial_blind_tunnel.test.py
index 59def6806a8..44c506274c2 100644
--- a/tests/gold_tests/tls/tls_partial_blind_tunnel.test.py
+++ b/tests/gold_tests/tls/tls_partial_blind_tunnel.test.py
@@ -51,13 +51,14 @@
# foo.com should terminate. and reconnect via TLS upstream to bar.com
ts.Disk.sni_yaml.AddLines([
- "sni:",
- "- fqdn: 'foo.com'",
- " partial_blind_route: 'localhost:{0}'".format(server_bar.Variables.SSL_Port),
- ])
+ "sni:",
+ "- fqdn: 'foo.com'",
+ " partial_blind_route: 'localhost:{0}'".format(server_bar.Variables.SSL_Port),
+])
tr = Test.AddTestRun("Partial Blind Route")
-tr.Processes.Default.Command = "curl --http1.1 -v --resolve 'foo.com:{0}:127.0.0.1' -k https://foo.com:{0}".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --http1.1 -v --resolve 'foo.com:{0}:127.0.0.1' -k https://foo.com:{0}".format(
+ ts.Variables.ssl_port)
tr.ReturnCode = 0
tr.Processes.Default.StartBefore(server_bar)
tr.Processes.Default.StartBefore(Test.Processes.ts)
diff --git a/tests/gold_tests/tls/tls_session_cache.test.py b/tests/gold_tests/tls/tls_session_cache.test.py
index db413539bf3..5146103705f 100644
--- a/tests/gold_tests/tls/tls_session_cache.test.py
+++ b/tests/gold_tests/tls/tls_session_cache.test.py
@@ -58,30 +58,33 @@
})
# Check that Session-ID is the same on every connection
-def checkSession(ev) :
- retval = False
- f = open(openssl_output, 'r')
- err = "Session ids match"
- if not f:
- err = "Failed to open {0}".format(openssl_output)
- return (retval, "Check that session ids match", err)
- content = f.read()
- match = re.findall('Session-ID: ([0-9A-F]+)', content)
- if match:
- if all(i == j for i, j in zip(match, match[1:])):
- err = "{0} reused successfully {1} times".format(match[0], len(match))
- retval = True
+def checkSession(ev):
+ retval = False
+ f = open(openssl_output, 'r')
+ err = "Session ids match"
+ if not f:
+ err = "Failed to open {0}".format(openssl_output)
+ return (retval, "Check that session ids match", err)
+
+ content = f.read()
+ match = re.findall('Session-ID: ([0-9A-F]+)', content)
+
+ if match:
+ if all(i == j for i, j in zip(match, match[1:])):
+ err = "{0} reused successfully {1} times".format(match[0], len(match))
+ retval = True
+ else:
+ err = "Session is not being reused as expected"
else:
- err = "Session is not being reused as expected"
- else:
- err = "Didn't find session id"
- return (retval, "Check that session ids match", err)
+ err = "Didn't find session id"
+ return (retval, "Check that session ids match", err)
tr = Test.AddTestRun("OpenSSL s_client -reconnect")
-tr.Command = 'echo -e "GET / HTTP/1.0\r\n" | openssl s_client -tls1_2 -connect 127.0.0.1:{0} -reconnect'.format(ts.Variables.ssl_port)
+tr.Command = 'echo -e "GET / HTTP/1.0\r\n" | openssl s_client -tls1_2 -connect 127.0.0.1:{0} -reconnect'.format(
+ ts.Variables.ssl_port)
tr.ReturnCode = 0
# time delay as proxy.config.http.wait_for_cache could be broken
tr.Processes.Default.StartBefore(server)
diff --git a/tests/gold_tests/tls/tls_sni_host_policy.test.py b/tests/gold_tests/tls/tls_sni_host_policy.test.py
index bd2ac5b2a37..70d18feeae5 100644
--- a/tests/gold_tests/tls/tls_sni_host_policy.test.py
+++ b/tests/gold_tests/tls/tls_sni_host_policy.test.py
@@ -40,8 +40,8 @@
ts.Disk.records_config.update({
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.ssl.client.verify.server': 0,
- 'proxy.config.url_remap.pristine_host_hdr' : 1,
+ 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.url_remap.pristine_host_hdr': 1,
'proxy.config.ssl.CA.cert.filename': '{0}/signer.pem'.format(ts.Variables.SSLDir),
'proxy.config.exec_thread.autoconfig.scale': 1.0,
'proxy.config.http.host_sni_policy': 2,
@@ -74,7 +74,8 @@
tr.Processes.Default.StartBefore(server)
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k -H 'host:dave' --resolve 'bob:{0}:127.0.0.1' https://bob:{0}/case1".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k -H 'host:dave' --resolve 'bob:{0}:127.0.0.1' https://bob:{0}/case1".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 35
# case 2
@@ -84,7 +85,8 @@
tr.Setup.Copy("ssl/signed-foo.key")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-foo.pem --key ./signed-foo.key -H 'host:dave' --resolve 'bob:{0}:127.0.0.1' https://bob:{0}/case1".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-foo.pem --key ./signed-foo.key -H 'host:dave' --resolve 'bob:{0}:127.0.0.1' https://bob:{0}/case1".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
# case 3
@@ -92,7 +94,8 @@
tr = Test.AddTestRun("Connect to dave without cert")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k -H 'host:bob' --resolve 'dave:{0}:127.0.0.1' https://dave:{0}/case1".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k -H 'host:bob' --resolve 'dave:{0}:127.0.0.1' https://dave:{0}/case1".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ContainsExpression("Access Denied", "Check response")
@@ -101,7 +104,8 @@
tr = Test.AddTestRun("Connect to dave with cert")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-foo.pem --key ./signed-foo.key -H 'host:bob' --resolve 'dave:{0}:127.0.0.1' https://dave:{0}/case1".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-foo.pem --key ./signed-foo.key -H 'host:bob' --resolve 'dave:{0}:127.0.0.1' https://dave:{0}/case1".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ContainsExpression("Access Denied", "Check response")
@@ -110,7 +114,8 @@
tr = Test.AddTestRun("Connect to ellen without cert")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k -H 'host:boblite' --resolve 'ellen:{0}:127.0.0.1' https://ellen:{0}/warnonly".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k -H 'host:boblite' --resolve 'ellen:{0}:127.0.0.1' https://ellen:{0}/warnonly".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ExcludesExpression("Access Denied", "Check response")
@@ -119,7 +124,8 @@
tr = Test.AddTestRun("Connect to ellen with cert")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-foo.pem --key ./signed-foo.key -H 'host:boblite' --resolve 'ellen:{0}:127.0.0.1' https://ellen:{0}/warnonly".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-foo.pem --key ./signed-foo.key -H 'host:boblite' --resolve 'ellen:{0}:127.0.0.1' https://ellen:{0}/warnonly".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ExcludesExpression("Access Denied", "Check response")
@@ -128,7 +134,8 @@
tr = Test.AddTestRun("Connect to ellen without cert")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k -H 'host:fran' --resolve 'ellen:{0}:127.0.0.1' https://ellen:{0}/warnonly".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k -H 'host:fran' --resolve 'ellen:{0}:127.0.0.1' https://ellen:{0}/warnonly".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ExcludesExpression("Access Denied", "Check response")
@@ -137,11 +144,15 @@
tr = Test.AddTestRun("Connect to ellen with cert")
tr.StillRunningAfter = ts
tr.StillRunningAfter = server
-tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-foo.pem --key ./signed-foo.key -H 'host:fran' --resolve 'ellen:{0}:127.0.0.1' https://ellen:{0}/warnonly".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./signed-foo.pem --key ./signed-foo.key -H 'host:fran' --resolve 'ellen:{0}:127.0.0.1' https://ellen:{0}/warnonly".format(
+ ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.All = Testers.ExcludesExpression("Access Denied", "Check response")
-ts.Disk.diags_log.Content += Testers.ContainsExpression("WARNING: SNI/hostname mismatch sni=dave host=bob action=terminate", "Should have warning on mismatch")
-ts.Disk.diags_log.Content += Testers.ContainsExpression("WARNING: SNI/hostname mismatch sni=ellen host=boblite action=continue", "Should have warning on mismatch")
-ts.Disk.diags_log.Content += Testers.ExcludesExpression("WARNING: SNI/hostname mismatch sni=ellen host=fran", "Should not have warning on mismatch with non-policy host")
+ts.Disk.diags_log.Content += Testers.ContainsExpression(
+ "WARNING: SNI/hostname mismatch sni=dave host=bob action=terminate", "Should have warning on mismatch")
+ts.Disk.diags_log.Content += Testers.ContainsExpression(
+ "WARNING: SNI/hostname mismatch sni=ellen host=boblite action=continue", "Should have warning on mismatch")
+ts.Disk.diags_log.Content += Testers.ExcludesExpression("WARNING: SNI/hostname mismatch sni=ellen host=fran",
+ "Should not have warning on mismatch with non-policy host")
diff --git a/tests/gold_tests/tls/tls_ticket.test.py b/tests/gold_tests/tls/tls_ticket.test.py
index dc0ae55012d..a8fc3b9b02d 100644
--- a/tests/gold_tests/tls/tls_ticket.test.py
+++ b/tests/gold_tests/tls/tls_ticket.test.py
@@ -72,7 +72,8 @@
tr = Test.AddTestRun("Create ticket")
tr.Setup.Copy('file.ticket')
-tr.Command = 'echo -e "GET / HTTP/1.0\r\n" | openssl s_client -tls1_2 -connect 127.0.0.1:{0} -sess_out ticket.out'.format(ts.Variables.ssl_port)
+tr.Command = 'echo -e "GET / HTTP/1.0\r\n" | openssl s_client -tls1_2 -connect 127.0.0.1:{0} -sess_out ticket.out'.format(
+ ts.Variables.ssl_port)
tr.ReturnCode = 0
# time delay as proxy.config.http.wait_for_cache could be broken
tr.Processes.Default.StartBefore(server)
@@ -81,33 +82,37 @@
tr.StillRunningAfter = server
# Pull out session created in tr to test for session id in tr2
-def checkSession(ev) :
- retval = False
- f1 = open(path1, 'r')
- f2 = open(path2, 'r')
- err = "Session ids match"
- if not f1 or not f2:
- err = "Failed to open {0} or {1}".format(path1, path2)
- return (retval, "Check that session ids match", err)
- f1Content = f1.read()
- f2Content = f2.read()
- match1 = re.findall('Session-ID: ([0-9A-F]+)', f1Content)
- match2 = re.findall('Session-ID: ([0-9A-F]+)', f2Content)
- if match1 and match2:
- if match1[0] == match2[0]:
- err = "{0} and {1} do match".format(match1[0], match2[0])
- retval = True
+def checkSession(ev):
+ retval = False
+ f1 = open(path1, 'r')
+ f2 = open(path2, 'r')
+ err = "Session ids match"
+ if not f1 or not f2:
+ err = "Failed to open {0} or {1}".format(path1, path2)
+ return (retval, "Check that session ids match", err)
+
+ f1Content = f1.read()
+ f2Content = f2.read()
+ match1 = re.findall('Session-ID: ([0-9A-F]+)', f1Content)
+ match2 = re.findall('Session-ID: ([0-9A-F]+)', f2Content)
+
+ if match1 and match2:
+ if match1[0] == match2[0]:
+ err = "{0} and {1} do match".format(match1[0], match2[0])
+ retval = True
+ else:
+ err = "{0} and {1} do not match".format(match1[0], match2[0])
else:
- err = "{0} and {1} do not match".format(match1[0], match2[0])
- else:
- err = "Didn't find session id"
- return (retval, "Check that session ids match", err)
+ err = "Didn't find session id"
+ return (retval, "Check that session ids match", err)
+
tr2 = Test.AddTestRun("Test ticket")
tr2.Setup.Copy('file.ticket')
-tr2.Command = 'echo -e "GET / HTTP/1.0\r\n" | openssl s_client -tls1_2 -connect 127.0.0.1:{0} -sess_in ticket.out'.format(ts2.Variables.ssl_port)
+tr2.Command = 'echo -e "GET / HTTP/1.0\r\n" | openssl s_client -tls1_2 -connect 127.0.0.1:{0} -sess_in ticket.out'.format(
+ ts2.Variables.ssl_port)
tr2.Processes.Default.StartBefore(Test.Processes.ts2)
tr2.ReturnCode = 0
path2 = tr2.Processes.Default.Streams.stdout.AbsPath
diff --git a/tests/gold_tests/tls/tls_tunnel.test.py b/tests/gold_tests/tls/tls_tunnel.test.py
index 384aca32bb5..9b2846400f2 100644
--- a/tests/gold_tests/tls/tls_tunnel.test.py
+++ b/tests/gold_tests/tls/tls_tunnel.test.py
@@ -60,7 +60,7 @@
ts.Disk.records_config.update({
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.http.connect_ports': '{0} {1} {2}'.format(ts.Variables.ssl_port,server_foo.Variables.SSL_Port,server_bar.Variables.SSL_Port),
+ 'proxy.config.http.connect_ports': '{0} {1} {2}'.format(ts.Variables.ssl_port, server_foo.Variables.SSL_Port, server_bar.Variables.SSL_Port),
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
'proxy.config.ssl.client.CA.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.client.CA.cert.filename': 'signer.pem',
@@ -74,17 +74,17 @@
# bar.com should terminate. Forward its tcp stream to server_bar
# empty SNI should tunnel to server_bar
ts.Disk.sni_yaml.AddLines([
- 'sni:',
- '- fqdn: foo.com',
- " tunnel_route: localhost:{0}".format(server_foo.Variables.SSL_Port),
- "- fqdn: bob.*.com",
- " tunnel_route: localhost:{0}".format(server_foo.Variables.SSL_Port),
- "- fqdn: '*.match.com'",
- " tunnel_route: $1.testmatch:{0}".format(server_foo.Variables.SSL_Port),
- "- fqdn: '*.ok.*.com'",
- " tunnel_route: $2.example.$1:{0}".format(server_foo.Variables.SSL_Port),
- "- fqdn: ''", # No SNI sent
- " tunnel_route: localhost:{0}".format(server_bar.Variables.SSL_Port)
+ 'sni:',
+ '- fqdn: foo.com',
+ " tunnel_route: localhost:{0}".format(server_foo.Variables.SSL_Port),
+ "- fqdn: bob.*.com",
+ " tunnel_route: localhost:{0}".format(server_foo.Variables.SSL_Port),
+ "- fqdn: '*.match.com'",
+ " tunnel_route: $1.testmatch:{0}".format(server_foo.Variables.SSL_Port),
+ "- fqdn: '*.ok.*.com'",
+ " tunnel_route: $2.example.$1:{0}".format(server_foo.Variables.SSL_Port),
+ "- fqdn: ''", # No SNI sent
+ " tunnel_route: localhost:{0}".format(server_bar.Variables.SSL_Port)
])
tr = Test.AddTestRun("foo.com Tunnel-test")
@@ -96,18 +96,21 @@
tr.Processes.Default.StartBefore(Test.Processes.ts)
tr.StillRunningAfter = ts
tr.Processes.Default.Streams.All += Testers.ExcludesExpression("Could Not Connect", "Curl attempt should have succeeded")
-tr.Processes.Default.Streams.All += Testers.ExcludesExpression("Not Found on Accelerato", "Should not try to remap on Traffic Server")
+tr.Processes.Default.Streams.All += Testers.ExcludesExpression(
+ "Not Found on Accelerato", "Should not try to remap on Traffic Server")
tr.Processes.Default.Streams.All += Testers.ExcludesExpression("CN=foo.com", "Should not TLS terminate on Traffic Server")
tr.Processes.Default.Streams.All += Testers.ContainsExpression("HTTP/1.1 200 OK", "Should get a successful response")
tr.Processes.Default.Streams.All += Testers.ExcludesExpression("ATS", "Do not terminate on Traffic Server")
tr.Processes.Default.Streams.All += Testers.ContainsExpression("foo ok", "Should get a response from bar")
tr = Test.AddTestRun("bob.bar.com Tunnel-test")
-tr.Processes.Default.Command = "curl -v --resolve 'bob.bar.com:{0}:127.0.0.1' -k https://bob.bar.com:{0}".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl -v --resolve 'bob.bar.com:{0}:127.0.0.1' -k https://bob.bar.com:{0}".format(
+ ts.Variables.ssl_port)
tr.ReturnCode = 0
tr.StillRunningAfter = ts
tr.Processes.Default.Streams.All += Testers.ExcludesExpression("Could Not Connect", "Curl attempt should have succeeded")
-tr.Processes.Default.Streams.All += Testers.ExcludesExpression("Not Found on Accelerato", "Should not try to remap on Traffic Server")
+tr.Processes.Default.Streams.All += Testers.ExcludesExpression(
+ "Not Found on Accelerato", "Should not try to remap on Traffic Server")
tr.Processes.Default.Streams.All += Testers.ExcludesExpression("CN=foo.com", "Should not TLS terminate on Traffic Server")
tr.Processes.Default.Streams.All += Testers.ContainsExpression("HTTP/1.1 200 OK", "Should get a successful response")
tr.Processes.Default.Streams.All += Testers.ExcludesExpression("ATS", "Do not terminate on Traffic Server")
@@ -126,18 +129,21 @@
tr.ReturnCode = 0
tr.StillRunningAfter = ts
tr.Processes.Default.Streams.All += Testers.ExcludesExpression("Could Not Connect", "Curl attempt should have succeeded")
-tr.Processes.Default.Streams.All += Testers.ExcludesExpression("Not Found on Accelerato", "Should not try to remap on Traffic Server")
+tr.Processes.Default.Streams.All += Testers.ExcludesExpression(
+ "Not Found on Accelerato", "Should not try to remap on Traffic Server")
tr.Processes.Default.Streams.All += Testers.ContainsExpression("HTTP/1.1 200 OK", "Should get a successful response")
tr.Processes.Default.Streams.All += Testers.ExcludesExpression("ATS", "Do not terminate on Traffic Server")
tr.Processes.Default.Streams.All += Testers.ContainsExpression("bar ok", "Should get a response from bar")
tr = Test.AddTestRun("one.match.com Tunnel-test")
-tr.Processes.Default.Command = "curl -vvv --resolve 'one.match.com:{0}:127.0.0.1' -k https://one.match.com:{0}".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl -vvv --resolve 'one.match.com:{0}:127.0.0.1' -k https://one.match.com:{0}".format(
+ ts.Variables.ssl_port)
tr.ReturnCode = 0
tr.StillRunningAfter = ts
tr.Processes.Default.Streams.All += Testers.ExcludesExpression("Could Not Connect", "Curl attempt should have succeeded")
-tr.Processes.Default.Streams.All += Testers.ExcludesExpression("Not Found on Accelerato", "Should not try to remap on Traffic Server")
+tr.Processes.Default.Streams.All += Testers.ExcludesExpression(
+ "Not Found on Accelerato", "Should not try to remap on Traffic Server")
tr.Processes.Default.Streams.All += Testers.ExcludesExpression("CN=foo.com", "Should not TLS terminate on Traffic Server")
tr.Processes.Default.Streams.All += Testers.ContainsExpression("HTTP/1.1 200 OK", "Should get a successful response")
tr.Processes.Default.Streams.All += Testers.ExcludesExpression("ATS", "Do not terminate on Traffic Server")
@@ -145,11 +151,13 @@
tr = Test.AddTestRun("one.ok.two.com Tunnel-test")
-tr.Processes.Default.Command = "curl -vvv --resolve 'one.ok.two.com:{0}:127.0.0.1' -k https:/one.ok.two.com:{0}".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl -vvv --resolve 'one.ok.two.com:{0}:127.0.0.1' -k https:/one.ok.two.com:{0}".format(
+ ts.Variables.ssl_port)
tr.ReturnCode = 0
tr.StillRunningAfter = ts
tr.Processes.Default.Streams.All += Testers.ExcludesExpression("Could Not Connect", "Curl attempt should have succeeded")
-tr.Processes.Default.Streams.All += Testers.ExcludesExpression("Not Found on Accelerato", "Should not try to remap on Traffic Server")
+tr.Processes.Default.Streams.All += Testers.ExcludesExpression(
+ "Not Found on Accelerato", "Should not try to remap on Traffic Server")
tr.Processes.Default.Streams.All += Testers.ExcludesExpression("CN=foo.com", "Should not TLS terminate on Traffic Server")
tr.Processes.Default.Streams.All += Testers.ContainsExpression("HTTP/1.1 200 OK", "Should get a successful response")
tr.Processes.Default.Streams.All += Testers.ExcludesExpression("ATS", "Do not terminate on Traffic Server")
@@ -161,11 +169,11 @@
# Update the SNI config
snipath = ts.Disk.sni_yaml.AbsPath
recordspath = ts.Disk.records_config.AbsPath
-tr.Disk.File(snipath, id = "sni_yaml", typename="ats:config"),
+tr.Disk.File(snipath, id="sni_yaml", typename="ats:config"),
tr.Disk.sni_yaml.AddLines([
- 'sni:',
- '- fqdn: bar.com',
- ' tunnel_route: localhost:{0}'.format(server_bar.Variables.SSL_Port),
+ 'sni:',
+ '- fqdn: bar.com',
+ ' tunnel_route: localhost:{0}'.format(server_bar.Variables.SSL_Port),
])
tr.StillRunningAfter = ts
tr.StillRunningAfter = server_foo
diff --git a/tests/gold_tests/tls/tls_tunnel_forward.test.py b/tests/gold_tests/tls/tls_tunnel_forward.test.py
index 8288f238328..c604c6a46a1 100644
--- a/tests/gold_tests/tls/tls_tunnel_forward.test.py
+++ b/tests/gold_tests/tls/tls_tunnel_forward.test.py
@@ -31,7 +31,8 @@
request_random_header = {"headers": "GET / HTTP/1.1\r\nHost: random.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
response_foo_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": "ok foo"}
response_bar_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": "ok bar"}
-response_random_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": "ok random"}
+response_random_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n",
+ "timestamp": "1469733493.993", "body": "ok random"}
server_foo.addResponse("sessionlog_foo.json", request_foo_header, response_foo_header)
server_bar.addResponse("sessionlog_bar.json", request_bar_header, response_bar_header)
server_random.addResponse("sessionlog_random.json", request_random_header, response_random_header)
@@ -69,14 +70,14 @@
# foo.com should not terminate. Just tunnel to server_foo
# bar.com should terminate. Forward its tcp stream to server_bar
ts.Disk.sni_yaml.AddLines([
- "sni:",
- "- fqdn: 'foo.com'",
- " tunnel_route: 'localhost:{0}'".format(server_foo.Variables.SSL_Port),
- "- fqdn: 'bar.com'",
- " forward_route: 'localhost:{0}'".format(server_bar.Variables.Port),
- "- fqdn: ''", #default case
- " forward_route: 'localhost:{0}'".format(server_random.Variables.Port),
- ])
+ "sni:",
+ "- fqdn: 'foo.com'",
+ " tunnel_route: 'localhost:{0}'".format(server_foo.Variables.SSL_Port),
+ "- fqdn: 'bar.com'",
+ " forward_route: 'localhost:{0}'".format(server_bar.Variables.Port),
+ "- fqdn: ''", # default case
+ " forward_route: 'localhost:{0}'".format(server_random.Variables.Port),
+])
tr = Test.AddTestRun("Tunnel-test")
tr.Processes.Default.Command = "curl -v --resolve 'foo.com:{0}:127.0.0.1' -k https://foo.com:{0}".format(ts.Variables.ssl_port)
@@ -87,18 +88,21 @@
tr.Processes.Default.StartBefore(Test.Processes.ts)
tr.StillRunningAfter = ts
tr.Processes.Default.Streams.All += Testers.ExcludesExpression("Could Not Connect", "Curl attempt should have succeeded")
-tr.Processes.Default.Streams.All += Testers.ExcludesExpression("Not Found on Accelerato", "Should not try to remap on Traffic Server")
+tr.Processes.Default.Streams.All += Testers.ExcludesExpression(
+ "Not Found on Accelerato", "Should not try to remap on Traffic Server")
tr.Processes.Default.Streams.All += Testers.ExcludesExpression("CN=foo.com", "Should not TLS terminate on Traffic Server")
tr.Processes.Default.Streams.All += Testers.ContainsExpression("HTTP/1.1 200 OK", "Should get a successful response")
tr.Processes.Default.Streams.All += Testers.ContainsExpression("ok foo", "Body is expected")
tr2 = Test.AddTestRun("Forward-test")
-tr2.Processes.Default.Command = "curl -v --http1.1 -H 'host:bar.com' --resolve 'bar.com:{0}:127.0.0.1' -k https://bar.com:{0}".format(ts.Variables.ssl_port)
+tr2.Processes.Default.Command = "curl -v --http1.1 -H 'host:bar.com' --resolve 'bar.com:{0}:127.0.0.1' -k https://bar.com:{0}".format(
+ ts.Variables.ssl_port)
tr2.ReturnCode = 0
tr2.StillRunningAfter = server_bar
tr2.StillRunningAfter = ts
tr2.Processes.Default.Streams.All += Testers.ExcludesExpression("Could Not Connect", "Curl attempt should have succeeded")
-tr2.Processes.Default.Streams.All += Testers.ExcludesExpression("Not Found on Accelerato", "Should not try to remap on Traffic Server")
+tr2.Processes.Default.Streams.All += Testers.ExcludesExpression(
+ "Not Found on Accelerato", "Should not try to remap on Traffic Server")
tr2.Processes.Default.Streams.All += Testers.ContainsExpression("CN=foo.com", "Should TLS terminate on Traffic Server")
tr2.Processes.Default.Streams.All += Testers.ContainsExpression("HTTP/1.1 200 OK", "Should get a successful response")
tr2.Processes.Default.Streams.All += Testers.ContainsExpression("ok bar", "Body is expected")
@@ -109,7 +113,8 @@
tr3.StillRunningAfter = server_random
tr3.StillRunningAfter = ts
tr3.Processes.Default.Streams.All += Testers.ExcludesExpression("Could Not Connect", "Curl attempt should have succeeded")
-tr3.Processes.Default.Streams.All += Testers.ExcludesExpression("Not Found on Accelerato", "Should not try to remap on Traffic Server")
+tr3.Processes.Default.Streams.All += Testers.ExcludesExpression(
+ "Not Found on Accelerato", "Should not try to remap on Traffic Server")
tr3.Processes.Default.Streams.All += Testers.ContainsExpression("CN=foo.com", "Should TLS terminate on Traffic Server")
tr3.Processes.Default.Streams.All += Testers.ContainsExpression("HTTP/1.1 200 OK", "Should get a successful response")
tr3.Processes.Default.Streams.All += Testers.ContainsExpression("ok random", "Body is expected")
diff --git a/tests/gold_tests/tls/tls_verify.test.py b/tests/gold_tests/tls/tls_verify.test.py
index 289d1ac8cbf..2c961b477df 100644
--- a/tests/gold_tests/tls/tls_verify.test.py
+++ b/tests/gold_tests/tls/tls_verify.test.py
@@ -22,9 +22,18 @@
# Define default ATS
ts = Test.MakeATSProcess("ts", select_ports=True, enable_tls=True)
-server_foo = Test.MakeOriginServer("server_foo", ssl=True, options = {"--key": "{0}/signed-foo.key".format(Test.RunDirectory), "--cert": "{0}/signed-foo.pem".format(Test.RunDirectory)})
-server_bar = Test.MakeOriginServer("server_bar", ssl=True, options = {"--key": "{0}/signed-bar.key".format(Test.RunDirectory), "--cert": "{0}/signed-bar.pem".format(Test.RunDirectory)})
-server_wild = Test.MakeOriginServer("server_wild", ssl=True, options = {"--key": "{0}/wild.key".format(Test.RunDirectory), "--cert": "{0}/wild-signed.pem".format(Test.RunDirectory)})
+server_foo = Test.MakeOriginServer("server_foo",
+ ssl=True,
+ options={"--key": "{0}/signed-foo.key".format(Test.RunDirectory),
+ "--cert": "{0}/signed-foo.pem".format(Test.RunDirectory)})
+server_bar = Test.MakeOriginServer("server_bar",
+ ssl=True,
+ options={"--key": "{0}/signed-bar.key".format(Test.RunDirectory),
+ "--cert": "{0}/signed-bar.pem".format(Test.RunDirectory)})
+server_wild = Test.MakeOriginServer("server_wild",
+ ssl=True,
+ options={"--key": "{0}/wild.key".format(Test.RunDirectory),
+ "--cert": "{0}/wild-signed.pem".format(Test.RunDirectory)})
server = Test.MakeOriginServer("server", ssl=True)
request_foo_header = {"headers": "GET / HTTP/1.1\r\nHost: foo.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
@@ -85,16 +94,16 @@
})
ts.Disk.sni_yaml.AddLines([
- 'sni:',
- '- fqdn: bar.com',
- ' verify_server_policy: ENFORCED',
- ' verify_server_properties: ALL',
- '- fqdn: "*.wild.com"',
- ' verify_server_policy: ENFORCED',
- ' verify_server_properties: ALL',
- '- fqdn: bad_bar.com',
- ' verify_server_policy: ENFORCED',
- ' verify_server_properties: ALL'
+ 'sni:',
+ '- fqdn: bar.com',
+ ' verify_server_policy: ENFORCED',
+ ' verify_server_properties: ALL',
+ '- fqdn: "*.wild.com"',
+ ' verify_server_policy: ENFORCED',
+ ' verify_server_properties: ALL',
+ '- fqdn: bad_bar.com',
+ ' verify_server_policy: ENFORCED',
+ ' verify_server_properties: ALL'
])
tr = Test.AddTestRun("Permissive-Test")
@@ -146,4 +155,5 @@
# Over riding the built in ERROR check since we expect tr3 to fail
ts.Disk.diags_log.Content = Testers.ExcludesExpression("verification failed", "Make sure the signatures didn't fail")
-ts.Disk.diags_log.Content += Testers.ContainsExpression("WARNING: SNI \(bad_bar.com\) not in certificate", "Make sure bad_bar name checked failed.")
+ts.Disk.diags_log.Content += Testers.ContainsExpression(
+ "WARNING: SNI \(bad_bar.com\) not in certificate", "Make sure bad_bar name checked failed.")
diff --git a/tests/gold_tests/tls/tls_verify2.test.py b/tests/gold_tests/tls/tls_verify2.test.py
index 368f0c8e5b1..b218242afed 100644
--- a/tests/gold_tests/tls/tls_verify2.test.py
+++ b/tests/gold_tests/tls/tls_verify2.test.py
@@ -22,8 +22,14 @@
# Define default ATS
ts = Test.MakeATSProcess("ts", select_ports=True, enable_tls=True)
-server_foo = Test.MakeOriginServer("server_foo", ssl=True, options = {"--key": "{0}/signed-foo.key".format(Test.RunDirectory), "--cert": "{0}/signed-foo.pem".format(Test.RunDirectory)})
-server_bar = Test.MakeOriginServer("server_bar", ssl=True, options = {"--key": "{0}/signed-bar.key".format(Test.RunDirectory), "--cert": "{0}/signed-bar.pem".format(Test.RunDirectory)})
+server_foo = Test.MakeOriginServer("server_foo",
+ ssl=True,
+ options={"--key": "{0}/signed-foo.key".format(Test.RunDirectory),
+ "--cert": "{0}/signed-foo.pem".format(Test.RunDirectory)})
+server_bar = Test.MakeOriginServer("server_bar",
+ ssl=True,
+ options={"--key": "{0}/signed-bar.key".format(Test.RunDirectory),
+ "--cert": "{0}/signed-bar.pem".format(Test.RunDirectory)})
server = Test.MakeOriginServer("server", ssl=True)
request_foo_header = {"headers": "GET / HTTP/1.1\r\nHost: foo.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
@@ -77,23 +83,23 @@
})
ts.Disk.sni_yaml.AddLine(
- 'sni:')
+ 'sni:')
ts.Disk.sni_yaml.AddLine(
- '- fqdn: bar.com')
+ '- fqdn: bar.com')
ts.Disk.sni_yaml.AddLine(
- ' verify_server_policy: PERMISSIVE')
+ ' verify_server_policy: PERMISSIVE')
ts.Disk.sni_yaml.AddLine(
- ' verify_server_properties: SIGNATURE')
+ ' verify_server_properties: SIGNATURE')
ts.Disk.sni_yaml.AddLine(
- '- fqdn: bad_bar.com')
+ '- fqdn: bad_bar.com')
ts.Disk.sni_yaml.AddLine(
- ' verify_server_policy: PERMISSIVE')
+ ' verify_server_policy: PERMISSIVE')
ts.Disk.sni_yaml.AddLine(
- ' verify_server_properties: SIGNATURE')
+ ' verify_server_properties: SIGNATURE')
ts.Disk.sni_yaml.AddLine(
- '- fqdn: random.com')
+ '- fqdn: random.com')
ts.Disk.sni_yaml.AddLine(
- ' verify_server_policy: DISABLED')
+ ' verify_server_policy: DISABLED')
tr = Test.AddTestRun("default-enforce")
tr.Setup.Copy("ssl/signed-foo.key")
@@ -147,9 +153,14 @@
# No name checking for the sig-only permissive override for bad_bar
-ts.Disk.diags_log.Content += Testers.ExcludesExpression("WARNING: SNI \(bad_bar.com\) not in certificate", "bad_bar name checked should be skipped.")
-ts.Disk.diags_log.Content = Testers.ExcludesExpression("WARNING: SNI \(foo.com\) not in certificate", "foo name checked should be skipped.")
+ts.Disk.diags_log.Content += Testers.ExcludesExpression(
+ "WARNING: SNI \(bad_bar.com\) not in certificate", "bad_bar name checked should be skipped.")
+ts.Disk.diags_log.Content = Testers.ExcludesExpression(
+ "WARNING: SNI \(foo.com\) not in certificate", "foo name checked should be skipped.")
# No checking for the self-signed on random.com. No messages
-ts.Disk.diags_log.Content += Testers.ExcludesExpression("WARNING: Core server certificate verification failed for \(random.com\)", "signature check for random.com should be skipped")
-ts.Disk.diags_log.Content += Testers.ContainsExpression("WARNING: Core server certificate verification failed for \(random2.com\)", "signature check for random.com should fail'")
-ts.Disk.diags_log.Content += Testers.ContainsExpression("WARNING: SNI \(bad_foo.com\) not in certificate", "bad_foo name checked should be checked.")
+ts.Disk.diags_log.Content += Testers.ExcludesExpression(
+ "WARNING: Core server certificate verification failed for \(random.com\)", "signature check for random.com should be skipped")
+ts.Disk.diags_log.Content += Testers.ContainsExpression(
+ "WARNING: Core server certificate verification failed for \(random2.com\)", "signature check for random.com should fail'")
+ts.Disk.diags_log.Content += Testers.ContainsExpression(
+ "WARNING: SNI \(bad_foo.com\) not in certificate", "bad_foo name checked should be checked.")
diff --git a/tests/gold_tests/tls/tls_verify3.test.py b/tests/gold_tests/tls/tls_verify3.test.py
index eb54c295328..1098870bc12 100644
--- a/tests/gold_tests/tls/tls_verify3.test.py
+++ b/tests/gold_tests/tls/tls_verify3.test.py
@@ -22,8 +22,14 @@
# Define default ATS
ts = Test.MakeATSProcess("ts", select_ports=True, enable_tls=True)
-server_foo = Test.MakeOriginServer("server_foo", ssl=True, options = {"--key": "{0}/signed-foo.key".format(Test.RunDirectory), "--cert": "{0}/signed-foo.pem".format(Test.RunDirectory)})
-server_bar = Test.MakeOriginServer("server_bar", ssl=True, options = {"--key": "{0}/signed-bar.key".format(Test.RunDirectory), "--cert": "{0}/signed-bar.pem".format(Test.RunDirectory)})
+server_foo = Test.MakeOriginServer("server_foo",
+ ssl=True,
+ options={"--key": "{0}/signed-foo.key".format(Test.RunDirectory),
+ "--cert": "{0}/signed-foo.pem".format(Test.RunDirectory)})
+server_bar = Test.MakeOriginServer("server_bar",
+ ssl=True,
+ options={"--key": "{0}/signed-bar.key".format(Test.RunDirectory),
+ "--cert": "{0}/signed-bar.pem".format(Test.RunDirectory)})
server = Test.MakeOriginServer("server", ssl=True)
request_foo_header = {"headers": "GET / HTTP/1.1\r\nHost: foo.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
@@ -53,7 +59,7 @@
ts.Disk.remap_config.AddLine(
'map https://bar.com:{1}/ https://127.0.0.1:{0}'.format(server_bar.Variables.SSL_Port, ts.Variables.ssl_port))
ts.Disk.remap_config.AddLine(
- 'map https://bob.bar.com:{1}/ https://127.0.0.1:{0}'.format(server_bar.Variables.SSL_Port,ts.Variables.ssl_port))
+ 'map https://bob.bar.com:{1}/ https://127.0.0.1:{0}'.format(server_bar.Variables.SSL_Port, ts.Variables.ssl_port))
ts.Disk.remap_config.AddLine(
'map / https://127.0.0.1:{0}'.format(server.Variables.SSL_Port))
@@ -77,15 +83,15 @@
})
ts.Disk.sni_yaml.AddLines([
- 'sni:',
- '- fqdn: bob.bar.com',
- ' verify_server_policy: ENFORCED',
- ' verify_server_properties: ALL',
- '- fqdn: bob.*.com',
- ' verify_server_policy: ENFORCED',
- ' verify_server_properties: SIGNATURE',
- "- fqdn: '*bar.com'",
- ' verify_server_policy: DISABLED',
+ 'sni:',
+ '- fqdn: bob.bar.com',
+ ' verify_server_policy: ENFORCED',
+ ' verify_server_properties: ALL',
+ '- fqdn: bob.*.com',
+ ' verify_server_policy: ENFORCED',
+ ' verify_server_properties: SIGNATURE',
+ "- fqdn: '*bar.com'",
+ ' verify_server_policy: DISABLED',
])
tr = Test.AddTestRun("foo.com Permissive-Test")
@@ -104,7 +110,8 @@
tr.Processes.Default.Streams.stdout = Testers.ExcludesExpression("Could Not Connect", "Curl attempt should have succeeded")
tr = Test.AddTestRun("my.foo.com Permissive-Test log failure")
-tr.Processes.Default.Command = "curl -v -k --resolve 'my.foo.com:{0}:127.0.0.1' https://my.foo.com:{0}".format(ts.Variables.ssl_port)
+tr.Processes.Default.Command = "curl -v -k --resolve 'my.foo.com:{0}:127.0.0.1' https://my.foo.com:{0}".format(
+ ts.Variables.ssl_port)
tr.ReturnCode = 0
tr.StillRunningAfter = server
tr.StillRunningAfter = ts
@@ -112,21 +119,24 @@
tr2 = Test.AddTestRun("bob.bar.com Override-enforcing-Test")
-tr2.Processes.Default.Command = "curl -v -k --resolve 'bob.bar.com:{0}:127.0.0.1' https://bob.bar.com:{0}/".format(ts.Variables.ssl_port)
+tr2.Processes.Default.Command = "curl -v -k --resolve 'bob.bar.com:{0}:127.0.0.1' https://bob.bar.com:{0}/".format(
+ ts.Variables.ssl_port)
tr2.ReturnCode = 0
tr2.StillRunningAfter = server
tr2.StillRunningAfter = ts
tr2.Processes.Default.Streams.stdout = Testers.ContainsExpression("Could Not Connect", "Curl attempt should have succeeded")
tr3 = Test.AddTestRun("bob.foo.com override-enforcing-name-test")
-tr3.Processes.Default.Command = "curl -v -k --resolve 'bob.foo.com:{0}:127.0.0.1' https://bob.foo.com:{0}/".format(ts.Variables.ssl_port)
+tr3.Processes.Default.Command = "curl -v -k --resolve 'bob.foo.com:{0}:127.0.0.1' https://bob.foo.com:{0}/".format(
+ ts.Variables.ssl_port)
tr3.Processes.Default.Streams.stdout = Testers.ExcludesExpression("Could Not Connect", "Curl attempt should not fail")
tr3.ReturnCode = 0
tr3.StillRunningAfter = server
tr3.StillRunningAfter = ts
tr3 = Test.AddTestRun("random.bar.com override-no-test")
-tr3.Processes.Default.Command = "curl -v -k --resolve 'random.bar.com:{0}:127.0.0.1' https://random.bar.com:{0}".format(ts.Variables.ssl_port)
+tr3.Processes.Default.Command = "curl -v -k --resolve 'random.bar.com:{0}:127.0.0.1' https://random.bar.com:{0}".format(
+ ts.Variables.ssl_port)
tr3.Processes.Default.Streams.stdout = Testers.ExcludesExpression("Could Not Connect", "Curl attempt should not fail")
tr3.ReturnCode = 0
tr3.StillRunningAfter = server
@@ -134,5 +144,8 @@
# Over riding the built in ERROR check since we expect tr3 to fail
-ts.Disk.diags_log.Content = Testers.ContainsExpression("WARNING: SNI \(bob.bar.com\) not in certificate", "Make sure bob.bar name checked failed.")
-ts.Disk.diags_log.Content += Testers.ContainsExpression("WARNING: Core server certificate verification failed for \(my.foo.com\). Action=Continue", "Make sure default permissive action takes")
+ts.Disk.diags_log.Content = Testers.ContainsExpression(
+ "WARNING: SNI \(bob.bar.com\) not in certificate", "Make sure bob.bar name checked failed.")
+ts.Disk.diags_log.Content += Testers.ContainsExpression(
+ r"WARNING: Core server certificate verification failed for \(my.foo.com\). Action=Continue",
+ "Make sure default permissive action takes")
diff --git a/tests/gold_tests/tls/tls_verify_base.test.py b/tests/gold_tests/tls/tls_verify_base.test.py
index 2c2374d1433..b1ee8529509 100644
--- a/tests/gold_tests/tls/tls_verify_base.test.py
+++ b/tests/gold_tests/tls/tls_verify_base.test.py
@@ -22,8 +22,14 @@
# Define default ATS
ts = Test.MakeATSProcess("ts", select_ports=True, enable_tls=True)
-server_foo = Test.MakeOriginServer("server_foo", ssl=True, options = {"--key": "{0}/signed-foo.key".format(Test.RunDirectory), "--cert": "{0}/signed-foo.pem".format(Test.RunDirectory)})
-server_bar = Test.MakeOriginServer("server_bar", ssl=True, options = {"--key": "{0}/signed-bar.key".format(Test.RunDirectory), "--cert": "{0}/signed-bar.pem".format(Test.RunDirectory)})
+server_foo = Test.MakeOriginServer("server_foo",
+ ssl=True,
+ options={"--key": "{0}/signed-foo.key".format(Test.RunDirectory),
+ "--cert": "{0}/signed-foo.pem".format(Test.RunDirectory)})
+server_bar = Test.MakeOriginServer("server_bar",
+ ssl=True,
+ options={"--key": "{0}/signed-bar.key".format(Test.RunDirectory),
+ "--cert": "{0}/signed-bar.pem".format(Test.RunDirectory)})
server = Test.MakeOriginServer("server", ssl=True)
request_foo_header = {"headers": "GET / HTTP/1.1\r\nHost: foo.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
@@ -75,13 +81,13 @@
})
ts.Disk.sni_yaml.AddLines([
- 'sni:',
- '- fqdn: bar.com',
- ' verify_server_policy: ENFORCED',
- ' verify_server_properties: ALL',
- '- fqdn: bad_bar.com',
- ' verify_server_policy: ENFORCED',
- ' verify_server_properties: ALL'
+ 'sni:',
+ '- fqdn: bar.com',
+ ' verify_server_policy: ENFORCED',
+ ' verify_server_properties: ALL',
+ '- fqdn: bad_bar.com',
+ ' verify_server_policy: ENFORCED',
+ ' verify_server_properties: ALL'
])
tr = Test.AddTestRun("Permissive-Test")
@@ -122,5 +128,7 @@
tr3.StillRunningAfter = ts
# Over riding the built in ERROR check since we expect tr3 to fail
-ts.Disk.diags_log.Content = Testers.ContainsExpression("WARNING: SNI \(bad_bar.com\) not in certificate. Action=Terminate", "Make sure bad_bar name checked failed.")
-ts.Disk.diags_log.Content += Testers.ContainsExpression("WARNING: SNI \(random.com\) not in certificate. Action=Continue ", "Permissive failure for random")
+ts.Disk.diags_log.Content = Testers.ContainsExpression(
+ "WARNING: SNI \(bad_bar.com\) not in certificate. Action=Terminate", "Make sure bad_bar name checked failed.")
+ts.Disk.diags_log.Content += Testers.ContainsExpression(
+ "WARNING: SNI \(random.com\) not in certificate. Action=Continue ", "Permissive failure for random")
diff --git a/tests/gold_tests/tls/tls_verify_ca_override.test.py b/tests/gold_tests/tls/tls_verify_ca_override.test.py
index b7208fa94ce..f737a379bf0 100644
--- a/tests/gold_tests/tls/tls_verify_ca_override.test.py
+++ b/tests/gold_tests/tls/tls_verify_ca_override.test.py
@@ -22,8 +22,14 @@
# Define default ATS
ts = Test.MakeATSProcess("ts", select_ports=True)
-server1 = Test.MakeOriginServer("server1", ssl=True, options = {"--key": "{0}/signed-foo.key".format(Test.RunDirectory), "--cert": "{0}/signed-foo.pem".format(Test.RunDirectory)})
-server2 = Test.MakeOriginServer("server2", ssl=True, options = {"--key": "{0}/signed-foo.key".format(Test.RunDirectory), "--cert": "{0}/signed2-foo.pem".format(Test.RunDirectory)})
+server1 = Test.MakeOriginServer("server1",
+ ssl=True,
+ options={"--key": "{0}/signed-foo.key".format(Test.RunDirectory),
+ "--cert": "{0}/signed-foo.pem".format(Test.RunDirectory)})
+server2 = Test.MakeOriginServer("server2",
+ ssl=True,
+ options={"--key": "{0}/signed-foo.key".format(Test.RunDirectory),
+ "--cert": "{0}/signed2-foo.pem".format(Test.RunDirectory)})
request_foo_header = {"headers": "GET / HTTP/1.1\r\nHost: foo.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
request_bad_foo_header = {"headers": "GET / HTTP/1.1\r\nHost: bad_foo.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
@@ -47,16 +53,20 @@
ts.addSSLfile("ssl/signer2.key")
ts.Disk.remap_config.AddLine(
- 'map /case1 https://127.0.0.1:{0}/ @plugin=conf_remap.so @pparam=proxy.config.ssl.client.CA.cert.filename={1}/{2}'.format(server1.Variables.SSL_Port, ts.Variables.SSLDir, "signer.pem")
+ 'map /case1 https://127.0.0.1:{0}/ @plugin=conf_remap.so @pparam=proxy.config.ssl.client.CA.cert.filename={1}/{2}'.format(
+ server1.Variables.SSL_Port, ts.Variables.SSLDir, "signer.pem")
)
ts.Disk.remap_config.AddLine(
- 'map /badcase1 https://127.0.0.1:{0}/ @plugin=conf_remap.so @pparam=proxy.config.ssl.client.CA.cert.filename={1}/{2}'.format(server1.Variables.SSL_Port, ts.Variables.SSLDir, "signer2.pem")
+ 'map /badcase1 https://127.0.0.1:{0}/ @plugin=conf_remap.so @pparam=proxy.config.ssl.client.CA.cert.filename={1}/{2}'.format(
+ server1.Variables.SSL_Port, ts.Variables.SSLDir, "signer2.pem")
)
ts.Disk.remap_config.AddLine(
- 'map /case2 https://127.0.0.1:{0}/ @plugin=conf_remap.so @pparam=proxy.config.ssl.client.CA.cert.filename={1}/{2}'.format(server2.Variables.SSL_Port, ts.Variables.SSLDir, "signer2.pem")
+ 'map /case2 https://127.0.0.1:{0}/ @plugin=conf_remap.so @pparam=proxy.config.ssl.client.CA.cert.filename={1}/{2}'.format(
+ server2.Variables.SSL_Port, ts.Variables.SSLDir, "signer2.pem")
)
ts.Disk.remap_config.AddLine(
- 'map /badcase2 https://127.0.0.1:{0}/ @plugin=conf_remap.so @pparam=proxy.config.ssl.client.CA.cert.filename={1}/{2}'.format(server2.Variables.SSL_Port, ts.Variables.SSLDir, "signer.pem")
+ 'map /badcase2 https://127.0.0.1:{0}/ @plugin=conf_remap.so @pparam=proxy.config.ssl.client.CA.cert.filename={1}/{2}'.format(
+ server2.Variables.SSL_Port, ts.Variables.SSLDir, "signer.pem")
)
ts.Disk.ssl_multicert_config.AddLine(
diff --git a/tests/gold_tests/tls/tls_verify_not_pristine.test.py b/tests/gold_tests/tls/tls_verify_not_pristine.test.py
index 60183589f54..d5744519ce1 100644
--- a/tests/gold_tests/tls/tls_verify_not_pristine.test.py
+++ b/tests/gold_tests/tls/tls_verify_not_pristine.test.py
@@ -22,7 +22,10 @@
# Define default ATS
ts = Test.MakeATSProcess("ts", select_ports=True, enable_tls=True)
-server_foo = Test.MakeOriginServer("server_foo", ssl=True, options = {"--key": "{0}/signed-foo.key".format(Test.RunDirectory), "--cert": "{0}/signed-foo.pem".format(Test.RunDirectory)})
+server_foo = Test.MakeOriginServer("server_foo",
+ ssl=True,
+ options={"--key": "{0}/signed-foo.key".format(Test.RunDirectory),
+ "--cert": "{0}/signed-foo.pem".format(Test.RunDirectory)})
server = Test.MakeOriginServer("server", ssl=True)
dns = Test.MakeDNServer("dns")
@@ -97,4 +100,5 @@
# Over riding the built in ERROR check since we expect tr3 to fail
ts.Disk.diags_log.Content = Testers.ExcludesExpression("verification failed", "Make sure the signatures didn't fail")
-ts.Disk.diags_log.Content += Testers.ContainsExpression("WARNING: SNI \(bar.com\) not in certificate", "Make sure bad_bar name checked failed.")
+ts.Disk.diags_log.Content += Testers.ContainsExpression("WARNING: SNI \(bar.com\) not in certificate",
+ "Make sure bad_bar name checked failed.")
diff --git a/tests/gold_tests/tls/tls_verify_override.test.py b/tests/gold_tests/tls/tls_verify_override.test.py
index 68104f69c22..e4daffce8a5 100644
--- a/tests/gold_tests/tls/tls_verify_override.test.py
+++ b/tests/gold_tests/tls/tls_verify_override.test.py
@@ -22,8 +22,14 @@
# Define default ATS
ts = Test.MakeATSProcess("ts", select_ports=True)
-server_foo = Test.MakeOriginServer("server_foo", ssl=True, options = {"--key": "{0}/signed-foo.key".format(Test.RunDirectory), "--cert": "{0}/signed-foo.pem".format(Test.RunDirectory)})
-server_bar = Test.MakeOriginServer("server_bar", ssl=True, options = {"--key": "{0}/signed-bar.key".format(Test.RunDirectory), "--cert": "{0}/signed-bar.pem".format(Test.RunDirectory)})
+server_foo = Test.MakeOriginServer("server_foo",
+ ssl=True,
+ options={"--key": "{0}/signed-foo.key".format(Test.RunDirectory),
+ "--cert": "{0}/signed-foo.pem".format(Test.RunDirectory)})
+server_bar = Test.MakeOriginServer("server_bar",
+ ssl=True,
+ options={"--key": "{0}/signed-bar.key".format(Test.RunDirectory),
+ "--cert": "{0}/signed-bar.pem".format(Test.RunDirectory)})
server = Test.MakeOriginServer("server", ssl=True)
dns = Test.MakeDNServer("dns")
@@ -53,29 +59,39 @@
ts.Disk.remap_config.AddLine(
'map http://foo.com/basic https://foo.com:{0}'.format(server_foo.Variables.SSL_Port))
ts.Disk.remap_config.AddLine(
- 'map http://foo.com/override https://foo.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED'.format(server_foo.Variables.SSL_Port))
+ 'map http://foo.com/override https://foo.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED'.format(
+ server_foo.Variables.SSL_Port))
ts.Disk.remap_config.AddLine(
'map http://bar.com/basic https://bar.com:{0}'.format(server_foo.Variables.SSL_Port))
ts.Disk.remap_config.AddLine(
- 'map http://bar.com/overridedisabled https://bar.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=DISABLED'.format(server_foo.Variables.SSL_Port))
+ 'map http://bar.com/overridedisabled https://bar.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=DISABLED'.format(
+ server_foo.Variables.SSL_Port))
ts.Disk.remap_config.AddLine(
- 'map http://bar.com/overridesignature https://bar.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.properties=SIGNATURE @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED'.format(server_foo.Variables.SSL_Port))
+ 'map http://bar.com/overridesignature https://bar.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.properties=SIGNATURE @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED'.format(
+ server_foo.Variables.SSL_Port))
ts.Disk.remap_config.AddLine(
- 'map http://bar.com/overrideenforced https://bar.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED'.format(server_foo.Variables.SSL_Port))
+ 'map http://bar.com/overrideenforced https://bar.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED'.format(
+ server_foo.Variables.SSL_Port))
ts.Disk.remap_config.AddLine(
'map /basic https://random.com:{0}'.format(server.Variables.SSL_Port))
ts.Disk.remap_config.AddLine(
- 'map /overrideenforce https://127.0.0.1:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED'.format(server.Variables.SSL_Port))
+ 'map /overrideenforce https://127.0.0.1:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED'.format(
+ server.Variables.SSL_Port))
ts.Disk.remap_config.AddLine(
- 'map /overridename https://127.0.0.1:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.properties=NAME'.format(server.Variables.SSL_Port))
+ 'map /overridename https://127.0.0.1:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.properties=NAME'.format(
+ server.Variables.SSL_Port))
ts.Disk.remap_config.AddLine(
- 'map /snipolicyfooremap https://foo.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.properties=NAME @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED @plugin=conf_remap.so @pparam=proxy.config.ssl.client.sni_policy=remap'.format(server_bar.Variables.SSL_Port))
+ 'map /snipolicyfooremap https://foo.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.properties=NAME @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED @plugin=conf_remap.so @pparam=proxy.config.ssl.client.sni_policy=remap'.format(
+ server_bar.Variables.SSL_Port))
ts.Disk.remap_config.AddLine(
- 'map /snipolicyfoohost https://foo.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.properties=NAME @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED @plugin=conf_remap.so @pparam=proxy.config.ssl.client.sni_policy=host'.format(server_bar.Variables.SSL_Port))
+ 'map /snipolicyfoohost https://foo.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.properties=NAME @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED @plugin=conf_remap.so @pparam=proxy.config.ssl.client.sni_policy=host'.format(
+ server_bar.Variables.SSL_Port))
ts.Disk.remap_config.AddLine(
- 'map /snipolicybarremap https://bar.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.properties=NAME @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED @plugin=conf_remap.so @pparam=proxy.config.ssl.client.sni_policy=remap'.format(server_bar.Variables.SSL_Port))
+ 'map /snipolicybarremap https://bar.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.properties=NAME @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED @plugin=conf_remap.so @pparam=proxy.config.ssl.client.sni_policy=remap'.format(
+ server_bar.Variables.SSL_Port))
ts.Disk.remap_config.AddLine(
- 'map /snipolicybarhost https://bar.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.properties=NAME @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED @plugin=conf_remap.so @pparam=proxy.config.ssl.client.sni_policy=host'.format(server_bar.Variables.SSL_Port))
+ 'map /snipolicybarhost https://bar.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.properties=NAME @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED @plugin=conf_remap.so @pparam=proxy.config.ssl.client.sni_policy=host'.format(
+ server_bar.Variables.SSL_Port))
ts.Disk.ssl_multicert_config.AddLine(
'dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key'
@@ -211,12 +227,21 @@
# Over riding the built in ERROR check since we expect some cases to fail
# checks on random.com should fail with message only
-ts.Disk.diags_log.Content = Testers.ContainsExpression("WARNING: Core server certificate verification failed for \(random.com\). Action=Continue Error=self signed certificate server=random.com\(127.0.0.1\) depth=0", "Warning for self signed certificate")
+ts.Disk.diags_log.Content = Testers.ContainsExpression(
+ r"WARNING: Core server certificate verification failed for \(random.com\). Action=Continue Error=self signed certificate server=random.com\(127.0.0.1\) depth=0",
+ "Warning for self signed certificate")
# permissive failure for bar.com
-ts.Disk.diags_log.Content += Testers.ContainsExpression("WARNING: SNI \(bar.com\) not in certificate. Action=Continue server=bar.com\(127.0.0.1\)", "Warning on missing name for bar.com")
+ts.Disk.diags_log.Content += Testers.ContainsExpression(
+ r"WARNING: SNI \(bar.com\) not in certificate. Action=Continue server=bar.com\(127.0.0.1\)",
+ "Warning on missing name for bar.com")
# name check failure for random.com
-ts.Disk.diags_log.Content += Testers.ContainsExpression("WARNING: SNI \(random.com\) not in certificate. Action=Continue server=random.com\(127.0.0.1\)", "Warning on missing name for randome.com")
+ts.Disk.diags_log.Content += Testers.ContainsExpression(
+ r"WARNING: SNI \(random.com\) not in certificate. Action=Continue server=random.com\(127.0.0.1\)",
+ "Warning on missing name for randome.com")
# name check failure for bar.com
-ts.Disk.diags_log.Content += Testers.ContainsExpression("WARNING: SNI \(bar.com\) not in certificate. Action=Terminate server=bar.com\(127.0.0.1\)", "Failure on missing name for bar.com")
+ts.Disk.diags_log.Content += Testers.ContainsExpression(
+ r"WARNING: SNI \(bar.com\) not in certificate. Action=Terminate server=bar.com\(127.0.0.1\)",
+ "Failure on missing name for bar.com")
# See if the explicitly set default sni_policy of remap works.
-ts.Disk.diags_log.Content += Testers.ExcludesExpression("WARNING: SNI \(foo.com\) not in certificate. Action=Continue", "Warning on missing name for foo.com")
+ts.Disk.diags_log.Content += Testers.ExcludesExpression(
+ "WARNING: SNI \(foo.com\) not in certificate. Action=Continue", "Warning on missing name for foo.com")
diff --git a/tests/gold_tests/tls/tls_verify_override_base.test.py b/tests/gold_tests/tls/tls_verify_override_base.test.py
index 84a51d61e13..8650ad63525 100644
--- a/tests/gold_tests/tls/tls_verify_override_base.test.py
+++ b/tests/gold_tests/tls/tls_verify_override_base.test.py
@@ -22,8 +22,14 @@
# Define default ATS
ts = Test.MakeATSProcess("ts", select_ports=True)
-server_foo = Test.MakeOriginServer("server_foo", ssl=True, options = {"--key": "{0}/signed-foo.key".format(Test.RunDirectory), "--cert": "{0}/signed-foo.pem".format(Test.RunDirectory)})
-server_bar = Test.MakeOriginServer("server_bar", ssl=True, options = {"--key": "{0}/signed-bar.key".format(Test.RunDirectory), "--cert": "{0}/signed-bar.pem".format(Test.RunDirectory)})
+server_foo = Test.MakeOriginServer("server_foo",
+ ssl=True,
+ options={"--key": "{0}/signed-foo.key".format(Test.RunDirectory),
+ "--cert": "{0}/signed-foo.pem".format(Test.RunDirectory)})
+server_bar = Test.MakeOriginServer("server_bar",
+ ssl=True,
+ options={"--key": "{0}/signed-bar.key".format(Test.RunDirectory),
+ "--cert": "{0}/signed-bar.pem".format(Test.RunDirectory)})
server = Test.MakeOriginServer("server", ssl=True)
dns = Test.MakeDNServer("dns")
@@ -51,29 +57,39 @@
ts.Disk.remap_config.AddLine(
'map http://foo.com/basic https://foo.com:{0}'.format(server_foo.Variables.SSL_Port))
ts.Disk.remap_config.AddLine(
- 'map http://foo.com/override https://foo.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED'.format(server_foo.Variables.SSL_Port))
+ 'map http://foo.com/override https://foo.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED'.format(
+ server_foo.Variables.SSL_Port))
ts.Disk.remap_config.AddLine(
'map http://bar.com/basic https://bar.com:{0}'.format(server_foo.Variables.SSL_Port))
ts.Disk.remap_config.AddLine(
- 'map http://bar.com/overridedisabled https://bar.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=DISABLED'.format(server_foo.Variables.SSL_Port))
+ 'map http://bar.com/overridedisabled https://bar.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=DISABLED'.format(
+ server_foo.Variables.SSL_Port))
ts.Disk.remap_config.AddLine(
- 'map http://bar.com/overridesignature https://bar.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.properties=SIGNATURE @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED'.format(server_foo.Variables.SSL_Port))
+ 'map http://bar.com/overridesignature https://bar.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.properties=SIGNATURE @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED'.format(
+ server_foo.Variables.SSL_Port))
ts.Disk.remap_config.AddLine(
- 'map http://bar.com/overrideenforced https://bar.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED'.format(server_foo.Variables.SSL_Port))
+ 'map http://bar.com/overrideenforced https://bar.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED'.format(
+ server_foo.Variables.SSL_Port))
ts.Disk.remap_config.AddLine(
'map /basic https://127.0.0.1:{0}'.format(server.Variables.SSL_Port))
ts.Disk.remap_config.AddLine(
- 'map /overrideenforce https://127.0.0.1:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED'.format(server.Variables.SSL_Port))
+ 'map /overrideenforce https://127.0.0.1:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED'.format(
+ server.Variables.SSL_Port))
ts.Disk.remap_config.AddLine(
- 'map /overridename https://127.0.0.1:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.properties=NAME'.format(server.Variables.SSL_Port))
+ 'map /overridename https://127.0.0.1:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.properties=NAME'.format(
+ server.Variables.SSL_Port))
ts.Disk.remap_config.AddLine(
- 'map /snipolicyfooremap https://foo.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.properties=NAME @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED @plugin=conf_remap.so @pparam=proxy.config.ssl.client.sni_policy=remap'.format(server_bar.Variables.SSL_Port))
+ 'map /snipolicyfooremap https://foo.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.properties=NAME @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED @plugin=conf_remap.so @pparam=proxy.config.ssl.client.sni_policy=remap'.format(
+ server_bar.Variables.SSL_Port))
ts.Disk.remap_config.AddLine(
- 'map /snipolicyfoohost https://foo.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.properties=NAME @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED @plugin=conf_remap.so @pparam=proxy.config.ssl.client.sni_policy=host'.format(server_bar.Variables.SSL_Port))
+ 'map /snipolicyfoohost https://foo.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.properties=NAME @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED @plugin=conf_remap.so @pparam=proxy.config.ssl.client.sni_policy=host'.format(
+ server_bar.Variables.SSL_Port))
ts.Disk.remap_config.AddLine(
- 'map /snipolicybarremap https://bar.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.properties=NAME @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED @plugin=conf_remap.so @pparam=proxy.config.ssl.client.sni_policy=remap'.format(server_bar.Variables.SSL_Port))
+ 'map /snipolicybarremap https://bar.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.properties=NAME @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED @plugin=conf_remap.so @pparam=proxy.config.ssl.client.sni_policy=remap'.format(
+ server_bar.Variables.SSL_Port))
ts.Disk.remap_config.AddLine(
- 'map /snipolicybarhost https://bar.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.properties=NAME @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED @plugin=conf_remap.so @pparam=proxy.config.ssl.client.sni_policy=host'.format(server_bar.Variables.SSL_Port))
+ 'map /snipolicybarhost https://bar.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.properties=NAME @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED @plugin=conf_remap.so @pparam=proxy.config.ssl.client.sni_policy=host'.format(
+ server_bar.Variables.SSL_Port))
ts.Disk.ssl_multicert_config.AddLine(
'dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key'
@@ -197,10 +213,18 @@
# Over riding the built in ERROR check since we expect some cases to fail
# checks on random.com should fail with message only
-ts.Disk.diags_log.Content = Testers.ContainsExpression("WARNING: Core server certificate verification failed for \(random.com\). Action=Continue Error=self signed certificate server=127.0.0.1\(127.0.0.1\) depth=0", "Warning for self signed certificate")
+ts.Disk.diags_log.Content = Testers.ContainsExpression(
+ r"WARNING: Core server certificate verification failed for \(random.com\). Action=Continue Error=self signed certificate server=127.0.0.1\(127.0.0.1\) depth=0",
+ "Warning for self signed certificate")
# permissive failure for bar.com
-ts.Disk.diags_log.Content += Testers.ContainsExpression("WARNING: SNI \(bar.com\) not in certificate. Action=Continue server=bar.com\(127.0.0.1\)", "Warning on missing name for bar.com")
+ts.Disk.diags_log.Content += Testers.ContainsExpression(
+ r"WARNING: SNI \(bar.com\) not in certificate. Action=Continue server=bar.com\(127.0.0.1\)",
+ "Warning on missing name for bar.com")
# name check failure for random.com
-ts.Disk.diags_log.Content += Testers.ContainsExpression("WARNING: SNI \(random.com\) not in certificate. Action=Continue server=127.0.0.1\(127.0.0.1\)", "Warning on missing name for randome.com")
+ts.Disk.diags_log.Content += Testers.ContainsExpression(
+ r"WARNING: SNI \(random.com\) not in certificate. Action=Continue server=127.0.0.1\(127.0.0.1\)",
+ "Warning on missing name for randome.com")
# name check failure for bar.com
-ts.Disk.diags_log.Content += Testers.ContainsExpression("WARNING: SNI \(bar.com\) not in certificate. Action=Terminate server=bar.com\(127.0.0.1\)", "Failure on missing name for bar.com")
+ts.Disk.diags_log.Content += Testers.ContainsExpression(
+ r"WARNING: SNI \(bar.com\) not in certificate. Action=Terminate server=bar.com\(127.0.0.1\)",
+ "Failure on missing name for bar.com")
diff --git a/tests/gold_tests/tls/tls_verify_override_sni.test.py b/tests/gold_tests/tls/tls_verify_override_sni.test.py
index 38ceeb39057..be2e13b4f56 100644
--- a/tests/gold_tests/tls/tls_verify_override_sni.test.py
+++ b/tests/gold_tests/tls/tls_verify_override_sni.test.py
@@ -25,8 +25,22 @@
ts = Test.MakeATSProcess("ts", select_ports=True)
cafile = "{0}/signer.pem".format(Test.RunDirectory)
-server_foo = Test.MakeOriginServer("server_foo", ssl=True, options = {"--key": "{0}/signed-foo.key".format(Test.RunDirectory), "--cert": "{0}/signed-foo.pem".format(Test.RunDirectory), "--clientCA": cafile, "--clientverify": ""}, clientcert="{0}/signed-bar.pem".format(Test.RunDirectory), clientkey="{0}/signed-bar.key".format(Test.RunDirectory))
-server_bar = Test.MakeOriginServer("server_bar", ssl=True, options = {"--key": "{0}/signed-foo.key".format(Test.RunDirectory), "--cert": "{0}/signed-foo.pem".format(Test.RunDirectory), "--clientCA": cafile, "--clientverify": ""}, clientcert="{0}/signed-bar.pem".format(Test.RunDirectory), clientkey="{0}/signed-bar.key".format(Test.RunDirectory))
+server_foo = Test.MakeOriginServer("server_foo",
+ ssl=True,
+ options={"--key": "{0}/signed-foo.key".format(Test.RunDirectory),
+ "--cert": "{0}/signed-foo.pem".format(Test.RunDirectory),
+ "--clientCA": cafile,
+ "--clientverify": ""},
+ clientcert="{0}/signed-bar.pem".format(Test.RunDirectory),
+ clientkey="{0}/signed-bar.key".format(Test.RunDirectory))
+server_bar = Test.MakeOriginServer("server_bar",
+ ssl=True,
+ options={"--key": "{0}/signed-foo.key".format(Test.RunDirectory),
+ "--cert": "{0}/signed-foo.pem".format(Test.RunDirectory),
+ "--clientCA": cafile,
+ "--clientverify": ""},
+ clientcert="{0}/signed-bar.pem".format(Test.RunDirectory),
+ clientkey="{0}/signed-bar.key".format(Test.RunDirectory))
dns = Test.MakeDNServer("dns")
@@ -60,9 +74,11 @@
ts.Disk.remap_config.AddLine(
'map http://foo.com/default https://foo.com:{0}'.format(server_foo.Variables.SSL_Port))
ts.Disk.remap_config.AddLine(
- 'map http://foo.com/overridepolicy https://bar.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED'.format(server_foo.Variables.SSL_Port))
+ 'map http://foo.com/overridepolicy https://bar.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.policy=ENFORCED'.format(
+ server_foo.Variables.SSL_Port))
ts.Disk.remap_config.AddLine(
- 'map http://foo.com/overrideproperties https://bar.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.properties=SIGNATURE'.format(server_foo.Variables.SSL_Port))
+ 'map http://foo.com/overrideproperties https://bar.com:{0} @plugin=conf_remap.so @pparam=proxy.config.ssl.client.verify.server.properties=SIGNATURE'.format(
+ server_foo.Variables.SSL_Port))
ts.Disk.ssl_multicert_config.AddLine(
'dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key'
@@ -88,10 +104,10 @@
})
ts.Disk.sni_yaml.AddLines([
- 'sni:',
- '- fqdn: bar.com',
- ' client_cert: "{0}/signed-foo.pem"'.format(ts.Variables.SSLDir),
- ' client_key: "{0}/signed-foo.key"'.format(ts.Variables.SSLDir),
+ 'sni:',
+ '- fqdn: bar.com',
+ ' client_cert: "{0}/signed-foo.pem"'.format(ts.Variables.SSLDir),
+ ' client_key: "{0}/signed-foo.key"'.format(ts.Variables.SSLDir),
])
dns.addRecords(records={"foo.com.": ["127.0.0.1"]})
@@ -130,6 +146,7 @@
# Over riding the built in ERROR check since we expect some cases to fail
-ts.Disk.diags_log.Content = Testers.ContainsExpression("WARNING: SNI \(bar.com\) not in certificate. Action=Continue server=bar.com", "Warning for mismatch name not enforcing")
-ts.Disk.diags_log.Content += Testers.ContainsExpression(" WARNING: SNI \(bar.com\) not in certificate. Action=Terminate server=bar.com", "Warning for enforcing mismatch")
-
+ts.Disk.diags_log.Content = Testers.ContainsExpression(
+ "WARNING: SNI \(bar.com\) not in certificate. Action=Continue server=bar.com", "Warning for mismatch name not enforcing")
+ts.Disk.diags_log.Content += Testers.ContainsExpression(
+ " WARNING: SNI \(bar.com\) not in certificate. Action=Terminate server=bar.com", "Warning for enforcing mismatch")
diff --git a/tests/gold_tests/tls_hooks/tls_hooks.test.py b/tests/gold_tests/tls_hooks/tls_hooks.test.py
index c6e7a0cc6f2..c1d7ee841fa 100644
--- a/tests/gold_tests/tls_hooks/tls_hooks.test.py
+++ b/tests/gold_tests/tls_hooks/tls_hooks.test.py
@@ -39,7 +39,7 @@
'proxy.config.diags.debug.tags': 'ssl_hook_test',
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.ssl.TLSv1_3': 0,
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
})
@@ -62,14 +62,17 @@
tr.Processes.Default.Command = 'curl -v -k -H \'host:example.com:{0}\' https://127.0.0.1:{0}'.format(ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "gold/preaccept-1.gold"
-tr.Processes.Default.Streams.All = Testers.ExcludesExpression("TLSv1.3 (IN), TLS handshake, Finished (20):", "Should not negotiate a TLSv1.3 connection")
+tr.Processes.Default.Streams.All = Testers.ExcludesExpression(
+ "TLSv1.3 (IN), TLS handshake, Finished (20):", "Should not negotiate a TLSv1.3 connection")
ts.Streams.stderr = "gold/ts-preaccept-1.gold"
# the preaccept may get triggered twice because the test framework creates a TCP connection before handing off to traffic_server
preacceptstring = "Pre accept callback 0"
ts.Streams.All = Testers.ContainsExpression(
- "\A(?:(?!{0}).)*{0}.*({0})?(?!.*{0}).*\Z".format(preacceptstring), "Pre accept message appears only once or twice", reflags=re.S | re.M)
+ r"\A(?:(?!{0}).)*{0}.*({0})?(?!.*{0}).*\Z".format(preacceptstring),
+ "Pre accept message appears only once or twice",
+ reflags=re.S | re.M)
tr.Processes.Default.TimeOut = 15
tr.TimeOut = 15
diff --git a/tests/gold_tests/tls_hooks/tls_hooks10.test.py b/tests/gold_tests/tls_hooks/tls_hooks10.test.py
index b3e665a0140..45f34eee788 100644
--- a/tests/gold_tests/tls_hooks/tls_hooks10.test.py
+++ b/tests/gold_tests/tls_hooks/tls_hooks10.test.py
@@ -38,7 +38,7 @@
'proxy.config.diags.debug.tags': 'ssl_hook_test',
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
})
diff --git a/tests/gold_tests/tls_hooks/tls_hooks11.test.py b/tests/gold_tests/tls_hooks/tls_hooks11.test.py
index 7101bebe184..04f5a1b71a0 100644
--- a/tests/gold_tests/tls_hooks/tls_hooks11.test.py
+++ b/tests/gold_tests/tls_hooks/tls_hooks11.test.py
@@ -39,7 +39,7 @@
'proxy.config.diags.debug.tags': 'ssl_hook_test',
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
})
@@ -66,6 +66,8 @@
preacceptstring = "Pre accept delay callback 0"
ts.Streams.All = Testers.ContainsExpression(
- "\A(?:(?!{0}).)*{0}.*({0})?(?!.*{0}).*\Z".format(preacceptstring), "Pre accept message appears only once or twice", reflags=re.S | re.M)
+ r"\A(?:(?!{0}).)*{0}.*({0})?(?!.*{0}).*\Z".format(preacceptstring),
+ "Pre accept message appears only once or twice",
+ reflags=re.S | re.M)
tr.Processes.Default.TimeOut = 15
tr.TimeOut = 15
diff --git a/tests/gold_tests/tls_hooks/tls_hooks12.test.py b/tests/gold_tests/tls_hooks/tls_hooks12.test.py
index 1d7f532af39..2c9ab8134b7 100644
--- a/tests/gold_tests/tls_hooks/tls_hooks12.test.py
+++ b/tests/gold_tests/tls_hooks/tls_hooks12.test.py
@@ -38,7 +38,7 @@
'proxy.config.diags.debug.tags': 'ssl_hook_test',
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
})
diff --git a/tests/gold_tests/tls_hooks/tls_hooks13.test.py b/tests/gold_tests/tls_hooks/tls_hooks13.test.py
index 192655d32b3..71fb3b5d1ed 100644
--- a/tests/gold_tests/tls_hooks/tls_hooks13.test.py
+++ b/tests/gold_tests/tls_hooks/tls_hooks13.test.py
@@ -38,7 +38,7 @@
'proxy.config.diags.debug.tags': 'ssl_hook_test',
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
})
diff --git a/tests/gold_tests/tls_hooks/tls_hooks14.test.py b/tests/gold_tests/tls_hooks/tls_hooks14.test.py
index 8b39c646031..c7bc111d1cb 100644
--- a/tests/gold_tests/tls_hooks/tls_hooks14.test.py
+++ b/tests/gold_tests/tls_hooks/tls_hooks14.test.py
@@ -38,7 +38,7 @@
'proxy.config.diags.debug.tags': 'ssl_hook_test',
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
})
diff --git a/tests/gold_tests/tls_hooks/tls_hooks15.test.py b/tests/gold_tests/tls_hooks/tls_hooks15.test.py
index 12d02445b39..aa30ffc59bd 100644
--- a/tests/gold_tests/tls_hooks/tls_hooks15.test.py
+++ b/tests/gold_tests/tls_hooks/tls_hooks15.test.py
@@ -38,7 +38,7 @@
'proxy.config.diags.debug.tags': 'ssl_hook_test',
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
})
diff --git a/tests/gold_tests/tls_hooks/tls_hooks16.test.py b/tests/gold_tests/tls_hooks/tls_hooks16.test.py
index 958c04bdd7c..22f03d36c91 100644
--- a/tests/gold_tests/tls_hooks/tls_hooks16.test.py
+++ b/tests/gold_tests/tls_hooks/tls_hooks16.test.py
@@ -42,7 +42,7 @@
'proxy.config.diags.debug.tags': 'ssl_hook_test',
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
})
diff --git a/tests/gold_tests/tls_hooks/tls_hooks17.test.py b/tests/gold_tests/tls_hooks/tls_hooks17.test.py
index 573d0c30cca..0fddd752779 100644
--- a/tests/gold_tests/tls_hooks/tls_hooks17.test.py
+++ b/tests/gold_tests/tls_hooks/tls_hooks17.test.py
@@ -42,7 +42,7 @@
'proxy.config.diags.debug.tags': 'ssl_hook_test',
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
})
diff --git a/tests/gold_tests/tls_hooks/tls_hooks18.test.py b/tests/gold_tests/tls_hooks/tls_hooks18.test.py
index 80ba8c5dcd9..9593b8ec57a 100644
--- a/tests/gold_tests/tls_hooks/tls_hooks18.test.py
+++ b/tests/gold_tests/tls_hooks/tls_hooks18.test.py
@@ -26,7 +26,7 @@
Test.SkipUnless(
Condition.HasOpenSSLVersion("1.1.1")
- )
+)
ts = Test.MakeATSProcess("ts", select_ports=True, enable_tls=True)
server = Test.MakeOriginServer("server")
@@ -43,7 +43,7 @@
'proxy.config.diags.debug.tags': 'ssl_hook_test',
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
})
diff --git a/tests/gold_tests/tls_hooks/tls_hooks2.test.py b/tests/gold_tests/tls_hooks/tls_hooks2.test.py
index 4a89495a6dc..80c3ed165ad 100644
--- a/tests/gold_tests/tls_hooks/tls_hooks2.test.py
+++ b/tests/gold_tests/tls_hooks/tls_hooks2.test.py
@@ -39,7 +39,7 @@
'proxy.config.diags.debug.tags': 'ssl_hook_test',
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
})
diff --git a/tests/gold_tests/tls_hooks/tls_hooks3.test.py b/tests/gold_tests/tls_hooks/tls_hooks3.test.py
index 91b34c60d74..624cb4d4a64 100644
--- a/tests/gold_tests/tls_hooks/tls_hooks3.test.py
+++ b/tests/gold_tests/tls_hooks/tls_hooks3.test.py
@@ -39,7 +39,7 @@
'proxy.config.diags.debug.tags': 'ssl_hook_test',
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
})
diff --git a/tests/gold_tests/tls_hooks/tls_hooks4.test.py b/tests/gold_tests/tls_hooks/tls_hooks4.test.py
index 2ba8db1e925..a78ef3953f4 100644
--- a/tests/gold_tests/tls_hooks/tls_hooks4.test.py
+++ b/tests/gold_tests/tls_hooks/tls_hooks4.test.py
@@ -39,7 +39,7 @@
'proxy.config.diags.debug.tags': 'ssl_hook_test',
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
})
diff --git a/tests/gold_tests/tls_hooks/tls_hooks6.test.py b/tests/gold_tests/tls_hooks/tls_hooks6.test.py
index b21600bfd86..939aa1e9606 100644
--- a/tests/gold_tests/tls_hooks/tls_hooks6.test.py
+++ b/tests/gold_tests/tls_hooks/tls_hooks6.test.py
@@ -39,7 +39,7 @@
'proxy.config.diags.debug.tags': 'ssl_hook_test',
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
})
@@ -68,9 +68,13 @@
preacceptstring0 = "Pre accept callback 0"
preacceptstring1 = "Pre accept callback 1"
ts.Streams.All = Testers.ContainsExpression(
- "\A(?:(?!{0}).)*{0}.*({0})?(?!.*{0}).*\Z".format(preacceptstring0), "Pre accept message appears only once or twice", reflags=re.S | re.M)
+ r"\A(?:(?!{0}).)*{0}.*({0})?(?!.*{0}).*\Z".format(preacceptstring0),
+ "Pre accept message appears only once or twice",
+ reflags=re.S | re.M)
ts.Streams.All = Testers.ContainsExpression(
- "\A(?:(?!{0}).)*{0}.*({0})?(?!.*{0}).*\Z".format(preacceptstring1), "Pre accept message appears only once or twice", reflags=re.S | re.M)
+ r"\A(?:(?!{0}).)*{0}.*({0})?(?!.*{0}).*\Z".format(preacceptstring1),
+ "Pre accept message appears only once or twice",
+ reflags=re.S | re.M)
tr.Processes.Default.TimeOut = 15
tr.TimeOut = 15
diff --git a/tests/gold_tests/tls_hooks/tls_hooks7.test.py b/tests/gold_tests/tls_hooks/tls_hooks7.test.py
index 26bf25b8301..278dd5019bd 100644
--- a/tests/gold_tests/tls_hooks/tls_hooks7.test.py
+++ b/tests/gold_tests/tls_hooks/tls_hooks7.test.py
@@ -39,7 +39,7 @@
'proxy.config.diags.debug.tags': 'ssl_hook_test',
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
})
diff --git a/tests/gold_tests/tls_hooks/tls_hooks8.test.py b/tests/gold_tests/tls_hooks/tls_hooks8.test.py
index 8752f2fc97d..72b194c3264 100644
--- a/tests/gold_tests/tls_hooks/tls_hooks8.test.py
+++ b/tests/gold_tests/tls_hooks/tls_hooks8.test.py
@@ -39,7 +39,7 @@
'proxy.config.diags.debug.tags': 'ssl_hook_test',
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
})
diff --git a/tests/gold_tests/tls_hooks/tls_hooks9.test.py b/tests/gold_tests/tls_hooks/tls_hooks9.test.py
index 2fc904cbb17..efdcb16de1d 100644
--- a/tests/gold_tests/tls_hooks/tls_hooks9.test.py
+++ b/tests/gold_tests/tls_hooks/tls_hooks9.test.py
@@ -39,7 +39,7 @@
'proxy.config.diags.debug.tags': 'ssl_hook_test',
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
- 'proxy.config.ssl.client.verify.server': 0,
+ 'proxy.config.ssl.client.verify.server': 0,
'proxy.config.ssl.server.cipher_suite': 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2',
})
diff --git a/tests/tools/tcp_client.py b/tests/tools/tcp_client.py
index fba05c4d373..632f76dd4cb 100644
--- a/tests/tools/tcp_client.py
+++ b/tests/tools/tcp_client.py
@@ -22,6 +22,7 @@
import sys
import time
+
def tcp_client(host, port, data, closeDelaySeconds=0):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
@@ -52,12 +53,13 @@ def tcp_client(host, port, data, closeDelaySeconds=0):
def main(argv):
- parser = argparse.ArgumentParser(description=DESCRIPTION,\
- formatter_class=argparse.RawDescriptionHelpFormatter)
+ parser = argparse.ArgumentParser(description=DESCRIPTION,
+ formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument('host', help='the target host')
parser.add_argument('port', type=int, help='the target port')
parser.add_argument('file', help='the file with content to be sent')
- parser.add_argument('--delay-after-send', metavar='SECONDS', type=int, help='after send, delay in seconds before half-close', default=0 )
+ parser.add_argument('--delay-after-send', metavar='SECONDS', type=int,
+ help='after send, delay in seconds before half-close', default=0)
args = parser.parse_args()
data = ''
diff --git a/tools/check-unused-dependencies b/tools/check-unused-dependencies
index 45ee5262882..691a0543985 100755
--- a/tools/check-unused-dependencies
+++ b/tools/check-unused-dependencies
@@ -68,7 +68,7 @@ def get_dependencies(program):
])):
continue
- if re.sub('\s+', '', dependency):
+ if re.sub(r'\s+', '', dependency):
yield dependency