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
Labels
Merge Requests
105
Merge Requests
105
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
6eec01b7
Commit
6eec01b7
authored
Oct 23, 2018
by
Guillaume Hervier
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/caddy-frontend: Add test for services auto-restart.
parent
57bdf689
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
software/caddy-frontend/test/test.py
software/caddy-frontend/test/test.py
+52
-0
No files found.
software/caddy-frontend/test/test.py
View file @
6eec01b7
...
...
@@ -3410,3 +3410,55 @@ class TestDuplicateSiteKeyProtection(SlaveHttpFrontendTestCase, TestDataMixin):
'
\
'
duplicate.example.com
\
'
clashes"]'
}
)
class
AutoRestartTestCase
(
SlaveHttpFrontendTestCase
):
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'-frontend-1-state'
:
'stopped'
,
}
@
classmethod
def
getSlaveParameterDictDict
(
cls
):
return
{
'test'
:
{
'url'
:
cls
.
backend_url
,
},
}
@
staticmethod
def
generateHashFromFiles
(
file_list
):
import
hashlib
hasher
=
hashlib
.
md5
()
for
path
in
file_list
:
with
open
(
path
,
'r'
)
as
afile
:
buf
=
afile
.
read
()
hasher
.
update
(
"%s
\
n
"
%
len
(
buf
))
hasher
.
update
(
buf
)
hash
=
hasher
.
hexdigest
()
return
hash
def
test_hashes
(
self
):
hash_files
=
[
'software_release/buildout.cfg'
,
]
expected_process_names
=
[
'frontend_caddy-{hash}-on-watch'
,
'frontend_nginx-{hash}-on-watch'
,
'trafficserver-{hash}-on-watch'
,
'certificate_authority-{hash}-on-watch'
,
'crond-{hash}'
,
]
supervisor
=
self
.
getSupervisorRPCServer
().
supervisor
process_names
=
[
process
[
'name'
]
for
process
in
supervisor
.
getAllProcessInfo
()]
hash_files
=
[
os
.
path
.
join
(
self
.
computer_partition_root_path
,
path
)
for
path
in
hash_files
]
for
name
in
expected_process_names
:
h
=
self
.
generateHashFromFiles
(
hash_files
)
expected_process_name
=
name
.
format
(
hash
=
h
)
self
.
assertIn
(
expected_process_name
,
process_names
)
Łukasz Nowak
@luke
mentioned in commit
a08d7d66
·
Dec 14, 2018
mentioned in commit
a08d7d66
mentioned in commit a08d7d664239e1f703252115bf7556c313ba9884
Toggle commit list
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