Commit 48726608 authored by Kirill Smelkov's avatar Kirill Smelkov

promise/plugin/check_lopcomm_*: Skip all promises when testing=True

When testing is True we do not have hardware around and only check
generated configuration files. Most lopcomm promises were already
skipping themselves under testing=True environment, but
check_lopcomm_config_log and check_lopcomm_stats_log were missing
testing checks. This leads to test failures when trying to test
ors-amarisoft with Lopcomm driver in my upcoming work via [1] e.g. as

    ================================================================================
    Error with promises for the following partitions:
      TestENB_Lopcomm4-0[enb]: Promise 'RU1-stats-log.py' failed with output: Not subscribed

-> Fix it by making sure `testing==True` checks are present in all
   promises related to lopcomm.

P.S. in current ors-amarisoft Lopcomm driver is not tested at all: even
though we have testFDD-LOPCOMM.py there[2] `python unittest discover ...`
does not pick up test files with dash in their name. This is also
true for all other dashed test files. Currently only testTDD.py and
testFDD.py are run during the tests there.

[1] https://lab.nexedi.com/kirr/slapos/blob/5b8ec2b3/software/ors-amarisoft/test/test.py
[2] https://lab.nexedi.com/nexedi/slapos/tree/15871bbf/software/ors-amarisoft/test

/cc @lu.xu, @tomo, @xavier_thompson, @Daetalus
/reviewed-by @jhuge
/reviewed-on !129
parent a974c1e5
Pipeline #32243 passed with stage
in 0 seconds
...@@ -16,9 +16,14 @@ class RunPromise(JSONPromise): ...@@ -16,9 +16,14 @@ class RunPromise(JSONPromise):
super(RunPromise, self).__init__(config) super(RunPromise, self).__init__(config)
self.setPeriodicity(minute=1) self.setPeriodicity(minute=1)
self.config_log = self.getConfig('config-log') self.config_log = self.getConfig('config-log')
self.testing = self.getConfig('testing') == "True"
def sense(self): def sense(self):
if self.testing:
self.logger.info("skipping promise")
return
latest_log = tail_file(self.config_log) latest_log = tail_file(self.config_log)
latest_log.split("\n") latest_log.split("\n")
......
...@@ -16,9 +16,14 @@ class RunPromise(JSONPromise): ...@@ -16,9 +16,14 @@ class RunPromise(JSONPromise):
super(RunPromise, self).__init__(config) super(RunPromise, self).__init__(config)
self.setPeriodicity(minute=1) self.setPeriodicity(minute=1)
self.stats_log = self.getConfig('stats-log') self.stats_log = self.getConfig('stats-log')
self.testing = self.getConfig('testing') == "True"
def sense(self): def sense(self):
if self.testing:
self.logger.info("skipping promise")
return
latest_log = tail_file(self.stats_log) latest_log = tail_file(self.stats_log)
latest_log.split("\n") latest_log.split("\n")
......
...@@ -48,7 +48,6 @@ class TestCheckLopcommConfigLog(TestPromisePluginMixin): ...@@ -48,7 +48,6 @@ class TestCheckLopcommConfigLog(TestPromisePluginMixin):
) )
self.writePromise(**{ self.writePromise(**{
'config-log': self.config_log, 'config-log': self.config_log,
'testing': 'True',
}) })
self.configureLauncher() self.configureLauncher()
with self.assertRaises(PromiseError): with self.assertRaises(PromiseError):
......
...@@ -54,7 +54,6 @@ class TestCheckLopcommConfigLog(TestPromisePluginMixin): ...@@ -54,7 +54,6 @@ class TestCheckLopcommConfigLog(TestPromisePluginMixin):
) )
self.writePromise(**{ self.writePromise(**{
'stats-log': self.stats_log, 'stats-log': self.stats_log,
'testing': 'True',
}) })
self.configureLauncher() self.configureLauncher()
with self.assertRaises(PromiseError): with self.assertRaises(PromiseError):
......
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