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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitry Blinov
slapos
Commits
b9f413ab
Commit
b9f413ab
authored
Sep 13, 2018
by
Łukasz Nowak
Committed by
Łukasz Nowak
Sep 14, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
caddy-frontend: Simplify assertion and use numeric value
parent
cd9a6327
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
17 deletions
+15
-17
software/caddy-frontend/test/test.py
software/caddy-frontend/test/test.py
+15
-17
No files found.
software/caddy-frontend/test/test.py
View file @
b9f413ab
...
@@ -63,8 +63,6 @@ MONITOR_F1_HTTPD_PORT = '13001'
...
@@ -63,8 +63,6 @@ MONITOR_F1_HTTPD_PORT = '13001'
MONITOR_F2_HTTPD_PORT
=
'13002'
MONITOR_F2_HTTPD_PORT
=
'13002'
no_backend_response_code
=
404
caddy_custom_https
=
'''# caddy_custom_https_filled_in_accepted
caddy_custom_https
=
'''# caddy_custom_https_filled_in_accepted
https://caddycustomhttpsaccepted.example.com:%%(https_port)s {
https://caddycustomhttpsaccepted.example.com:%%(https_port)s {
bind %%(local_ipv4)s
bind %%(local_ipv4)s
...
@@ -812,7 +810,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
...
@@ -812,7 +810,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
der2pem
(
result
.
peercert
),
der2pem
(
result
.
peercert
),
open
(
'wildcard.example.com.crt'
).
read
())
open
(
'wildcard.example.com.crt'
).
read
())
self
.
assertEqual
(
result
.
status_code
,
no_backend_response_code
)
self
.
assertEqual
(
result
.
status_code
,
404
)
# check that log file contains verbose log
# check that log file contains verbose log
log_file
=
glob
.
glob
(
log_file
=
glob
.
glob
(
...
@@ -825,7 +823,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
...
@@ -825,7 +823,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
LOG_REGEXP
)
LOG_REGEXP
)
result_http
=
self
.
fakeHTTPResult
(
result_http
=
self
.
fakeHTTPResult
(
parameter_dict
[
'domain'
],
parameter_dict
[
'public-ipv4'
],
'test-path'
)
parameter_dict
[
'domain'
],
parameter_dict
[
'public-ipv4'
],
'test-path'
)
self
.
assertEqual
(
result_http
.
status_code
,
no_backend_response_code
)
self
.
assertEqual
(
result_http
.
status_code
,
404
)
# check that 404 is as configured
# check that 404 is as configured
result_missing
=
self
.
fakeHTTPSResult
(
result_missing
=
self
.
fakeHTTPSResult
(
...
@@ -1586,11 +1584,11 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
...
@@ -1586,11 +1584,11 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
der2pem
(
result
.
peercert
),
der2pem
(
result
.
peercert
),
open
(
'wildcard.example.com.crt'
).
read
())
open
(
'wildcard.example.com.crt'
).
read
())
self
.
assertEqual
(
result
.
status_code
,
no_backend_response_code
)
self
.
assertEqual
(
result
.
status_code
,
404
)
result_http
=
self
.
fakeHTTPResult
(
result_http
=
self
.
fakeHTTPResult
(
parameter_dict
[
'domain'
],
parameter_dict
[
'public-ipv4'
],
'test-path'
)
parameter_dict
[
'domain'
],
parameter_dict
[
'public-ipv4'
],
'test-path'
)
self
.
assertEqual
(
result_http
.
status_code
,
no_backend_response_code
)
self
.
assertEqual
(
result_http
.
status_code
,
404
)
# rewrite SR/bin/is-icmp-packet-lost
# rewrite SR/bin/is-icmp-packet-lost
open
(
open
(
...
@@ -1629,11 +1627,11 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
...
@@ -1629,11 +1627,11 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
der2pem
(
result
.
peercert
),
der2pem
(
result
.
peercert
),
open
(
'wildcard.example.com.crt'
).
read
())
open
(
'wildcard.example.com.crt'
).
read
())
self
.
assertEqual
(
result
.
status_code
,
no_backend_response_code
)
self
.
assertEqual
(
result
.
status_code
,
404
)
result_http
=
self
.
fakeHTTPResult
(
result_http
=
self
.
fakeHTTPResult
(
parameter_dict
[
'domain'
],
parameter_dict
[
'public-ipv4'
],
'test-path'
)
parameter_dict
[
'domain'
],
parameter_dict
[
'public-ipv4'
],
'test-path'
)
self
.
assertEqual
(
result_http
.
status_code
,
no_backend_response_code
)
self
.
assertEqual
(
result_http
.
status_code
,
404
)
# rewrite SR/bin/is-icmp-packet-lost
# rewrite SR/bin/is-icmp-packet-lost
open
(
open
(
...
@@ -1672,11 +1670,11 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
...
@@ -1672,11 +1670,11 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
der2pem
(
result
.
peercert
),
der2pem
(
result
.
peercert
),
open
(
'wildcard.example.com.crt'
).
read
())
open
(
'wildcard.example.com.crt'
).
read
())
self
.
assertEqual
(
result
.
status_code
,
no_backend_response_code
)
self
.
assertEqual
(
result
.
status_code
,
404
)
result_http
=
self
.
fakeHTTPResult
(
result_http
=
self
.
fakeHTTPResult
(
parameter_dict
[
'domain'
],
parameter_dict
[
'public-ipv4'
],
'test-path'
)
parameter_dict
[
'domain'
],
parameter_dict
[
'public-ipv4'
],
'test-path'
)
self
.
assertEqual
(
result_http
.
status_code
,
no_backend_response_code
)
self
.
assertEqual
(
result_http
.
status_code
,
404
)
# rewrite SR/bin/is-icmp-packet-lost
# rewrite SR/bin/is-icmp-packet-lost
open
(
open
(
...
@@ -2661,7 +2659,7 @@ class TestMalformedBackenUrlSlave(SlaveHttpFrontendTestCase,
...
@@ -2661,7 +2659,7 @@ class TestMalformedBackenUrlSlave(SlaveHttpFrontendTestCase,
der2pem
(
result
.
peercert
),
der2pem
(
result
.
peercert
),
open
(
'wildcard.example.com.crt'
).
read
())
open
(
'wildcard.example.com.crt'
).
read
())
self
.
assertEqual
(
result
.
status_code
,
no_backend_response_code
)
self
.
assertEqual
(
result
.
status_code
,
404
)
def
test_url
(
self
):
def
test_url
(
self
):
parameter_dict
=
self
.
slave_connection_parameter_dict_dict
[
parameter_dict
=
self
.
slave_connection_parameter_dict_dict
[
...
@@ -2967,7 +2965,7 @@ https://www.google.com {}""",
...
@@ -2967,7 +2965,7 @@ https://www.google.com {}""",
der2pem
(
result
.
peercert
),
der2pem
(
result
.
peercert
),
open
(
'wildcard.example.com.crt'
).
read
())
open
(
'wildcard.example.com.crt'
).
read
())
self
.
assertEqual
(
result
.
status_code
,
no_backend_response_code
)
self
.
assertEqual
(
result
.
status_code
,
404
)
# rewrite SR/bin/is-icmp-packet-lost
# rewrite SR/bin/is-icmp-packet-lost
open
(
open
(
...
@@ -3012,7 +3010,7 @@ https://www.google.com {}""",
...
@@ -3012,7 +3010,7 @@ https://www.google.com {}""",
der2pem
(
result
.
peercert
),
der2pem
(
result
.
peercert
),
open
(
'wildcard.example.com.crt'
).
read
())
open
(
'wildcard.example.com.crt'
).
read
())
self
.
assertEqual
(
result
.
status_code
,
no_backend_response_code
)
self
.
assertEqual
(
result
.
status_code
,
404
)
# assert that there is no nocomma file
# assert that there is no nocomma file
monitor_file_list
=
glob
.
glob
(
monitor_file_list
=
glob
.
glob
(
...
@@ -3152,11 +3150,11 @@ https://www.google.com {}""",
...
@@ -3152,11 +3150,11 @@ https://www.google.com {}""",
der2pem
(
result
.
peercert
),
der2pem
(
result
.
peercert
),
open
(
'wildcard.example.com.crt'
).
read
())
open
(
'wildcard.example.com.crt'
).
read
())
self
.
assertEqual
(
result
.
status_code
,
no_backend_response_code
)
self
.
assertEqual
(
result
.
status_code
,
404
)
result_http
=
self
.
fakeHTTPResult
(
result_http
=
self
.
fakeHTTPResult
(
parameter_dict
[
'domain'
],
parameter_dict
[
'public-ipv4'
],
'test-path'
)
parameter_dict
[
'domain'
],
parameter_dict
[
'public-ipv4'
],
'test-path'
)
self
.
assertEqual
(
result_http
.
status_code
,
no_backend_response_code
)
self
.
assertEqual
(
result_http
.
status_code
,
404
)
# rewrite SR/bin/is-icmp-packet-lost
# rewrite SR/bin/is-icmp-packet-lost
open
(
open
(
...
@@ -3195,11 +3193,11 @@ https://www.google.com {}""",
...
@@ -3195,11 +3193,11 @@ https://www.google.com {}""",
der2pem
(
result
.
peercert
),
der2pem
(
result
.
peercert
),
open
(
'wildcard.example.com.crt'
).
read
())
open
(
'wildcard.example.com.crt'
).
read
())
self
.
assertEqual
(
result
.
status_code
,
no_backend_response_code
)
self
.
assertEqual
(
result
.
status_code
,
404
)
result_http
=
self
.
fakeHTTPResult
(
result_http
=
self
.
fakeHTTPResult
(
parameter_dict
[
'domain'
],
parameter_dict
[
'public-ipv4'
],
'test-path'
)
parameter_dict
[
'domain'
],
parameter_dict
[
'public-ipv4'
],
'test-path'
)
self
.
assertEqual
(
result_http
.
status_code
,
no_backend_response_code
)
self
.
assertEqual
(
result_http
.
status_code
,
404
)
# rewrite SR/bin/is-icmp-packet-lost
# rewrite SR/bin/is-icmp-packet-lost
open
(
open
(
...
...
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