From 4ef38db3f4f2da6e1fa17736be2cea5806610b02 Mon Sep 17 00:00:00 2001 From: Tatyana Leontovich Date: Wed, 8 Apr 2015 17:50:49 +0300 Subject: [PATCH] Get dns servers from cluster attribute Change-Id: I835d339636a1efb757239b1330651c7318d07670 Closes-Bug: #1422672 --- fuel_health/config.py | 4 ++++ .../tests/sanity/test_sanity_infrastructure.py | 18 +++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/fuel_health/config.py b/fuel_health/config.py index 390b66b3..b2405b4b 100644 --- a/fuel_health/config.py +++ b/fuel_health/config.py @@ -385,6 +385,9 @@ FuelConf = [ cfg.StrOpt('fuel_version', default=None, help="Fuel version"), + cfg.StrOpt('dns', + default=None, + help="dns"), ] @@ -596,6 +599,7 @@ class NailgunConfig(object): if deployment_os != 'RHEL': storage = data['editable']['storage']['volumes_ceph']['value'] self.volume.ceph_exist = storage + self.fuel.dns = data['editable']['external_dns'].get('value', None) def _parse_nodes_cluster_id(self): api_url = '/api/nodes?cluster_id=%s' % self.cluster_id diff --git a/fuel_health/tests/sanity/test_sanity_infrastructure.py b/fuel_health/tests/sanity/test_sanity_infrastructure.py index c168096f..883f3d95 100644 --- a/fuel_health/tests/sanity/test_sanity_infrastructure.py +++ b/fuel_health/tests/sanity/test_sanity_infrastructure.py @@ -42,6 +42,7 @@ class SanityInfrastructureTest(nmanager.SanityChecksTest): cls.pwd = cls.config.compute.controller_node_ssh_password cls.key = cls.config.compute.path_to_private_key cls.timeout = cls.config.compute.ssh_timeout + cls.fuel_dns = cls.config.fuel.dns @classmethod def tearDownClass(cls): @@ -123,13 +124,16 @@ class SanityInfrastructureTest(nmanager.SanityChecksTest): if not self.computes: self.skipTest('There are no computes nodes') + dns = self.fuel_dns.spit(',') if self.fuel_dns else ['8.8.8.8'] + ssh_client = SSHClient(self.computes[0], self.usr, self.pwd, key_filename=self.key, timeout=self.timeout) - expected_output = "google" - cmd = "host 8.8.8.8" + expected_output = "{0}.in-addr.arpa domain name pointer".format(dns[0]) + + cmd = "host {0}".format(dns[0]) output = self.verify(100, self.retry_command, 1, "'host' command failed. Looks like there is no " "Internet connection on the computes node.", @@ -138,17 +142,17 @@ class SanityInfrastructureTest(nmanager.SanityChecksTest): LOG.debug(output) self.verify_response_true(expected_output in output, 'Step 2 failed: ' - 'DNS name for 8.8.8.8 host ' - 'cannot be resolved.') + 'DNS name for {0} host ' + 'cannot be resolved.'.format(dns[0])) - expected_output = "google.com has address" - cmd = "host google.com" + domain_name = output.split()[-1] + cmd = "host {0}".format(domain_name) output = self.verify(100, self.retry_command, 3, "'host' command failed. " "DNS name cannot be resolved.", "'host' command", 10, 5, ssh_client.exec_command, cmd) LOG.debug(output) - self.verify_response_true(expected_output in output, + self.verify_response_true('has address {0}'.format(dns[0]) in output, 'Step 4 failed: ' 'DNS name cannot be resolved.')