Commit 3c4bbcdf authored by Julien Muchembled's avatar Julien Muchembled

monitor/test: clean up

parent 985f6159
Pipeline #7255 failed with stage
in 0 seconds
...@@ -29,6 +29,7 @@ import json ...@@ -29,6 +29,7 @@ import json
import os import os
import re import re
import requests import requests
import subprocess
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
from slapos.recipe.librecipe import generateHashFromFiles from slapos.recipe.librecipe import generateHashFromFiles
from slapos.testing.testcase import makeModuleSetUpAndTestCaseClass from slapos.testing.testcase import makeModuleSetUpAndTestCaseClass
...@@ -225,17 +226,13 @@ class EdgeSlaveMixin(MonitorTestMixin): ...@@ -225,17 +226,13 @@ class EdgeSlaveMixin(MonitorTestMixin):
def assertSurykatkaStatusJSON(self): def assertSurykatkaStatusJSON(self):
if os.path.exists(self.surykatka_json): if os.path.exists(self.surykatka_json):
os.unlink(self.surykatka_json) os.unlink(self.surykatka_json)
original_environ = os.environ.copy() env = os.environ.copy()
os.environ.pop('PYTHONPATH', None) env.pop('PYTHONPATH', None)
try: subprocess.check_call(self.surykatka_status_json, shell=True, env=env)
self.assertEqual(0, os.system(self.surykatka_status_json))
finally:
os.environ = original_environ
self.assertTrue(os.path.exists(self.surykatka_json)) self.assertTrue(os.path.exists(self.surykatka_json))
with open(self.surykatka_json) as fh: with open(self.surykatka_json) as fh:
status_json = json.load(fh) status_json = json.load(fh)
self.assertTrue('bot_status' in status_json) self.assertIn('bot_status', status_json)
def test(self): def test(self):
# Note: Those tests do not run surykatka and do not do real checks, as # Note: Those tests do not run surykatka and do not do real checks, as
......
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