Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
slapos
Commits
e42eb816
Commit
e42eb816
authored
Aug 30, 2018
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
caddy-frontend/test: adjust test after merging utils.py
parent
dc62d8e4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
142 additions
and
98 deletions
+142
-98
software/caddy-frontend/test/test.py
software/caddy-frontend/test/test.py
+142
-98
No files found.
software/caddy-frontend/test/test.py
View file @
e42eb816
...
...
@@ -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
utils
import
SlapOSInstanceTestCase
from
utils
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):
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,9 +287,27 @@ class TestDataMixin(object):
self.assertTestData(runtime_data)
class HttpFrontendTestCase(
utils.
SlapOSInstanceTestCase):
class HttpFrontendTestCase(SlapOSInstanceTestCase):
frontend_type = '
CADDY
' if IS_CADDY else '
APACHE
'
@classmethod
def getSoftwareURLList(cls):
return [os.path.realpath(os.environ['
TEST_SR
'])]
@classmethod
def setUpClass(cls):
super(HttpFrontendTestCase, cls).setUpClass()
# extra class attributes used in HttpFrontendTestCase
# expose instance directory
cls.instance_path = os.path.join(
cls.config['
working_directory
'],
'
inst
')
# expose software directory, extract from found computer partition
cls.software_path = os.path.realpath(os.path.join(
cls.computer_partition_root_path, '
software_release
'))
def assertLogAccessUrlWithPop(self, parameter_dict, reference):
log_access_url = parameter_dict.pop('
log
-
access
-
url
')
try:
...
...
@@ -373,16 +403,30 @@ class TestMasterRequestDomain(HttpFrontendTestCase, TestDataMixin):
)
class TestHandler(BaseHTTPRequestHandler):
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 +570,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 +841,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 +849,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 +898,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 +906,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 +960,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 +991,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 +999,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 +1021,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 +1029,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 +1049,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 +1057,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 +1066,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 +1075,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 +1105,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 +1113,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 +1138,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 +1146,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 +1163,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 +1171,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 +1188,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 +1196,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 +1236,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 +1264,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 +1272,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 +1294,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 +1303,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 +1336,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 +1345,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 +1378,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 +1386,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 +1408,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 +1416,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 +1485,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 +1493,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 +1517,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 +1525,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 +1602,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 +1610,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 +1633,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 +1641,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 +1696,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 +1704,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 +1724,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 +1732,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 +1767,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 +1775,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 +1810,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 +1818,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 +1854,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 +1862,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 +1946,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 +1955,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 +1999,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 +2007,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 +2044,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 +2052,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 +2094,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 +2102,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 +2145,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 +2154,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 +2184,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 +2197,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 +2229,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 +2237,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 +2315,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 +2323,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 +2377,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 +2385,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 +2401,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 +2436,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 +2444,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 +2474,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 +2512,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 +2532,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 +2552,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 +2568,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 +2605,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 +2625,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 +2645,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 +2759,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 +2812,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 +2820,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 +2874,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 +2885,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 +2933,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 +2941,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'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment