Commit cbe9c822 authored by Kirill Smelkov's avatar Kirill Smelkov

tests/promise/plugin: Adjust Amarisoft-related tests to match...

tests/promise/plugin: Adjust Amarisoft-related tests to match amarisoft_stats.json.log emitted by SR

In nexedi/slapos@b32b4a8e `data` field in
that log switched from emitting objects via py repr to emitting them via
JSON. As the result, in particular, strings are now emitted quoted with
" instead of with ' .

-> Adjust all tests that simulate amarisoft_stats.json.log to follow
actual software-release behaviour.

The tests continue to pass.
parent 453dce5f
......@@ -41,9 +41,9 @@ class TestCheckBasebandLatency(TestPromisePluginMixin):
super(TestCheckBasebandLatency, self).setUp()
self.amarisoft_stats_log = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'amarisoft_stats.json.log')
with open(self.amarisoft_stats_log, 'w+') as f:
f.write("""{"time": "%s", "log_level": "INFO", "message": "Samples stats", "data": {'rf': {'rxtx_delay_min': %f}}}
{"time": "%s", "log_level": "INFO", "message": "Samples stats", "data": {'rf': {'rxtx_delay_min': %f}}}
{"time": "%s", "log_level": "INFO", "message": "Samples stats", "data": {'rf': {'rxtx_delay_min': %f}}}""" % (
f.write("""{"time": "%s", "log_level": "INFO", "message": "Samples stats", "data": {"rf": {"rxtx_delay_min": %f}}}
{"time": "%s", "log_level": "INFO", "message": "Samples stats", "data": {"rf": {"rxtx_delay_min": %f}}}
{"time": "%s", "log_level": "INFO", "message": "Samples stats", "data": {"rf": {"rxtx_delay_min": %f}}}""" % (
(datetime.now() - timedelta(seconds=25)).strftime("%Y-%m-%d %H:%M:%S,%f")[:-3], 7.0,
(datetime.now() - timedelta(seconds=15)).strftime("%Y-%m-%d %H:%M:%S,%f")[:-3], 2.0,
(datetime.now() - timedelta(seconds=5)).strftime("%Y-%m-%d %H:%M:%S,%f")[:-3], 5.0,
......
......@@ -41,9 +41,9 @@ class TestCheckRXSaturated(TestPromisePluginMixin):
super(TestCheckRXSaturated, self).setUp()
self.amarisoft_stats_log = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'amarisoft_stats.json.log')
with open(self.amarisoft_stats_log, 'w+') as f:
f.write("""{"time": "%s", "log_level": "INFO", "message": "Samples stats", "data": {'samples': {'rx': [{'max': %f}, {'max': %f}]}}}
{"time": "%s", "log_level": "INFO", "message": "Samples stats", "data": {'samples': {'rx': [{'max': %f}, {'max': %f}]}}}
{"time": "%s", "log_level": "INFO", "message": "Samples stats", "data": {'samples': {'rx': [{'max': %f}, {'max': %f}]}}}""" % (
f.write("""{"time": "%s", "log_level": "INFO", "message": "Samples stats", "data": {"samples": {"rx": [{"max": %f}, {"max": %f}]}}}
{"time": "%s", "log_level": "INFO", "message": "Samples stats", "data": {"samples": {"rx": [{"max": %f}, {"max": %f}]}}}
{"time": "%s", "log_level": "INFO", "message": "Samples stats", "data": {"samples": {"rx": [{"max": %f}, {"max": %f}]}}}""" % (
(datetime.now() - timedelta(seconds=25)).strftime("%Y-%m-%d %H:%M:%S,%f")[:-3], -5.0, -6.0,
(datetime.now() - timedelta(seconds=15)).strftime("%Y-%m-%d %H:%M:%S,%f")[:-3], -2.0, -3.0,
(datetime.now() - timedelta(seconds=5)).strftime("%Y-%m-%d %H:%M:%S,%f")[:-3], -9.0, -7.0,
......
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