You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ja...@apache.org on 2015/05/01 04:25:58 UTC
trafficserver git commit: Flake8 cleanup
Repository: trafficserver
Updated Branches:
refs/heads/master e09749ca9 -> 9b5235de8
Flake8 cleanup
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/9b5235de
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/9b5235de
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/9b5235de
Branch: refs/heads/master
Commit: 9b5235de8cb24445ae51500627ead9b77ebbcbf1
Parents: e09749c
Author: Thomas Jackson <ja...@apache.org>
Authored: Thu Apr 30 19:25:34 2015 -0700
Committer: Thomas Jackson <ja...@apache.org>
Committed: Thu Apr 30 19:25:50 2015 -0700
----------------------------------------------------------------------
ci/tsqa/tests/helpers.py | 2 ++
ci/tsqa/tests/test_buildoptions.py | 20 ++++-------
ci/tsqa/tests/test_chunked.py | 6 ++--
ci/tsqa/tests/test_connect_attempts.py | 46 ++++++++++++++-----------
ci/tsqa/tests/test_example.py | 16 +++++----
ci/tsqa/tests/test_hostdb.py | 3 --
ci/tsqa/tests/test_https.py | 27 ++++++++-------
ci/tsqa/tests/test_keepalive.py | 46 +++++++++++++++----------
ci/tsqa/tests/test_redirection.py | 1 +
ci/tsqa/tests/test_regressions.py | 6 ++--
ci/tsqa/tests/test_remap.py | 19 ++++++----
ci/tsqa/tests/test_spdy_protocol_select.py | 44 +++++++++++++----------
12 files changed, 129 insertions(+), 107 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9b5235de/ci/tsqa/tests/helpers.py
----------------------------------------------------------------------
diff --git a/ci/tsqa/tests/helpers.py b/ci/tsqa/tests/helpers.py
index 7333569..167c0dc 100644
--- a/ci/tsqa/tests/helpers.py
+++ b/ci/tsqa/tests/helpers.py
@@ -22,6 +22,7 @@ import tsqa.utils
unittest = tsqa.utils.import_unittest()
+
# TODO: check that the given path is relative
def tests_file_path(path):
'''
@@ -30,6 +31,7 @@ def tests_file_path(path):
base = os.path.realpath(os.path.join(__file__, '..', '..', 'files'))
return os.path.join(base, path)
+
class EnvironmentCase(tsqa.test_cases.EnvironmentCase):
'''
This class will get an environment (which is unique) but won't start it
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9b5235de/ci/tsqa/tests/test_buildoptions.py
----------------------------------------------------------------------
diff --git a/ci/tsqa/tests/test_buildoptions.py b/ci/tsqa/tests/test_buildoptions.py
index 986e53d..d3588bb 100644
--- a/ci/tsqa/tests/test_buildoptions.py
+++ b/ci/tsqa/tests/test_buildoptions.py
@@ -18,16 +18,8 @@ Test that configuration options successfully compile
# See the License for the specific language governing permissions and
# limitations under the License.
-import os
-import sys
-import requests
-import time
-import subprocess
import logging
-
import helpers
-import tsqa.test_cases
-import tsqa.utils
log = logging.getLogger(__name__)
@@ -42,29 +34,31 @@ class TestBuildOption(helpers.EnvironmentCase):
class TestBuildOptionFastSDK(TestBuildOption):
'''Build with --enable-fast-sdk'''
- environment_factory = { 'configure': { 'enable-fast-sdk': None }, }
+ environment_factory = {'configure': {'enable-fast-sdk': None}}
class TestBuildOptionDisableDiags(TestBuildOption):
'''Build with --disable-diags'''
- environment_factory = { 'configure': { 'disable-diags': None }, }
+ environment_factory = {'configure': {'disable-diags': None}}
class TestBuildOptionDisableTests(TestBuildOption):
'''Build with --disable-tests'''
- environment_factory = { 'configure': { 'disable-tests': None }, }
+ environment_factory = {'configure': {'disable-tests': None}}
class TestBuildOptionEnableStaticProxy(TestBuildOption):
'''Build with --enable-static-proxy'''
- environment_factory = { 'configure': { 'enable-static-proxy': None }, }
+ environment_factory = {'configure': {'enable-static-proxy': None}}
+
@classmethod
def setUpClass(cls):
raise helpers.unittest.SkipTest('Skip until TS-3577 is resolved')
+
class TestBuildOptionEnableCxxApi(TestBuildOption):
'''Build with --enable-cppapi'''
- environment_factory = { 'configure': { 'enable-cppapi': None }, }
+ environment_factory = {'configure': {'enable-cppapi': None}}
@classmethod
def setUpClass(cls):
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9b5235de/ci/tsqa/tests/test_chunked.py
----------------------------------------------------------------------
diff --git a/ci/tsqa/tests/test_chunked.py b/ci/tsqa/tests/test_chunked.py
index 5d265f4..8d2e3af 100644
--- a/ci/tsqa/tests/test_chunked.py
+++ b/ci/tsqa/tests/test_chunked.py
@@ -17,7 +17,6 @@ Test chunked request/responses
# See the License for the specific language governing permissions and
# limitations under the License.
-import os
import requests
import time
import logging
@@ -34,6 +33,8 @@ import tsqa.endpoint
log = logging.getLogger(__name__)
import SocketServer
+
+
class ChunkedHandler(SocketServer.BaseRequestHandler):
"""
A subclass of RequestHandler which return chunked encoding optionally
@@ -86,6 +87,7 @@ class ChunkedHandler(SocketServer.BaseRequestHandler):
time.sleep(2)
+
class TestChunked(helpers.EnvironmentCase):
@classmethod
def setUpEnv(cls, env):
@@ -193,4 +195,4 @@ class TestChunked(helpers.EnvironmentCase):
def test_chunked_bad_close(self):
url = 'http://127.0.0.1:{0}/5/0.1/false'.format(self.port)
with self.assertRaises(socket.timeout):
- ret = requests.get(url, proxies=self.proxies, timeout=2)
+ requests.get(url, proxies=self.proxies, timeout=2)
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9b5235de/ci/tsqa/tests/test_connect_attempts.py
----------------------------------------------------------------------
diff --git a/ci/tsqa/tests/test_connect_attempts.py b/ci/tsqa/tests/test_connect_attempts.py
index 08dc74b..ce44fe2 100644
--- a/ci/tsqa/tests/test_connect_attempts.py
+++ b/ci/tsqa/tests/test_connect_attempts.py
@@ -27,20 +27,17 @@ import threading
import helpers
-import tsqa.test_cases
-import tsqa.utils
-import tsqa.endpoint
-
log = logging.getLogger(__name__)
def thread_die_on_connect(sock):
sock.listen(0)
# poll
- read_sock = select.select([sock], [], [])
+ select.select([sock], [], [])
# exit
sock.close()
+
def thread_delayed_accept_after_connect(sock):
'''
Thread to sleep a decreasing amount of time before requests
@@ -49,19 +46,21 @@ def thread_delayed_accept_after_connect(sock):
'''
sock.listen(0)
sleep_time = 2
- requests = 0
+ num_requests = 0
# poll
while True:
- read_sock = select.select([sock], [], [])
+ select.select([sock], [], [])
time.sleep(sleep_time)
try:
connection, addr = sock.accept()
- connection.send(('HTTP/1.1 200 OK\r\n'
- 'Content-Length: {body_len}\r\n'
- 'Content-Type: text/html; charset=UTF-8\r\n'
- 'Connection: close\r\n\r\n{body}'.format(body_len=len(str(requests)), body=requests)))
+ connection.send((
+ 'HTTP/1.1 200 OK\r\n'
+ 'Content-Length: {body_len}\r\n'
+ 'Content-Type: text/html; charset=UTF-8\r\n'
+ 'Connection: close\r\n\r\n{body}'.format(body_len=len(str(requests)), body=requests)
+ ))
connection.close()
- requests += 1
+ num_requests += 1
except Exception as e:
print 'connection died!', e
pass
@@ -81,12 +80,15 @@ def thread_reset_after_accept(sock):
connection.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack('ii', 1, 0))
connection.close()
else:
- connection.send(('HTTP/1.1 200 OK\r\n'
- 'Content-Length: {body_len}\r\n'
- 'Content-Type: text/html; charset=UTF-8\r\n'
- 'Connection: close\r\n\r\n{body}'.format(body_len=len(str(requests)), body=requests)))
+ connection.send((
+ 'HTTP/1.1 200 OK\r\n'
+ 'Content-Length: {body_len}\r\n'
+ 'Content-Type: text/html; charset=UTF-8\r\n'
+ 'Connection: close\r\n\r\n{body}'.format(body_len=len(str(requests)), body=requests)
+ ))
connection.close()
+
def thread_partial_response(sock):
sock.listen(0)
first = True
@@ -100,14 +102,15 @@ def thread_partial_response(sock):
connection.close()
first = False
else:
- connection.send(('HTTP/1.1 200 OK\r\n'
- 'Content-Length: {body_len}\r\n'
- 'Content-Type: text/html; charset=UTF-8\r\n'
- 'Connection: close\r\n\r\n{body}'.format(body_len=len(str(requests)), body=requests)))
+ connection.send((
+ 'HTTP/1.1 200 OK\r\n'
+ 'Content-Length: {body_len}\r\n'
+ 'Content-Type: text/html; charset=UTF-8\r\n'
+ 'Connection: close\r\n\r\n{body}'.format(body_len=len(str(requests)), body=requests)
+ ))
connection.close()
-
class TestOriginServerConnectAttempts(helpers.EnvironmentCase):
@classmethod
def setUpEnv(cls, env):
@@ -116,6 +119,7 @@ class TestOriginServerConnectAttempts(helpers.EnvironmentCase):
This includes everything pre-daemon start
'''
cls.sock_map = {}
+
def _add_sock(name):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(('127.0.0.1', 0))
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9b5235de/ci/tsqa/tests/test_example.py
----------------------------------------------------------------------
diff --git a/ci/tsqa/tests/test_example.py b/ci/tsqa/tests/test_example.py
index 0a7f468..58f6ca3 100644
--- a/ci/tsqa/tests/test_example.py
+++ b/ci/tsqa/tests/test_example.py
@@ -30,18 +30,19 @@ import tsqa.utils
# TODO: for some reason subclasses of subclasses of TestCase don't work with the
# decorator
-#@helpers.unittest.skip('Not running TestNoOp, as it is a NoOp test')
+# @helpers.unittest.skip('Not running TestNoOp, as it is a NoOp test')
+
+
class TestNoOp(helpers.EnvironmentCase):
'''
This is purely a documentation test
'''
# you can set configure/environment options for the source build here
environment_factory = {
- 'configure': {# A value of None means that the argument has no value
- 'enable-spdy': None,
- # if there is a value it will be converted to --key=value
- 'with-max-api-stats': 2048,
- },
+ 'configure': {
+ 'enable-spdy': None, # A value of None means that the argument has no value
+ 'with-max-api-stats': 2048, # if there is a value it will be converted to --key=value
+ },
'env': None,
}
@@ -122,6 +123,7 @@ class TestBootstrap(helpers.EnvironmentCase):
class TestServerIntercept(helpers.EnvironmentCase, tsqa.test_cases.DynamicHTTPEndpointCase):
endpoint_port = 60000
+
@classmethod
def setUpEnv(cls, env):
cls.configs['remap.config'].add_line('map / http://127.0.0.1:{0}'.format(cls.endpoint_port))
@@ -132,7 +134,6 @@ class TestServerIntercept(helpers.EnvironmentCase, tsqa.test_cases.DynamicHTTPEn
return 'hello'
cls.http_endpoint.add_handler('/', hello)
-
def test_basic_intercept(self):
for _ in xrange(0, 10):
ret = requests.get('http://127.0.0.1:{0}/'.format(self.configs['records.config']['CONFIG']['proxy.config.http.server_ports']))
@@ -154,6 +155,7 @@ class TestLogs(helpers.EnvironmentCase):
'proxy.config.log.hostname': 'test',
'proxy.config.log.search_top_sites': 1,
})
+
def test_logs_exist(self):
# send some requests
for x in xrange(0, 10):
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9b5235de/ci/tsqa/tests/test_hostdb.py
----------------------------------------------------------------------
diff --git a/ci/tsqa/tests/test_hostdb.py b/ci/tsqa/tests/test_hostdb.py
index 6d0ce9c..b5d2a03 100644
--- a/ci/tsqa/tests/test_hostdb.py
+++ b/ci/tsqa/tests/test_hostdb.py
@@ -24,8 +24,6 @@ import time
import helpers
-import tsqa.test_cases
-
class TestHostDBPartiallyFailedDNS(helpers.EnvironmentCase):
'''
@@ -83,4 +81,3 @@ class TestHostDBFailedDNS(helpers.EnvironmentCase):
self.assertGreater(time.time() - start, self.configs['records.config']['CONFIG']['proxy.config.hostdb.lookup_timeout'])
self.assertEqual(ret.status_code, 502)
self.assertIn('ATS', ret.headers['server'])
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9b5235de/ci/tsqa/tests/test_https.py
----------------------------------------------------------------------
diff --git a/ci/tsqa/tests/test_https.py b/ci/tsqa/tests/test_https.py
index 9273b4f..3630917 100644
--- a/ci/tsqa/tests/test_https.py
+++ b/ci/tsqa/tests/test_https.py
@@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import logging
from OpenSSL import SSL
import socket
@@ -138,18 +137,18 @@ class TestRSA(helpers.EnvironmentCase, CertSelectionMixin):
cls.configs['ssl_multicert.config'].add_line('dest_ip=127.0.0.2 ssl_cert_name={0} ssl_ca_name={1}'.format(
helpers.tests_file_path('rsa_keys/www.example.com.pem'),
helpers.tests_file_path('rsa_keys/intermediate.crt'),
- ))
+ ))
cls.configs['ssl_multicert.config'].add_line('dest_ip=127.0.0.2 ssl_cert_name={0}'.format(
helpers.tests_file_path('rsa_keys/www.test.com.pem'),
- ))
+ ))
cls.configs['ssl_multicert.config'].add_line('dest_ip=* ssl_cert_name={0} ssl_ca_name={1}'.format(
helpers.tests_file_path('rsa_keys/www.example.com.pem'),
helpers.tests_file_path('rsa_keys/intermediate.crt'),
- ))
+ ))
cls.configs['ssl_multicert.config'].add_line('dest_ip=* ssl_cert_name={0}'.format(
helpers.tests_file_path('rsa_keys/www.test.com.pem'),
- ))
+ ))
def test_rsa(self):
addr = ('127.0.0.1', self.ssl_port)
@@ -169,6 +168,7 @@ class TestRSA(helpers.EnvironmentCase, CertSelectionMixin):
with self.assertRaises(Exception):
self._intermediate_ca_t('ecdsa')
+
class TestECDSA(helpers.EnvironmentCase, CertSelectionMixin):
'''
Tests for https for ATS configured with ECDSA certificates
@@ -188,18 +188,18 @@ class TestECDSA(helpers.EnvironmentCase, CertSelectionMixin):
cls.configs['ssl_multicert.config'].add_line('dest_ip=127.0.0.2 ssl_cert_name={0} ssl_ca_name={1}'.format(
helpers.tests_file_path('ec_keys/www.example.com.pem'),
helpers.tests_file_path('ec_keys/intermediate.crt'),
- ))
+ ))
cls.configs['ssl_multicert.config'].add_line('dest_ip=127.0.0.2 ssl_cert_name={0}'.format(
helpers.tests_file_path('ec_keys/www.test.com.pem'),
- ))
+ ))
cls.configs['ssl_multicert.config'].add_line('dest_ip=* ssl_cert_name={0} ssl_ca_name={1}'.format(
helpers.tests_file_path('ec_keys/www.example.com.pem'),
helpers.tests_file_path('ec_keys/intermediate.crt'),
- ))
+ ))
cls.configs['ssl_multicert.config'].add_line('dest_ip=* ssl_cert_name={0}'.format(
helpers.tests_file_path('ec_keys/www.test.com.pem'),
- ))
+ ))
def test_rsa(self):
addr = ('127.0.0.1', self.ssl_port)
@@ -219,6 +219,7 @@ class TestECDSA(helpers.EnvironmentCase, CertSelectionMixin):
def test_intermediate_ca_ecdsa(self):
self._intermediate_ca_t('ecdsa')
+
class TestMix(helpers.EnvironmentCase, CertSelectionMixin):
'''
Tests for https for ATS configured with both ECDSA and RSA certificates
@@ -240,22 +241,22 @@ class TestMix(helpers.EnvironmentCase, CertSelectionMixin):
helpers.tests_file_path('ec_keys/www.example.com.pem'),
helpers.tests_file_path('rsa_keys/intermediate.crt'),
helpers.tests_file_path('ec_keys/intermediate.crt'),
- ))
+ ))
cls.configs['ssl_multicert.config'].add_line('dest_ip=127.0.0.2 ssl_cert_name={0},{1}'.format(
helpers.tests_file_path('rsa_keys/www.test.com.pem'),
helpers.tests_file_path('ec_keys/www.test.com.pem'),
- ))
+ ))
cls.configs['ssl_multicert.config'].add_line('dest_ip=* ssl_cert_name={0},{1} ssl_ca_name={2},{3}'.format(
helpers.tests_file_path('rsa_keys/www.example.com.pem'),
helpers.tests_file_path('ec_keys/www.example.com.pem'),
helpers.tests_file_path('rsa_keys/intermediate.crt'),
helpers.tests_file_path('ec_keys/intermediate.crt'),
- ))
+ ))
cls.configs['ssl_multicert.config'].add_line('dest_ip=* ssl_cert_name={0},{1}'.format(
helpers.tests_file_path('rsa_keys/www.test.com.pem'),
helpers.tests_file_path('ec_keys/www.test.com.pem'),
- ))
+ ))
def test_rsa(self):
addr = ('127.0.0.1', self.ssl_port)
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9b5235de/ci/tsqa/tests/test_keepalive.py
----------------------------------------------------------------------
diff --git a/ci/tsqa/tests/test_keepalive.py b/ci/tsqa/tests/test_keepalive.py
index 5216282..377d801 100644
--- a/ci/tsqa/tests/test_keepalive.py
+++ b/ci/tsqa/tests/test_keepalive.py
@@ -83,7 +83,7 @@ class KeepAliveInMixin(object):
url = '{0}://127.0.0.1:{1}/'.format(protocol, int(self.configs['records.config']['CONFIG']['proxy.config.http.server_ports']))
conn_id = None
for x in xrange(1, 10):
- ret = requests.get(url, headers=headers)
+ ret = s.get(url, headers=headers)
self.assertEqual(ret.status_code, 200)
if conn_id is None:
conn_id = ret.text
@@ -168,16 +168,19 @@ class BasicTestsOutMixin(object):
'''
Test that keepalive works through ATS to that origin
'''
- url = '{0}://127.0.0.1:{1}'.format(protocol,
- self.configs['records.config']['CONFIG']['proxy.config.http.server_ports'])
+ url = '{0}://127.0.0.1:{1}'.format(
+ protocol,
+ self.configs['records.config']['CONFIG']['proxy.config.http.server_ports'],
+ )
conn_id = None
for x in xrange(1, 10):
ret = requests.get(url, verify=False, headers=headers)
if not conn_id:
- conn_id = ret.text.strip()
+ conn_id = ret.text.strip()
self.assertEqual(ret.status_code, 200)
self.assertEqual(ret.text.strip(), conn_id, "Client reports server closed connection")
+
class TimeoutOutMixin(object):
def _aux_KA_timeout_direct(self, protocol):
@@ -194,8 +197,10 @@ class TimeoutOutMixin(object):
def _aux_KA_timeout_proxy(self, protocol):
'''Tests that keepalive timeout is honored through ATS to origin.'''
- url = '{0}://127.0.0.1:{1}'.format(protocol,
- self.configs['records.config']['CONFIG']['proxy.config.http.server_ports'])
+ url = '{0}://127.0.0.1:{1}'.format(
+ protocol,
+ self.configs['records.config']['CONFIG']['proxy.config.http.server_ports'],
+ )
conn_id = None
for x in xrange(0, 3):
ret = requests.get(url, verify=False)
@@ -209,8 +214,10 @@ class OriginMinMaxMixin(object):
def _aux_KA_min_origin(self, protocol):
'''Tests that origin_min_keep_alive_connections is honored.'''
- url = '{0}://127.0.0.1:{1}'.format(protocol,
- self.configs['records.config']['CONFIG']['proxy.config.http.server_ports'])
+ url = '{0}://127.0.0.1:{1}'.format(
+ protocol,
+ self.configs['records.config']['CONFIG']['proxy.config.http.server_ports'],
+ )
ret = requests.get(url, verify=False)
conn_id = ret.text.strip()
time.sleep(3)
@@ -249,6 +256,7 @@ class TestKeepAliveInHTTP(tsqa.test_cases.DynamicHTTPEndpointCase, helpers.Envir
'''
self._aux_error_path_post("http")
+
class TestKeepAliveOriginConnOutHTTP(helpers.EnvironmentCase, OriginMinMaxMixin):
@classmethod
def setUpEnv(cls, env):
@@ -289,10 +297,12 @@ class TestKeepAliveOriginConnOutHTTPS(helpers.EnvironmentCase, OriginMinMaxMixin
This function is responsible for setting up the environment for this fixture
This includes everything pre-daemon start
'''
- # create a socket server
- cls.socket_server = tsqa.endpoint.SSLSocketServerDaemon(KeepaliveTCPHandler,
- helpers.tests_file_path('cert.pem'),
- helpers.tests_file_path('key.pem'))
+ # create a socket server
+ cls.socket_server = tsqa.endpoint.SSLSocketServerDaemon(
+ KeepaliveTCPHandler,
+ helpers.tests_file_path('cert.pem'),
+ helpers.tests_file_path('key.pem'),
+ )
cls.socket_server.start()
cls.socket_server.ready.wait()
cls.configs['remap.config'].add_line('map / https://127.0.0.1:{0}/\n'.format(cls.socket_server.port))
@@ -369,9 +379,11 @@ class TestKeepAliveOutHTTPS(helpers.EnvironmentCase, BasicTestsOutMixin, Timeout
This includes everything pre-daemon start
'''
# create a socket server
- cls.socket_server = tsqa.endpoint.SSLSocketServerDaemon(KeepaliveTCPHandler,
- helpers.tests_file_path('cert.pem'),
- helpers.tests_file_path('key.pem'))
+ cls.socket_server = tsqa.endpoint.SSLSocketServerDaemon(
+ KeepaliveTCPHandler,
+ helpers.tests_file_path('cert.pem'),
+ helpers.tests_file_path('key.pem'),
+ )
cls.socket_server.start()
cls.socket_server.ready.wait()
cls.configs['remap.config'].add_line('map / https://127.0.0.1:{0}/\n'.format(cls.socket_server.port))
@@ -407,9 +419,8 @@ class TestKeepAliveOutHTTPS(helpers.EnvironmentCase, BasicTestsOutMixin, Timeout
self._aux_KA_timeout_proxy("http")
-
# TODO: refactor these tests, these are *very* similar, we should paramatarize them
-## Some basic tests for auth_sever_session_private
+# Some basic tests for auth_sever_session_private
class TestKeepAlive_Authorization_private(helpers.EnvironmentCase, BasicTestsOutMixin, KeepAliveInMixin):
@classmethod
def setUpEnv(cls, env):
@@ -442,7 +453,6 @@ class TestKeepAlive_Authorization_private(helpers.EnvironmentCase, BasicTestsOut
self._aux_KA_working_path_connid("http", headers={'Authorization': 'Foo'})
-
class TestKeepAlive_Authorization_no_private(helpers.EnvironmentCase, BasicTestsOutMixin, KeepAliveInMixin):
@classmethod
def setUpEnv(cls, env):
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9b5235de/ci/tsqa/tests/test_redirection.py
----------------------------------------------------------------------
diff --git a/ci/tsqa/tests/test_redirection.py b/ci/tsqa/tests/test_redirection.py
index 1100dc1..5a0b4ce 100644
--- a/ci/tsqa/tests/test_redirection.py
+++ b/ci/tsqa/tests/test_redirection.py
@@ -20,6 +20,7 @@ import tsqa.test_cases
import tsqa.utils
import tsqa.endpoint
+
class TestRedirection(helpers.EnvironmentCase, tsqa.test_cases.HTTPBinCase):
@classmethod
def setUpEnv(cls, env):
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9b5235de/ci/tsqa/tests/test_regressions.py
----------------------------------------------------------------------
diff --git a/ci/tsqa/tests/test_regressions.py b/ci/tsqa/tests/test_regressions.py
index f8cd1f0..e49aa74 100644
--- a/ci/tsqa/tests/test_regressions.py
+++ b/ci/tsqa/tests/test_regressions.py
@@ -19,9 +19,6 @@ Run the built-in regression tests with experimental build configurations.
# limitations under the License.
import os
-import sys
-import requests
-import time
import subprocess
import logging
@@ -31,6 +28,7 @@ import tsqa.utils
log = logging.getLogger(__name__)
+
class TestRegressions(helpers.EnvironmentCase):
'''
Run the built-in traffic_server regression test suite.
@@ -61,5 +59,5 @@ class TestRegressionsLinuxNativeAIO(TestRegressions):
--enable-linux-native-aio.
'''
environment_factory = {
- 'configure': { 'enable-linux-native-aio': None },
+ 'configure': {'enable-linux-native-aio': None},
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9b5235de/ci/tsqa/tests/test_remap.py
----------------------------------------------------------------------
diff --git a/ci/tsqa/tests/test_remap.py b/ci/tsqa/tests/test_remap.py
index aac6e8e..9b42f10 100644
--- a/ci/tsqa/tests/test_remap.py
+++ b/ci/tsqa/tests/test_remap.py
@@ -14,9 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import os
import requests
-import time
import logging
import helpers
@@ -27,6 +25,7 @@ import tsqa.endpoint
log = logging.getLogger(__name__)
+
class TestRemapHTTP(tsqa.test_cases.DynamicHTTPEndpointCase, helpers.EnvironmentCase):
@classmethod
def setUpEnv(cls, env):
@@ -36,9 +35,11 @@ class TestRemapHTTP(tsqa.test_cases.DynamicHTTPEndpointCase, helpers.Environment
})
cls.configs['remap.config'].add_line(
- 'map http://www.example.com http://127.0.0.1:{0}'.format(cls.http_endpoint.address[1]));
+ 'map http://www.example.com http://127.0.0.1:{0}'.format(cls.http_endpoint.address[1])
+ )
cls.configs['remap.config'].add_line(
- 'map http://www.example.com:8080 http://127.0.0.1:{0}'.format(cls.http_endpoint.address[1]));
+ 'map http://www.example.com:8080 http://127.0.0.1:{0}'.format(cls.http_endpoint.address[1])
+ )
def hello(request):
return 'hello'
@@ -72,6 +73,7 @@ class TestRemapHTTP(tsqa.test_cases.DynamicHTTPEndpointCase, helpers.Environment
ret = s.get(url)
self.assertEqual(ret.status_code, 404)
+
class TestRemapHTTPS(tsqa.test_cases.DynamicHTTPEndpointCase, helpers.EnvironmentCase):
@classmethod
def setUpEnv(cls, env):
@@ -84,12 +86,15 @@ class TestRemapHTTPS(tsqa.test_cases.DynamicHTTPEndpointCase, helpers.Environmen
})
cls.configs['remap.config'].add_line(
- 'map https://www.example.com http://127.0.0.1:{0}'.format(cls.http_endpoint.address[1]));
+ 'map https://www.example.com http://127.0.0.1:{0}'.format(cls.http_endpoint.address[1])
+ )
cls.configs['remap.config'].add_line(
- 'map https://www.example.com:4443 http://127.0.0.1:{0}'.format(cls.http_endpoint.address[1]));
+ 'map https://www.example.com:4443 http://127.0.0.1:{0}'.format(cls.http_endpoint.address[1])
+ )
# configure SSL multicert
cls.configs['ssl_multicert.config'].add_line(
- 'dest_ip=* ssl_cert_name={0}'.format(helpers.tests_file_path('rsa_keys/www.example.com.pem')))
+ 'dest_ip=* ssl_cert_name={0}'.format(helpers.tests_file_path('rsa_keys/www.example.com.pem'))
+ )
def hello(request):
return 'hello'
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9b5235de/ci/tsqa/tests/test_spdy_protocol_select.py
----------------------------------------------------------------------
diff --git a/ci/tsqa/tests/test_spdy_protocol_select.py b/ci/tsqa/tests/test_spdy_protocol_select.py
index 50fabce..dc0b33d 100644
--- a/ci/tsqa/tests/test_spdy_protocol_select.py
+++ b/ci/tsqa/tests/test_spdy_protocol_select.py
@@ -15,8 +15,6 @@
# limitations under the License.
import os
-import requests
-import time
import logging
import subprocess
@@ -28,7 +26,8 @@ import tsqa.endpoint
log = logging.getLogger(__name__)
-#helper function to get spdycat path
+
+# helper function to get spdycat path
def which(program):
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
@@ -44,11 +43,12 @@ def which(program):
return exe_file
return None
+
class TestSPDY(helpers.EnvironmentCase):
environment_factory = {
'configure': {'enable-spdy': None},
'env': {'PKG_CONFIG_PATH': os.getenv("SPDY_PKG_CONFIG_PATH", "/opt/spdylay/lib/pkgconfig/")},
- }
+ }
@classmethod
def setUpEnv(cls, env):
@@ -64,7 +64,7 @@ class TestSPDY(helpers.EnvironmentCase):
cls.client = '%s/spdylay/src/spdycat' % build_dir
if os.path.isfile(cls.client) is False:
raise helpers.unittest.SkipTest('Cannot find spdycat. skipping test.')
-
+
log.info('spdycat path = {0}'.format(cls.client))
# get spdy server ports
@@ -74,59 +74,64 @@ class TestSPDY(helpers.EnvironmentCase):
log.info('http server port = {0}'.format(cls.http_port))
cls.configs['remap.config'].add_line('map / https://docs.trafficserver.apache.org/\n')
-
+
# set only one ET_NET thread (so we don't have to worry about the per-thread pools causing issues)
cls.configs['records.config']['CONFIG']['proxy.config.exec_thread.limit'] = 1
cls.configs['records.config']['CONFIG']['proxy.config.exec_thread.autoconfig'] = 0
-
+
# SPDY configs
cls.configs['records.config']['CONFIG']['proxy.config.http.server_ports'] += ' {0}:ssl {1}:proto=http:ssl'.format(cls.spdy_port, cls.http_port)
cls.configs['records.config']['CONFIG']['proxy.config.ssl.server.cert.path'] = helpers.tests_file_path('rsa_keys')
-
+
# configure SSL multicert
cls.configs['ssl_multicert.config'].add_line('dest_ip=* ssl_cert_name={0}\n'.format(helpers.tests_file_path('rsa_keys/www.example.com.pem')))
@classmethod
def callSpdycat(self, port, path, args):
- full_args = [self.client,'https://localhost:%d%s' % (port, path)] + args
+ full_args = [self.client, 'https://localhost:%d%s' % (port, path)] + args
self.log.info('full args = {0}'.format(full_args))
- p = subprocess.Popen(full_args, stdout=subprocess.PIPE,
- stdin=subprocess.PIPE)
+ p = subprocess.Popen(
+ full_args,
+ stdout=subprocess.PIPE,
+ stdin=subprocess.PIPE,
+ )
self.stdout, self.stderr = p.communicate()
return p.returncode
-"""
-TODO: re-add spdy2 tests. looks like support here might be lacking some way. was not able to get ATS to advertise spdy/2
-even when it was explicitly set with proto=spdy/2
-"""
+
class TestSPDYv2(TestSPDY):
+ """
+ TODO: re-add spdy2 tests. looks like support here might be lacking some way. was not able to get ATS to advertise spdy/2
+ even when it was explicitly set with proto=spdy/2
+ """
@classmethod
def setUpClass(cls):
'''
Skip spdy2 tests for now
'''
raise helpers.unittest.SkipTest('Skipping spdy/2 tests')
-
+
@classmethod
def setUpEnv(cls, env):
'''
This function is responsible for setting up the environment for this fixture
This includes everything pre-daemon start
- '''
+ '''
super(TestSPDYv2, cls).setUpEnv(env)
cls.spdy2_port = tsqa.utils.bind_unused_port()[1]
log.info('spdy2 server port = {0}'.format(cls.spdy2_port))
# make sure we add port supports spdy2
cls.configs['records.config']['CONFIG']['proxy.config.http.server_ports'] += ' {0}:proto=spdy/2:ssl'.format(cls.spdy2_port)
-
+
def test_SPDY_v2(self):
'''
Test that the origin does in fact support spdy 2
'''
- self.assertEquals(0, self.callSpdycat(self.spdy2_port, '/', ['-nv', '--spdy2'])) #this isn't passing
+ self.assertEquals(0, self.callSpdycat(self.spdy2_port, '/', ['-nv', '--spdy2'])) # this isn't passing
self.assertIn('version=2', self.stdout)
+
class TestSPDYv3(TestSPDY):
def test_SPDY_v3(self):
'''
@@ -141,6 +146,7 @@ class TestSPDYv3(TestSPDY):
'''
self.assertEquals(1, self.callSpdycat(self.http_port, '/', ['-nv', '--spdy3']))
+
class TestSPDYv3_1(TestSPDY):
def test_SPDY_v3_1(self):
'''