Sync time on cfg01 node before tempest
- sync time again on all the nodes including cfg01
- check if the services 'maas-rackd' and 'maas-regiond' are
present on the node. if yes - disable the services while
time is synchronized
- execute salt_actions.sync_time() also before the tempest
is started
- remove the class override_ntp_virtual because it disables
the ntp client on cfg01.
Closes-Bug: #PROD-30114
Change-Id: Ibb731ae14f573a3d7471da2cbe9f55754d79c4ff
diff --git a/tcp_tests/managers/saltmanager.py b/tcp_tests/managers/saltmanager.py
index 9b321cb..68fb5e6 100644
--- a/tcp_tests/managers/saltmanager.py
+++ b/tcp_tests/managers/saltmanager.py
@@ -276,16 +276,35 @@
return result['return']
@utils.retry(3, exception=libpepper.PepperException)
- def sync_time(self, tgt='* and not cfg01*'):
+ def sync_time(self, tgt='*'):
LOG.info("NTP time sync on the salt minions '{0}'".format(tgt))
# Force authentication update on the next API access
# because previous authentication most probably is not valid
# before or after time sync.
self.__api = None
if not settings.SKIP_SYNC_TIME:
+ cmd = ('service ntp stop;'
+ 'if systemctl is-active --quiet maas-rackd; then'
+ ' systemctl stop maas-rackd; RACKD=true;'
+ 'else'
+ ' RACKD=false;'
+ 'fi;'
+ 'if systemctl is-active --quiet maas-regiond; then'
+ ' systemctl stop maas-regiond; REGIOND=true;'
+ 'else'
+ ' REGIOND=false;'
+ 'fi;'
+ 'if [ -x /usr/sbin/ntpdate ]; then'
+ ' ntpdate -s ntp.ubuntu.com;'
+ 'else'
+ ' ntpd -gq;'
+ 'fi;'
+ 'service ntp start;'
+ 'if $RACKD; then systemctl start maas-rackd; fi;'
+ 'if $REGIOND; then systemctl start maas-regiond; fi;')
self.run_state(
tgt,
- 'cmd.run', 'service ntp stop; if [ -x /usr/sbin/ntpdate ]; then ntpdate -s ntp.ubuntu.com; else ntpd -gq ; fi; service ntp start') # noqa
+ 'cmd.run', cmd) # noqa
new_time_res = self.run_state(tgt, 'cmd.run', 'date')
for node_name, time in sorted(new_time_res[0]['return'][0].items()):
LOG.info("{0}: {1}".format(node_name, time))
diff --git a/tcp_tests/templates/cookied-cicd-pike-dvr-ceph/environment_context.yaml b/tcp_tests/templates/cookied-cicd-pike-dvr-ceph/environment_context.yaml
index dd08100..8974e6e 100644
--- a/tcp_tests/templates/cookied-cicd-pike-dvr-ceph/environment_context.yaml
+++ b/tcp_tests/templates/cookied-cicd-pike-dvr-ceph/environment_context.yaml
@@ -5,8 +5,8 @@
- infra_config
- linux_system_codename_xenial
- features_runtest_cfg
- classes:
- - environment.cookied-cicd-pike-dvr-ceph.override_ntp_virtual
+ #classes:
+ #- environment.cookied-cicd-pike-dvr-ceph.override_ntp_virtual
interfaces:
ens3:
role: single_dhcp
diff --git a/tcp_tests/templates/cookied-cicd-pike-dvr-sl/environment_context.yaml b/tcp_tests/templates/cookied-cicd-pike-dvr-sl/environment_context.yaml
index 065d10f..f735daa 100644
--- a/tcp_tests/templates/cookied-cicd-pike-dvr-sl/environment_context.yaml
+++ b/tcp_tests/templates/cookied-cicd-pike-dvr-sl/environment_context.yaml
@@ -5,8 +5,8 @@
- infra_config
- linux_system_codename_xenial
- features_runtest
- classes:
- - environment.cookied-cicd-pike-dvr-sl.override_ntp_virtual
+ #classes:
+ #- environment.cookied-cicd-pike-dvr-sl.override_ntp_virtual
interfaces:
ens3:
role: single_dhcp
diff --git a/tcp_tests/templates/cookied-cicd-queens-dvr-sl/environment_context.yaml b/tcp_tests/templates/cookied-cicd-queens-dvr-sl/environment_context.yaml
index 2efd47d..9d5f841 100644
--- a/tcp_tests/templates/cookied-cicd-queens-dvr-sl/environment_context.yaml
+++ b/tcp_tests/templates/cookied-cicd-queens-dvr-sl/environment_context.yaml
@@ -5,8 +5,8 @@
- infra_config
- linux_system_codename_xenial
- features_runtest_cfg
- classes:
- - environment.cookied-cicd-queens-dvr-sl.override_ntp_virtual
+ #classes:
+ #- environment.cookied-cicd-queens-dvr-sl.override_ntp_virtual
interfaces:
ens3:
role: single_dhcp
diff --git a/tcp_tests/templates/cookied-small-mcp-ironic/environment-context.yaml b/tcp_tests/templates/cookied-small-mcp-ironic/environment-context.yaml
index 057ef10..ccc417d 100644
--- a/tcp_tests/templates/cookied-small-mcp-ironic/environment-context.yaml
+++ b/tcp_tests/templates/cookied-small-mcp-ironic/environment-context.yaml
@@ -5,8 +5,8 @@
- infra_config
- linux_system_codename_xenial
- features_runtest
- classes:
- - environment.cookied-small-mcp-ironic.override_ntp_virtual
+ #classes:
+ #- environment.cookied-small-mcp-ironic.override_ntp_virtual
interfaces:
ens3:
role: single_dhcp
diff --git a/tcp_tests/tests/system/test_3rdparty_suites.py b/tcp_tests/tests/system/test_3rdparty_suites.py
index 00b915d..188d21b 100644
--- a/tcp_tests/tests/system/test_3rdparty_suites.py
+++ b/tcp_tests/tests/system/test_3rdparty_suites.py
@@ -32,13 +32,16 @@
@pytest.mark.grab_versions
@pytest.mark.parametrize("_", [settings.ENV_NAME])
@pytest.mark.run_tempest
- def test_run_tempest(self, tempest_actions, show_step, _):
+ def test_run_tempest(self, tempest_actions, show_step, salt_actions, _):
"""Runner for Openstack tempest tests
Scenario:
- 1. Run tempest
+ 1. Sync time on the environment nodes
+ 2. Run tempest
"""
show_step(1)
+ salt_actions.sync_time()
+ show_step(2)
tempest_actions.prepare_and_run_tempest()
@pytest.mark.grab_versions