Commit 75eafe55 authored by Jérome Perrin's avatar Jérome Perrin

testing: introduce getPromisePluginParameterDict

Helper function to return the configuration used by a promise plugin.
parent e33d0947
Pipeline #11125 failed with stage
in 0 seconds
...@@ -31,6 +31,8 @@ import hashlib ...@@ -31,6 +31,8 @@ import hashlib
import unittest import unittest
import os import os
import subprocess import subprocess
import sys
import json
from contextlib import closing from contextlib import closing
try: try:
...@@ -62,6 +64,26 @@ def getPortFromPath(path): ...@@ -62,6 +64,26 @@ def getPortFromPath(path):
16) % (65535 - 1024) 16) % (65535 - 1024)
def getPromisePluginParameterDict(filepath):
# type: (str) -> dict
"""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.
"""
extra_config_dict_json = subprocess.check_output([
sys.executable,
"-c",
"""
import json, sys
with open(sys.argv[1]) as f:
exec(f.read())
print(json.dumps(extra_config_dict))
""",
filepath,
])
return json.loads(extra_config_dict_json)
class CrontabMixin(object): class CrontabMixin(object):
computer_partition_root_path = None # type: str computer_partition_root_path = None # type: str
def _getCrontabCommand(self, crontab_name): def _getCrontabCommand(self, crontab_name):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment