Commit 278810a3 authored by Jérome Perrin's avatar Jérome Perrin

caddy: use slapos.core.testing instead of local utils.py

parent cd83e1f3
......@@ -43,11 +43,15 @@ import subprocess
from unittest import skipIf, skip
import ssl
from BaseHTTPServer import HTTPServer
from BaseHTTPServer import BaseHTTPRequestHandler
from forcediphttpsadapter.adapters import ForcedIPHTTPSAdapter
import time
import utils
from slapos.core.testing import SlapOSInstanceTestCase
from slapos.core.testing import findFreeTCPPort
LOCAL_IPV4 = os.environ['LOCAL_IPV4']
GLOBAL_IPV6 = os.environ['GLOBAL_IPV6']
# ports chosen to not collide with test systems
HTTP_PORT = '11080'
......@@ -176,6 +180,14 @@ if os.environ.get('DEBUG'):
import unittest
unittest.installHandler()
def der2pem(der):
Please register or sign in to reply
certificate, error = subprocess.Popen(
'openssl x509 -inform der'.split(), stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.PIPE
).communicate(der)
if error:
raise ValueError(error)
return certificate
def isHTTP2(domain, ip):
curl_command = '%(curl)s --http2 -v -k -H "Host: %(domain)s" ' \
......@@ -275,7 +287,7 @@ class TestDataMixin(object):
self.assertTestData(runtime_data)
class HttpFrontendTestCase(utils.SlapOSInstanceTestCase):
class HttpFrontendTestCase(SlapOSInstanceTestCase):
frontend_type = 'CADDY' if IS_CADDY else 'APACHE'
def assertLogAccessUrlWithPop(self, parameter_dict, reference):
......@@ -373,16 +385,30 @@ class TestMasterRequestDomain(HttpFrontendTestCase, TestDataMixin):
)
class TestHandler(BaseHTTPRequestHandler):
Please register or sign in to reply
def do_GET(self):
self.send_response(200)
self.send_header("Content-type", "application/json")
self.send_header('Set-Cookie', 'secured=value;secure')
self.send_header('Set-Cookie', 'nonsecured=value')
self.end_headers()
response = {
'Path': self.path,
'Incoming Headers': self.headers.dict
}
self.wfile.write(json.dumps(response, indent=2))
class SlaveHttpFrontendTestCase(HttpFrontendTestCase):
@classmethod
def startServerProcess(cls):
server = HTTPServer(
(utils.LOCAL_IPV4, utils.findFreeTCPPort(utils.LOCAL_IPV4)),
utils.TestHandler)
(LOCAL_IPV4, findFreeTCPPort(LOCAL_IPV4)),
TestHandler)
server_https = HTTPServer(
(utils.LOCAL_IPV4, utils.findFreeTCPPort(utils.LOCAL_IPV4)),
utils.TestHandler)
(LOCAL_IPV4, findFreeTCPPort(LOCAL_IPV4)),
TestHandler)
server_https.socket = ssl.wrap_socket(
server_https.socket,
......@@ -526,7 +552,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
return {
'domain': 'example.com',
'nginx-domain': 'nginx.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
'apache-certificate': open('wildcard.example.com.crt').read(),
'apache-key': open('wildcard.example.com.key').read(),
'-frontend-authorized-slave-string':
......@@ -797,7 +823,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'url': 'http://empty.example.com',
'site_url': 'http://empty.example.com',
'secure_access': 'https://empty.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -805,7 +831,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqual(result.status_code, no_backend_response_code)
......@@ -854,7 +880,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'url': 'http://url.example.com',
'site_url': 'http://url.example.com',
'secure_access': 'https://url.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -862,7 +888,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqualResultJson(result, 'Path', '/test-path')
......@@ -916,21 +942,21 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'url': 'http://url.example.com',
'site_url': 'http://url.example.com',
'secure_access': 'https://url.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
result_ipv6 = self.fakeHTTPSResult(
parameter_dict['domain'], utils.GLOBAL_IPV6, 'test-path',
source_ip=utils.GLOBAL_IPV6)
parameter_dict['domain'], GLOBAL_IPV6, 'test-path',
source_ip=GLOBAL_IPV6)
self.assertEqual(
result_ipv6.json()['Incoming Headers']['x-forwarded-for'],
utils.GLOBAL_IPV6
GLOBAL_IPV6
)
self.assertEqual(
utils.der2pem(result_ipv6.peercert),
der2pem(result_ipv6.peercert),
open('wildcard.example.com.crt').read())
self.assertEqualResultJson(result_ipv6, 'Path', '/test-path')
......@@ -947,7 +973,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'url': 'http://typezopepath.example.com',
'site_url': 'http://typezopepath.example.com',
'secure_access': 'https://typezopepath.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -955,7 +981,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqualResultJson(
......@@ -977,7 +1003,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'url': 'http://typezopedefaultpath.example.com',
'site_url': 'http://typezopedefaultpath.example.com',
'secure_access': 'https://typezopedefaultpath.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -985,7 +1011,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], '')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqual(
......@@ -1005,7 +1031,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'url': 'http://serveralias.example.com',
'site_url': 'http://serveralias.example.com',
'secure_access': 'https://serveralias.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -1013,7 +1039,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqualResultJson(result, 'Path', '/test-path')
......@@ -1022,7 +1048,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'alias1.example.com', parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqualResultJson(result, 'Path', '/test-path')
......@@ -1031,7 +1057,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'alias2.example.com', parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqualResultJson(result, 'Path', '/test-path')
......@@ -1061,7 +1087,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'url': 'http://httpsonly.example.com',
'site_url': 'http://httpsonly.example.com',
'secure_access': 'https://httpsonly.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -1069,7 +1095,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqualResultJson(result, 'Path', '/test-path')
......@@ -1094,7 +1120,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'url': 'http://customdomain.example.com',
'site_url': 'http://customdomain.example.com',
'secure_access': 'https://customdomain.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -1102,7 +1128,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqualResultJson(result, 'Path', '/test-path')
......@@ -1119,7 +1145,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'url': 'http://customdomainsslcrtsslkey.example.com',
'site_url': 'http://customdomainsslcrtsslkey.example.com',
'secure_access': 'https://customdomainsslcrtsslkey.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -1127,7 +1153,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('customdomainsslcrtsslkey.example.com.crt').read())
self.assertEqualResultJson(result, 'Path', '/test-path')
......@@ -1144,7 +1170,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'url': 'http://typezope.example.com',
'site_url': 'http://typezope.example.com',
'secure_access': 'https://typezope.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -1152,7 +1178,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
try:
......@@ -1192,7 +1218,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'site_url': 'http://typezopevirtualhostroothttpport.example.com',
'secure_access':
'https://typezopevirtualhostroothttpport.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -1220,7 +1246,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'site_url': 'http://typezopevirtualhostroothttpsport.example.com',
'secure_access':
'https://typezopevirtualhostroothttpsport.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -1228,7 +1254,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqualResultJson(
......@@ -1250,7 +1276,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'url': 'http://typenotebook.nginx.example.com',
'site_url': 'http://typenotebook.nginx.example.com',
'secure_access': 'https://typenotebook.nginx.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -1259,7 +1285,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
NGINX_HTTPS_PORT)
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqualResultJson(result, 'Path', '/test-path')
......@@ -1292,7 +1318,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'url': 'http://typeeventsource.nginx.example.com',
'site_url': 'http://typeeventsource.nginx.example.com',
'secure_access': 'https://typeeventsource.nginx.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -1301,7 +1327,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
NGINX_HTTPS_PORT)
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqual(
......@@ -1334,7 +1360,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'url': 'http://typeredirect.example.com',
'site_url': 'http://typeredirect.example.com',
'secure_access': 'https://typeredirect.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -1342,7 +1368,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqual(
......@@ -1364,7 +1390,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'url': 'http://sslproxyverifysslproxycacrt.example.com',
'site_url': 'http://sslproxyverifysslproxycacrt.example.com',
'secure_access': 'https://sslproxyverifysslproxycacrt.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -1372,7 +1398,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
if IS_CADDY:
......@@ -1441,7 +1467,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'url': 'http://sslproxyverifyunverified.example.com',
'site_url': 'http://sslproxyverifyunverified.example.com',
'secure_access': 'https://sslproxyverifyunverified.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -1449,7 +1475,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqual(
......@@ -1473,7 +1499,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'http://enablecachesslproxyverifysslproxycacrt.example.com',
'secure_access':
'https://enablecachesslproxyverifysslproxycacrt.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -1481,7 +1507,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
if IS_CADDY:
......@@ -1558,7 +1584,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'site_url': 'http://enablecachesslproxyverifyunverified.example.com',
'secure_access':
'https://enablecachesslproxyverifyunverified.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -1566,7 +1592,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqual(
......@@ -1589,7 +1615,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'site_url': 'http://typezopesslproxyverifysslproxycacrt.example.com',
'secure_access':
'https://typezopesslproxyverifysslproxycacrt.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -1597,7 +1623,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
if IS_CADDY:
......@@ -1652,7 +1678,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'site_url': 'http://typezopesslproxyverifyunverified.example.com',
'secure_access':
'https://typezopesslproxyverifyunverified.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -1660,7 +1686,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqual(
......@@ -1680,7 +1706,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'url': 'http://monitoripv6test.example.com',
'site_url': 'http://monitoripv6test.example.com',
'secure_access': 'https://monitoripv6test.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -1688,7 +1714,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqual(result.status_code, no_backend_response_code)
......@@ -1723,7 +1749,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'url': 'http://monitoripv4test.example.com',
'site_url': 'http://monitoripv4test.example.com',
'secure_access': 'https://monitoripv4test.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -1731,7 +1757,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqual(result.status_code, no_backend_response_code)
......@@ -1766,7 +1792,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'url': 'http://re6stoptimaltest.example.com',
'site_url': 'http://re6stoptimaltest.example.com',
'secure_access': 'https://re6stoptimaltest.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -1774,7 +1800,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqual(result.status_code, no_backend_response_code)
......@@ -1810,7 +1836,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'url': 'http://enablecache.example.com',
'site_url': 'http://enablecache.example.com',
'secure_access': 'https://enablecache.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -1818,7 +1844,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqualResultJson(result, 'Path', '/test-path')
......@@ -1902,7 +1928,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'site_url': 'http://enablecachedisablenocacherequest.example.com',
'secure_access':
'https://enablecachedisablenocacherequest.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -1911,7 +1937,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
headers={'Pragma': 'no-cache', 'Cache-Control': 'something'})
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqualResultJson(result, 'Path', '/test-path')
......@@ -1955,7 +1981,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'site_url': 'http://enablecachedisableviaheader.example.com',
'secure_access':
'https://enablecachedisableviaheader.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -1963,7 +1989,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqualResultJson(result, 'Path', '/test-path')
......@@ -2000,7 +2026,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'site_url': 'http://enablehttp2false.example.com',
'secure_access':
'https://enablehttp2false.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -2008,7 +2034,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqualResultJson(result, 'Path', '/test-path')
......@@ -2050,7 +2076,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'site_url': 'http://enablehttp2default.example.com',
'secure_access':
'https://enablehttp2default.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -2058,7 +2084,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqualResultJson(result, 'Path', '/test-path')
......@@ -2101,7 +2127,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'site_url': 'http://prefergzipencodingtobackend.example.com',
'secure_access':
'https://prefergzipencodingtobackend.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -2110,7 +2136,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
headers={'Accept-Encoding': 'gzip, deflate'})
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqualResultJson(result, 'Path', '/test-path')
......@@ -2140,7 +2166,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'url': 'http://disabledcookielist.example.com',
'site_url': 'http://disabledcookielist.example.com',
'secure_access': 'https://disabledcookielist.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -2153,7 +2179,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
))
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqualResultJson(result, 'Path', '/test-path')
......@@ -2185,7 +2211,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict, 'apache_custom_http_s-accepted')
self.assertEqual(
parameter_dict,
{'replication_number': '1', 'public-ipv4': utils.LOCAL_IPV4}
{'replication_number': '1', 'public-ipv4': LOCAL_IPV4}
)
result = self.fakeHTTPSResult(
......@@ -2193,7 +2219,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqualResultJson(result, 'Path', '/test-path')
......@@ -2271,7 +2297,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict, 'caddy_custom_http_s-accepted')
self.assertEqual(
parameter_dict,
{'replication_number': '1', 'public-ipv4': utils.LOCAL_IPV4}
{'replication_number': '1', 'public-ipv4': LOCAL_IPV4}
)
result = self.fakeHTTPSResult(
......@@ -2279,7 +2305,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqualResultJson(result, 'Path', '/test-path')
......@@ -2333,7 +2359,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'url': 'http://urlhttpsurl.example.com',
'site_url': 'http://urlhttpsurl.example.com',
'secure_access': 'https://urlhttpsurl.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -2341,7 +2367,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqualResultJson(result, 'Path', '/https/test-path')
......@@ -2357,7 +2383,7 @@ class TestReplicateSlave(SlaveHttpFrontendTestCase, TestDataMixin):
return {
'domain': 'example.com',
'nginx-domain': 'nginx.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
'apache-certificate': open('wildcard.example.com.crt').read(),
'apache-key': open('wildcard.example.com.key').read(),
'-frontend-quantity': 2,
......@@ -2392,7 +2418,7 @@ class TestReplicateSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'url': 'http://replicate.example.com',
'site_url': 'http://replicate.example.com',
'secure_access': 'https://replicate.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -2400,7 +2426,7 @@ class TestReplicateSlave(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqualResultJson(result, 'Path', '/test-path')
......@@ -2430,7 +2456,7 @@ class TestEnableHttp2ByDefaultFalseSlave(SlaveHttpFrontendTestCase,
return {
'domain': 'example.com',
'nginx-domain': 'nginx.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
'apache-certificate': open('wildcard.example.com.crt').read(),
'apache-key': open('wildcard.example.com.key').read(),
'enable-http2-by-default': 'false',
......@@ -2468,7 +2494,7 @@ class TestEnableHttp2ByDefaultFalseSlave(SlaveHttpFrontendTestCase,
'site_url': 'http://enablehttp2default.example.com',
'secure_access':
'https://enablehttp2default.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -2488,7 +2514,7 @@ class TestEnableHttp2ByDefaultFalseSlave(SlaveHttpFrontendTestCase,
'site_url': 'http://enablehttp2false.example.com',
'secure_access':
'https://enablehttp2false.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -2508,7 +2534,7 @@ class TestEnableHttp2ByDefaultFalseSlave(SlaveHttpFrontendTestCase,
'site_url': 'http://enablehttp2true.example.com',
'secure_access':
'https://enablehttp2true.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -2524,7 +2550,7 @@ class TestEnableHttp2ByDefaultDefaultSlave(SlaveHttpFrontendTestCase,
return {
'domain': 'example.com',
'nginx-domain': 'nginx.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
'apache-certificate': open('wildcard.example.com.crt').read(),
'apache-key': open('wildcard.example.com.key').read(),
'port': HTTPS_PORT,
......@@ -2561,7 +2587,7 @@ class TestEnableHttp2ByDefaultDefaultSlave(SlaveHttpFrontendTestCase,
'site_url': 'http://enablehttp2default.example.com',
'secure_access':
'https://enablehttp2default.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -2581,7 +2607,7 @@ class TestEnableHttp2ByDefaultDefaultSlave(SlaveHttpFrontendTestCase,
'site_url': 'http://enablehttp2false.example.com',
'secure_access':
'https://enablehttp2false.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -2601,7 +2627,7 @@ class TestEnableHttp2ByDefaultDefaultSlave(SlaveHttpFrontendTestCase,
'site_url': 'http://enablehttp2true.example.com',
'secure_access':
'https://enablehttp2true.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -2715,7 +2741,7 @@ class TestMalformedBackenUrlSlave(SlaveHttpFrontendTestCase,
return {
'domain': 'example.com',
'nginx-domain': 'nginx.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
'apache-certificate': open('wildcard.example.com.crt').read(),
'apache-key': open('wildcard.example.com.key').read(),
'port': HTTPS_PORT,
......@@ -2768,7 +2794,7 @@ class TestMalformedBackenUrlSlave(SlaveHttpFrontendTestCase,
'url': 'http://empty.example.com',
'site_url': 'http://empty.example.com',
'secure_access': 'https://empty.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -2776,7 +2802,7 @@ class TestMalformedBackenUrlSlave(SlaveHttpFrontendTestCase,
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqual(result.status_code, no_backend_response_code)
......@@ -2830,9 +2856,9 @@ class TestDefaultMonitorHttpdPort(SlaveHttpFrontendTestCase, TestDataMixin):
'monitor-httpd.conf')).read()
self.assertTrue(
'Listen [%s]:8196' % (utils.GLOBAL_IPV6,) in master_monitor_conf)
'Listen [%s]:8196' % (GLOBAL_IPV6,) in master_monitor_conf)
self.assertTrue(
'Listen [%s]:8072' % (utils.GLOBAL_IPV6,) in slave_monitor_conf)
'Listen [%s]:8072' % (GLOBAL_IPV6,) in slave_monitor_conf)
class TestQuicEnabled(SlaveHttpFrontendTestCase, TestDataMixin):
......@@ -2841,7 +2867,7 @@ class TestQuicEnabled(SlaveHttpFrontendTestCase, TestDataMixin):
return {
'domain': 'example.com',
'nginx-domain': 'nginx.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
'enable-quic': 'true',
'apache-certificate': open('wildcard.example.com.crt').read(),
'apache-key': open('wildcard.example.com.key').read(),
......@@ -2889,7 +2915,7 @@ class TestQuicEnabled(SlaveHttpFrontendTestCase, TestDataMixin):
'url': 'http://url.example.com',
'site_url': 'http://url.example.com',
'secure_access': 'https://url.example.com',
'public-ipv4': utils.LOCAL_IPV4,
'public-ipv4': LOCAL_IPV4,
}
)
......@@ -2897,7 +2923,7 @@ class TestQuicEnabled(SlaveHttpFrontendTestCase, TestDataMixin):
parameter_dict['domain'], parameter_dict['public-ipv4'], 'test-path')
self.assertEqual(
utils.der2pem(result.peercert),
der2pem(result.peercert),
open('wildcard.example.com.crt').read())
self.assertEqualResultJson(result, 'Path', '/test-path')
......
  • @luke ignore the comments inline there's a MR with more fixes. this was not enough.

Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment