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
HongzheWang
slapos
Commits
2fdbb0df
Commit
2fdbb0df
authored
Apr 22, 2020
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Plain Diff
software/caddy-frontend/test: repair test
"bin/pythonwitheggs" no longer exist See merge request !738
parents
e7d5f2ad
c7ae7e84
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
software/caddy-frontend/test/test.py
software/caddy-frontend/test/test.py
+16
-3
No files found.
software/caddy-frontend/test/test.py
View file @
2fdbb0df
...
@@ -237,9 +237,22 @@ def getQUIC(url, ip, port):
...
@@ -237,9 +237,22 @@ def getQUIC(url, ip, port):
def
getPluginParameterDict
(
software_path
,
filepath
):
def
getPluginParameterDict
(
software_path
,
filepath
):
"""Load the slapos monitor plugin and returns the configuration used by this plugin.
This allow to check that monitoring plugin are using a proper config.
"""
# This is implemented by creating a wrapper script that loads the plugin wrapper
# script and returns its `extra_config_dict`. This might have to be adjusted if
# internals of slapos promise plugins change.
bin_file
=
os
.
path
.
join
(
software_path
,
'bin'
,
'test-plugin-promise'
)
bin_file
=
os
.
path
.
join
(
software_path
,
'bin'
,
'test-plugin-promise'
)
monitor_python_with_eggs
=
os
.
path
.
join
(
software_path
,
'bin'
,
'monitor-pythonwitheggs'
)
if
not
os
.
path
.
exists
(
monitor_python_with_eggs
):
raise
ValueError
(
"Monitoring stack's python does not exist at %s"
%
monitor_python_with_eggs
)
with
open
(
bin_file
,
'w'
)
as
f
:
with
open
(
bin_file
,
'w'
)
as
f
:
f
.
write
(
"""#!%s
/bin/pythonwitheggs
f
.
write
(
"""#!%s
import os
import os
import importlib
import importlib
import sys
import sys
...
@@ -251,9 +264,9 @@ filename = os.path.basename(filepath)
...
@@ -251,9 +264,9 @@ filename = os.path.basename(filepath)
module = importlib.import_module(os.path.splitext(filename)[0])
module = importlib.import_module(os.path.splitext(filename)[0])
print json.dumps(module.extra_config_dict)
print json.dumps(module.extra_config_dict)
"""
%
software_path
)
"""
%
monitor_python_with_eggs
)
os
.
chmod
(
bin_file
,
0755
)
os
.
chmod
(
bin_file
,
0
o
755
)
result
=
subprocess_output
([
bin_file
,
filepath
]).
strip
()
result
=
subprocess_output
([
bin_file
,
filepath
]).
strip
()
try
:
try
:
return
json
.
loads
(
result
)
return
json
.
loads
(
result
)
...
...
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