From 06dcbc702b0df59f3c4bc160839ecfaf0931da8b Mon Sep 17 00:00:00 2001 From: Anoop Rajendra Date: Tue, 30 Apr 2019 11:01:14 -0700 Subject: [PATCH] BUGFIX: Start Chronyd on frontend INTERNAL: Fix test cases for time services TODO: Test cases for Backend NTP/Chorny services STACKI-982 #Done --- common/nodes/time-server.xml | 5 +++-- .../command/stack/commands/report/host/time/__init__.py | 2 ++ .../command/report/system/tests/test_services.py | 1 + .../test-suites/integration/tests/fixtures/add_data.py | 7 +++++++ .../integration/tests/list/test_list_host_profile.py | 2 +- 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/common/nodes/time-server.xml b/common/nodes/time-server.xml index 2751de989..24785b9a6 100644 --- a/common/nodes/time-server.xml +++ b/common/nodes/time-server.xml @@ -10,8 +10,9 @@ https://github.com/Teradata/stacki/blob/master/LICENSE.txt chrony -stack set attr attr=time.protocol value=chrony -stack report host time &hostname; | stack report script | sh +/opt/stack/bin/stack set attr attr=time.protocol value=chrony +/opt/stack/bin/stack set appliance attr frontend attr=time.protocol value=chrony +/opt/stack/bin/stack report host time &hostname; | /opt/stack/bin/stack report script | sh diff --git a/common/src/stack/command/stack/commands/report/host/time/__init__.py b/common/src/stack/command/stack/commands/report/host/time/__init__.py index 7a8f15834..d39480952 100644 --- a/common/src/stack/command/stack/commands/report/host/time/__init__.py +++ b/common/src/stack/command/stack/commands/report/host/time/__init__.py @@ -167,6 +167,8 @@ def run(self, params, args): protocol = 'ntp' self.timeservers = self.getNTPServers(host) + if len(self.timeservers) == 0: + raise CommandError(self, f'No time servers specified for host {host}. Check network interface assignments') self.runImplementation('time_%s' % protocol, (host)) diff --git a/common/src/stack/report-system/command/report/system/tests/test_services.py b/common/src/stack/report-system/command/report/system/tests/test_services.py index ae3ff4012..001dae7c7 100644 --- a/common/src/stack/report-system/command/report/system/tests/test_services.py +++ b/common/src/stack/report-system/command/report/system/tests/test_services.py @@ -10,6 +10,7 @@ 'smq-producer', 'smq-publisher', 'sshd', + 'chronyd', ] SKIP_SVCS = {} diff --git a/test-framework/test-suites/integration/tests/fixtures/add_data.py b/test-framework/test-suites/integration/tests/fixtures/add_data.py index 17fd41fe9..e05ef3b71 100644 --- a/test-framework/test-suites/integration/tests/fixtures/add_data.py +++ b/test-framework/test-suites/integration/tests/fixtures/add_data.py @@ -188,3 +188,10 @@ def _inner(name, address): # to get more networks added return _inner + +@pytest.fixture +def add_host_with_net(host): + host.run("stack add network test pxe=true address=192.168.0.0 mask=255.255.255.0") + host.run("stack add host interface a:frontend interface=eth2 network=test ip=192.168.0.2") + host.run("stack add host backend-0-0 appliance=backend rack=0 rank=0") + host.run("stack add host interface backend-0-0 interface=eth0 network=test ip=192.168.0.3") diff --git a/test-framework/test-suites/integration/tests/list/test_list_host_profile.py b/test-framework/test-suites/integration/tests/list/test_list_host_profile.py index 793edcd6a..a7e5c4d8d 100644 --- a/test-framework/test-suites/integration/tests/list/test_list_host_profile.py +++ b/test-framework/test-suites/integration/tests/list/test_list_host_profile.py @@ -1,7 +1,7 @@ import xml.etree.ElementTree as ET -def test_list_host_profile(host, add_host, revert_export_stack_carts): +def test_list_host_profile(host, add_host_with_net, revert_export_stack_carts): result = host.run('stack list host profile backend-0-0') assert result.rc == 0