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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Rafael Monnerat
slapos
Commits
c9e44430
Commit
c9e44430
authored
Jun 30, 2022
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
caddy-frontend/test: Improve assertTestData API
parent
0964a2cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
19 deletions
+16
-19
software/caddy-frontend/test/test.py
software/caddy-frontend/test/test.py
+16
-19
No files found.
software/caddy-frontend/test/test.py
View file @
c9e44430
...
...
@@ -293,9 +293,9 @@ class TestDataMixin(object):
in
self
.
callSupervisorMethod
(
'getAllProcessInfo'
)
if
q
[
'name'
]
!=
'watchdog'
and
q
[
'group'
]
!=
'watchdog'
]))
def
assertTestData
(
self
,
runtime_data
,
hash_value
_dict
=
None
,
msg
=
None
):
if
hash_value
_dict
is
None
:
hash_value
_dict
=
{}
def
assertTestData
(
self
,
runtime_data
,
data_replacement
_dict
=
None
,
msg
=
None
):
if
data_replacement
_dict
is
None
:
data_replacement
_dict
=
{}
filename
=
'%s-%s.txt'
%
(
self
.
id
().
replace
(
'zz_'
,
''
),
'CADDY'
)
test_data_file
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
'test_data'
,
filename
)
...
...
@@ -305,9 +305,8 @@ class TestDataMixin(object):
except
IOError
:
test_data
=
''
for
hash_type
,
hash_value
in
list
(
hash_value_dict
.
items
()):
runtime_data
=
runtime_data
.
replace
(
hash_value
,
'{hash-%s}'
%
(
hash_type
),)
for
replacement
,
value
in
list
(
data_replacement_dict
.
items
()):
runtime_data
=
runtime_data
.
replace
(
value
,
replacement
)
maxDiff
=
self
.
maxDiff
self
.
maxDiff
=
None
...
...
@@ -384,36 +383,34 @@ class TestDataMixin(object):
hash_file_list
=
[
os
.
path
.
join
(
self
.
computer_partition_root_path
,
'software_release/buildout.cfg'
)]
hash_value
_dict
=
{
'
generic'
:
generateHashFromFiles
(
hash_file_list
),
data_replacement
_dict
=
{
'
{hash-generic}'
:
generateHashFromFiles
(
hash_file_list
)
}
for
caddy_wrapper_path
in
glob
.
glob
(
os
.
path
.
join
(
self
.
instance_path
,
'*'
,
'bin'
,
'caddy-wrapper'
)):
partition_id
=
caddy_wrapper_path
.
split
(
'/'
)[
-
3
]
hash_value_dict
[
'caddy-%s'
%
(
partition_id
)]
=
generateHashFromFiles
(
[
caddy_wrapper_path
]
+
hash_file_list
)
data_replacement_dict
[
'{hash-caddy-%s}'
%
(
partition_id
)]
=
\
generateHashFromFiles
([
caddy_wrapper_path
]
+
hash_file_list
)
for
backend_haproxy_wrapper_path
in
glob
.
glob
(
os
.
path
.
join
(
self
.
instance_path
,
'*'
,
'bin'
,
'backend-haproxy-wrapper'
)):
partition_id
=
backend_haproxy_wrapper_path
.
split
(
'/'
)[
-
3
]
hash_value_dict
[
'backend-haproxy-%s'
%
(
partition_id
)]
=
generateHashFromFiles
(
[
backend_haproxy_wrapper_path
]
+
hash_file_list
)
data_replacement_dict
[
'{hash-backend-haproxy-%s}'
%
(
partition_id
)]
=
\
generateHashFromFiles
([
backend_haproxy_wrapper_path
]
+
hash_file_list
)
for
rejected_slave_publish_path
in
glob
.
glob
(
os
.
path
.
join
(
self
.
instance_path
,
'*'
,
'etc'
,
'nginx-rejected-slave.conf'
)):
partition_id
=
rejected_slave_publish_path
.
split
(
'/'
)[
-
3
]
rejected_slave_pem_path
=
os
.
path
.
join
(
self
.
instance_path
,
partition_id
,
'etc'
,
'rejected-slave.pem'
)
hash_value
_dict
[
'
rejected-slave-publish
'
data_replacement
_dict
[
'
{hash-rejected-slave-publish}
'
]
=
generateHashFromFiles
(
[
rejected_slave_publish_path
,
rejected_slave_pem_path
]
+
hash_file_list
)
runtime_data
=
self
.
getTrimmedProcessInfo
()
self
.
assertTestData
(
runtime_data
,
hash_value_dict
=
hash_value_dict
)
self
.
assertTestData
(
runtime_data
,
data_replacement_dict
=
data_replacement_dict
)
def
fakeHTTPSResult
(
domain
,
path
,
port
=
HTTPS_PORT
,
...
...
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