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
Matevz Golob
slapos
Commits
101f2024
Commit
101f2024
authored
Jun 20, 2019
by
Łukasz Nowak
Committed by
Matevz Golob
Jul 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
caddy-frontend/test: Cover aspects of enable_cache
parent
2e5ced0f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
180 additions
and
4 deletions
+180
-4
software/caddy-frontend/test/test.py
software/caddy-frontend/test/test.py
+164
-4
software/caddy-frontend/test/test_data/test.TestSlave.test_file_list_log-CADDY.txt
...est/test_data/test.TestSlave.test_file_list_log-CADDY.txt
+8
-0
software/caddy-frontend/test/test_data/test.TestSlaveGlobalDisableHttp2.test_file_list_log-CADDY.txt
....TestSlaveGlobalDisableHttp2.test_file_list_log-CADDY.txt
+8
-0
No files found.
software/caddy-frontend/test/test.py
View file @
101f2024
...
@@ -1080,7 +1080,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
...
@@ -1080,7 +1080,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
},
},
'
custom_domain
': {
'
custom_domain
': {
'
url
': cls.backend_url,
'
url
': cls.backend_url,
'
custom_domain
': '
customdomain
.
example
.
com
',
'
custom_domain
': '
my
customdomain
.
example
.
com
',
},
},
'
custom_domain_wildcard
': {
'
custom_domain_wildcard
': {
'
url
': cls.backend_url,
'
url
': cls.backend_url,
...
@@ -1185,6 +1185,16 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
...
@@ -1185,6 +1185,16 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
'
url
': cls.backend_url,
'
url
': cls.backend_url,
'
enable_cache
': True,
'
enable_cache
': True,
},
},
'
enable_cache_custom_domain
': {
'
url
': cls.backend_url,
'
enable_cache
': True,
'
custom_domain
': '
customdomainenablecache
.
example
.
com
',
},
'
enable_cache_server_alias
': {
'
url
': cls.backend_url,
'
enable_cache
': True,
'
server
-
alias
': '
enablecacheserveralias1
.
example
.
com
',
},
'
enable_cache
-
disable
-
no
-
cache
-
request
': {
'
enable_cache
-
disable
-
no
-
cache
-
request
': {
'
url
': cls.backend_url,
'
url
': cls.backend_url,
'
enable_cache
': True,
'
enable_cache
': True,
...
@@ -1343,9 +1353,9 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
...
@@ -1343,9 +1353,9 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
expected_parameter_dict
=
{
expected_parameter_dict
=
{
'monitor-base-url'
:
None
,
'monitor-base-url'
:
None
,
'domain'
:
'example.com'
,
'domain'
:
'example.com'
,
'accepted-slave-amount'
:
'
48
'
,
'accepted-slave-amount'
:
'
50
'
,
'rejected-slave-amount'
:
'5'
,
'rejected-slave-amount'
:
'5'
,
'slave-amount'
:
'5
3
'
,
'slave-amount'
:
'5
5
'
,
'rejected-slave-dict'
:
{
'rejected-slave-dict'
:
{
"_apache_custom_http_s-rejected"
:
[
"slave not authorized"
],
"_apache_custom_http_s-rejected"
:
[
"slave not authorized"
],
"_caddy_custom_http_s"
:
[
"slave not authorized"
],
"_caddy_custom_http_s"
:
[
"slave not authorized"
],
...
@@ -1932,7 +1942,22 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
...
@@ -1932,7 +1942,22 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
)
)
def test_custom_domain(self):
def test_custom_domain(self):
parameter_dict = self.assertSlaveBase('
custom_domain
')
reference = '
custom_domain
'
hostname = '
mycustomdomain
'
parameter_dict = self.parseSlaveParameterDict(reference)
self.assertLogAccessUrlWithPop(parameter_dict)
self.assertKedifaKeysWithPop(parameter_dict, '')
self.assertEqual(
{
'
domain
': '
%
s
.
example
.
com
' % (hostname,),
'
replication_number
': '
1
',
'
url
': '
http
:
//%
s
.
example
.
com
' % (hostname, ),
'
site_url
': '
http
:
//%
s
.
example
.
com
' % (hostname, ),
'
secure_access
': '
https
:
//%
s
.
example
.
com
' % (hostname, ),
'
public
-
ipv4
': SLAPOS_TEST_IPV4,
},
parameter_dict
)
result = self.fakeHTTPSResult(
result = self.fakeHTTPSResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'], '
test
-
path
')
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'], '
test
-
path
')
...
@@ -2884,6 +2909,141 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
...
@@ -2884,6 +2909,141 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
}
}
)
)
def test_enable_cache_custom_domain(self):
reference = '
enable_cache_custom_domain
'
hostname = '
customdomainenablecache
'
parameter_dict = self.parseSlaveParameterDict(reference)
self.assertLogAccessUrlWithPop(parameter_dict)
self.assertKedifaKeysWithPop(parameter_dict, '')
self.assertEqual(
{
'
domain
': '
%
s
.
example
.
com
' % (hostname,),
'
replication_number
': '
1
',
'
url
': '
http
:
//%
s
.
example
.
com
' % (hostname, ),
'
site_url
': '
http
:
//%
s
.
example
.
com
' % (hostname, ),
'
secure_access
': '
https
:
//%
s
.
example
.
com
' % (hostname, ),
'
public
-
ipv4
': SLAPOS_TEST_IPV4,
},
parameter_dict
)
result = self.fakeHTTPResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
'
test
-
path
/
deep
/
..
/
.
/
deeper
', headers={
'
X
-
Reply
-
Header
-
Cache
-
Control
': '
max
-
age
=
1
,
stale
-
while
-
'
'
revalidate
=
3600
,
stale
-
if
-
error
=
3600
'})
self.assertEqualResultJson(result, '
Path
', '
/
test
-
path
/
deeper
')
headers = result.headers.copy()
self.assertKeyWithPop('
Server
', headers)
self.assertKeyWithPop('
Date
', headers)
self.assertKeyWithPop('
Age
', headers)
# drop keys appearing randomly in headers
headers.pop('
Transfer
-
Encoding
', None)
headers.pop('
Content
-
Length
', None)
headers.pop('
Connection
', None)
headers.pop('
Keep
-
Alive
', None)
self.assertEqual(
{
'
Content
-
type
': '
application
/
json
',
'
Set
-
Cookie
': '
secured
=
value
;
secure
,
nonsecured
=
value
',
'
Cache
-
Control
': '
max
-
age
=
1
,
stale
-
while
-
revalidate
=
3600
,
'
'
stale
-
if
-
error
=
3600
'
},
headers
)
backend_headers = result.json()['
Incoming
Headers
']
via = backend_headers.pop('
via
', None)
self.assertNotEqual(via, None)
self.assertRegexpMatches(
via,
r'
^
http
\
/
1.1
caddy
-
frontend
-
1
\
[.
*
\
]
\
(
ApacheTrafficServer
\
/
7.1
.
6
\
)
$
'
)
def test_enable_cache_server_alias(self):
parameter_dict = self.assertSlaveBase('
enable_cache_server_alias
')
result = self.fakeHTTPResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
'
test
-
path
/
deep
/
..
/
.
/
deeper
', headers={
'
X
-
Reply
-
Header
-
Cache
-
Control
': '
max
-
age
=
1
,
stale
-
while
-
'
'
revalidate
=
3600
,
stale
-
if
-
error
=
3600
'})
self.assertEqualResultJson(result, '
Path
', '
/
test
-
path
/
deeper
')
headers = result.headers.copy()
self.assertKeyWithPop('
Server
', headers)
self.assertKeyWithPop('
Date
', headers)
self.assertKeyWithPop('
Age
', headers)
# drop keys appearing randomly in headers
headers.pop('
Transfer
-
Encoding
', None)
headers.pop('
Content
-
Length
', None)
headers.pop('
Connection
', None)
headers.pop('
Keep
-
Alive
', None)
self.assertEqual(
{
'
Content
-
type
': '
application
/
json
',
'
Set
-
Cookie
': '
secured
=
value
;
secure
,
nonsecured
=
value
',
'
Cache
-
Control
': '
max
-
age
=
1
,
stale
-
while
-
revalidate
=
3600
,
'
'
stale
-
if
-
error
=
3600
'
},
headers
)
backend_headers = result.json()['
Incoming
Headers
']
via = backend_headers.pop('
via
', None)
self.assertNotEqual(via, None)
self.assertRegexpMatches(
via,
r'
^
http
\
/
1.1
caddy
-
frontend
-
1
\
[.
*
\
]
\
(
ApacheTrafficServer
\
/
7.1
.
6
\
)
$
'
)
result = self.fakeHTTPResult(
'
enablecacheserveralias1
.
example
.
com
', parameter_dict['
public
-
ipv4
'],
'
test
-
path
/
deep
/
..
/
.
/
deeper
', headers={
'
X
-
Reply
-
Header
-
Cache
-
Control
': '
max
-
age
=
1
,
stale
-
while
-
'
'
revalidate
=
3600
,
stale
-
if
-
error
=
3600
'})
self.assertEqualResultJson(result, '
Path
', '
/
test
-
path
/
deeper
')
headers = result.headers.copy()
self.assertKeyWithPop('
Server
', headers)
self.assertKeyWithPop('
Date
', headers)
self.assertKeyWithPop('
Age
', headers)
# drop keys appearing randomly in headers
headers.pop('
Transfer
-
Encoding
', None)
headers.pop('
Content
-
Length
', None)
headers.pop('
Connection
', None)
headers.pop('
Keep
-
Alive
', None)
self.assertEqual(
{
'
Content
-
type
': '
application
/
json
',
'
Set
-
Cookie
': '
secured
=
value
;
secure
,
nonsecured
=
value
',
'
Cache
-
Control
': '
max
-
age
=
1
,
stale
-
while
-
revalidate
=
3600
,
'
'
stale
-
if
-
error
=
3600
'
},
headers
)
backend_headers = result.json()['
Incoming
Headers
']
via = backend_headers.pop('
via
', None)
self.assertNotEqual(via, None)
self.assertRegexpMatches(
via,
r'
^
http
\
/
1.1
caddy
-
frontend
-
1
\
[.
*
\
]
\
(
ApacheTrafficServer
\
/
7.1
.
6
\
)
$
'
)
def test_enable_cache(self):
def test_enable_cache(self):
parameter_dict = self.assertSlaveBase('
enable_cache
')
parameter_dict = self.assertSlaveBase('
enable_cache
')
...
...
software/caddy-frontend/test/test_data/test.TestSlave.test_file_list_log-CADDY.txt
View file @
101f2024
...
@@ -14,7 +14,11 @@ T-2/var/log/httpd-cache-direct/_enable_cache-ssl-proxy-verify_ssl_proxy_ca_crt-u
...
@@ -14,7 +14,11 @@ T-2/var/log/httpd-cache-direct/_enable_cache-ssl-proxy-verify_ssl_proxy_ca_crt-u
T-2/var/log/httpd-cache-direct/_enable_cache-ssl-proxy-verify_ssl_proxy_ca_crt_access_log
T-2/var/log/httpd-cache-direct/_enable_cache-ssl-proxy-verify_ssl_proxy_ca_crt_access_log
T-2/var/log/httpd-cache-direct/_enable_cache-ssl-proxy-verify_ssl_proxy_ca_crt_error_log
T-2/var/log/httpd-cache-direct/_enable_cache-ssl-proxy-verify_ssl_proxy_ca_crt_error_log
T-2/var/log/httpd-cache-direct/_enable_cache_access_log
T-2/var/log/httpd-cache-direct/_enable_cache_access_log
T-2/var/log/httpd-cache-direct/_enable_cache_custom_domain_access_log
T-2/var/log/httpd-cache-direct/_enable_cache_custom_domain_error_log
T-2/var/log/httpd-cache-direct/_enable_cache_error_log
T-2/var/log/httpd-cache-direct/_enable_cache_error_log
T-2/var/log/httpd-cache-direct/_enable_cache_server_alias_access_log
T-2/var/log/httpd-cache-direct/_enable_cache_server_alias_error_log
T-2/var/log/httpd-csr_id/expose-csr_id.log
T-2/var/log/httpd-csr_id/expose-csr_id.log
T-2/var/log/httpd/_Url_access_log
T-2/var/log/httpd/_Url_access_log
T-2/var/log/httpd/_Url_error_log
T-2/var/log/httpd/_Url_error_log
...
@@ -49,7 +53,11 @@ T-2/var/log/httpd/_enable_cache-ssl-proxy-verify_ssl_proxy_ca_crt-unverified_err
...
@@ -49,7 +53,11 @@ T-2/var/log/httpd/_enable_cache-ssl-proxy-verify_ssl_proxy_ca_crt-unverified_err
T-2/var/log/httpd/_enable_cache-ssl-proxy-verify_ssl_proxy_ca_crt_access_log
T-2/var/log/httpd/_enable_cache-ssl-proxy-verify_ssl_proxy_ca_crt_access_log
T-2/var/log/httpd/_enable_cache-ssl-proxy-verify_ssl_proxy_ca_crt_error_log
T-2/var/log/httpd/_enable_cache-ssl-proxy-verify_ssl_proxy_ca_crt_error_log
T-2/var/log/httpd/_enable_cache_access_log
T-2/var/log/httpd/_enable_cache_access_log
T-2/var/log/httpd/_enable_cache_custom_domain_access_log
T-2/var/log/httpd/_enable_cache_custom_domain_error_log
T-2/var/log/httpd/_enable_cache_error_log
T-2/var/log/httpd/_enable_cache_error_log
T-2/var/log/httpd/_enable_cache_server_alias_access_log
T-2/var/log/httpd/_enable_cache_server_alias_error_log
T-2/var/log/httpd/_https-only_access_log
T-2/var/log/httpd/_https-only_access_log
T-2/var/log/httpd/_https-only_error_log
T-2/var/log/httpd/_https-only_error_log
T-2/var/log/httpd/_monitor-ipv4-test_access_log
T-2/var/log/httpd/_monitor-ipv4-test_access_log
...
...
software/caddy-frontend/test/test_data/test.TestSlaveGlobalDisableHttp2.test_file_list_log-CADDY.txt
View file @
101f2024
...
@@ -14,7 +14,11 @@ T-2/var/log/httpd-cache-direct/_enable_cache-ssl-proxy-verify_ssl_proxy_ca_crt-u
...
@@ -14,7 +14,11 @@ T-2/var/log/httpd-cache-direct/_enable_cache-ssl-proxy-verify_ssl_proxy_ca_crt-u
T-2/var/log/httpd-cache-direct/_enable_cache-ssl-proxy-verify_ssl_proxy_ca_crt_access_log
T-2/var/log/httpd-cache-direct/_enable_cache-ssl-proxy-verify_ssl_proxy_ca_crt_access_log
T-2/var/log/httpd-cache-direct/_enable_cache-ssl-proxy-verify_ssl_proxy_ca_crt_error_log
T-2/var/log/httpd-cache-direct/_enable_cache-ssl-proxy-verify_ssl_proxy_ca_crt_error_log
T-2/var/log/httpd-cache-direct/_enable_cache_access_log
T-2/var/log/httpd-cache-direct/_enable_cache_access_log
T-2/var/log/httpd-cache-direct/_enable_cache_custom_domain_access_log
T-2/var/log/httpd-cache-direct/_enable_cache_custom_domain_error_log
T-2/var/log/httpd-cache-direct/_enable_cache_error_log
T-2/var/log/httpd-cache-direct/_enable_cache_error_log
T-2/var/log/httpd-cache-direct/_enable_cache_server_alias_access_log
T-2/var/log/httpd-cache-direct/_enable_cache_server_alias_error_log
T-2/var/log/httpd-csr_id/expose-csr_id.log
T-2/var/log/httpd-csr_id/expose-csr_id.log
T-2/var/log/httpd/_Url_access_log
T-2/var/log/httpd/_Url_access_log
T-2/var/log/httpd/_Url_error_log
T-2/var/log/httpd/_Url_error_log
...
@@ -49,7 +53,11 @@ T-2/var/log/httpd/_enable_cache-ssl-proxy-verify_ssl_proxy_ca_crt-unverified_err
...
@@ -49,7 +53,11 @@ T-2/var/log/httpd/_enable_cache-ssl-proxy-verify_ssl_proxy_ca_crt-unverified_err
T-2/var/log/httpd/_enable_cache-ssl-proxy-verify_ssl_proxy_ca_crt_access_log
T-2/var/log/httpd/_enable_cache-ssl-proxy-verify_ssl_proxy_ca_crt_access_log
T-2/var/log/httpd/_enable_cache-ssl-proxy-verify_ssl_proxy_ca_crt_error_log
T-2/var/log/httpd/_enable_cache-ssl-proxy-verify_ssl_proxy_ca_crt_error_log
T-2/var/log/httpd/_enable_cache_access_log
T-2/var/log/httpd/_enable_cache_access_log
T-2/var/log/httpd/_enable_cache_custom_domain_access_log
T-2/var/log/httpd/_enable_cache_custom_domain_error_log
T-2/var/log/httpd/_enable_cache_error_log
T-2/var/log/httpd/_enable_cache_error_log
T-2/var/log/httpd/_enable_cache_server_alias_access_log
T-2/var/log/httpd/_enable_cache_server_alias_error_log
T-2/var/log/httpd/_https-only_access_log
T-2/var/log/httpd/_https-only_access_log
T-2/var/log/httpd/_https-only_error_log
T-2/var/log/httpd/_https-only_error_log
T-2/var/log/httpd/_monitor-ipv4-test_access_log
T-2/var/log/httpd/_monitor-ipv4-test_access_log
...
...
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