← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/maas/qa-lab-tests-wait-cluster-connect into lp:~maas-maintainers/maas/qa-lab-tests

 

Raphaël Badin has proposed merging lp:~rvb/maas/qa-lab-tests-wait-cluster-connect into lp:~maas-maintainers/maas/qa-lab-tests.

Commit message:
Wait a bit for the cluster to connect to the region before giving up.

Requested reviews:
  MAAS Maintainers (maas-maintainers)

For more details, see:
https://code.launchpad.net/~rvb/maas/qa-lab-tests-wait-cluster-connect/+merge/146383

This fixes a race condition that appears because the cluster controller tries to connect itself to the region only every minute.  If the first time the cluster tries to connect, the region is not yet up, then the next attempt will happen only 1 minute later and this can break the integration tests.
-- 
https://code.launchpad.net/~rvb/maas/qa-lab-tests-wait-cluster-connect/+merge/146383
Your team MAAS Maintainers is requested to review the proposed merge of lp:~rvb/maas/qa-lab-tests-wait-cluster-connect into lp:~maas-maintainers/maas/qa-lab-tests.
=== modified file 'maas-integration.py'
--- maas-integration.py	2013-01-18 11:14:39 +0000
+++ maas-integration.py	2013-02-04 11:06:20 +0000
@@ -260,8 +260,23 @@
             output, Contains(
             "\nYou are now logged in to the MAAS server"))
 
+    def get_master_ng_uuid(self):
+        output, err = self._run_maas_cli(["node-groups", "list"])
+        node_groups = loads(output)
+        master_nodegroup = node_groups[0]
+        return master_nodegroup['uuid']
+
+    @timeout(5*60)
+    def test_08_cluster_connected(self):
+        # The master cluster is connected and changed the uuid field of the
+        # nodegroup object from 'master' to its UUID.
+        name = self.get_master_ng_uuid()
+        while name == 'master':
+            sleep(10)
+            name = self.get_master_ng_uuid()
+
     @timeout(60)
-    def test_08_set_up_dhcp(self):
+    def test_09_set_up_dhcp(self):
         output, err = self._run_maas_cli(["node-groups", "list"])
         node_groups = loads(output)
         output, err = self._run_maas_cli([
@@ -283,7 +298,7 @@
         while os.path.exists("/etc/maas/dhcpd.conf") is False:
             sleep(2)
 
-    def test_09_update_dns_config(self):
+    def test_10_update_dns_config(self):
         #XXX: matsubara Could be asked by maas-dns package and configurable
         # through debconf seed file.
         dns_config = open("/etc/bind/named.conf.options", 'w')
@@ -315,7 +330,7 @@
                 self.power_off(ipmi_address, 'admin', 'admin')
                 self.power_on(ipmi_address, 'admin', 'admin')
 
-    def test_10_boot_nodes_enlist(self):
+    def test_11_boot_nodes_enlist(self):
         self._boot_nodes()
 
     def _wait_nodes(self, status, min_node=None):
@@ -335,10 +350,10 @@
                 node for node in node_list if node['status'] == status]
 
     @timeout(5*60)
-    def test_11_check_nodes_declared(self):
+    def test_12_check_nodes_declared(self):
         self._wait_nodes(0)
 
-    def test_12_set_nodes_ipmi_config(self):
+    def test_13_set_nodes_ipmi_config(self):
         """Set IPMI configuration for each node."""
         all_nodes = {}
         all_nodes.update(LENOVO_LAB)
@@ -360,14 +375,14 @@
                     "power_parameters_power_user=%s" % power_user,
                     "power_parameters_power_pass=%s" % power_pass])
 
-    def test_13_commission_nodes(self):
+    def test_14_commission_nodes(self):
         # Use maas-cli to accept all nodes.
         output, err = self._run_maas_cli(["nodes","accept-all"])
         for node in loads(output):
             self.assertEqual(node['status'], 1)
 
     @timeout(10*60)
-    def test_14_check_nodes_ready(self):
+    def test_15_check_nodes_ready(self):
         self._wait_nodes(4)
 
     def setup_juju(self):
@@ -389,7 +404,7 @@
 
     @skipIf(DO_NOT_TEST_JUJU, "Not testing juju")
     @timeout(50*60)
-    def test_15_juju_bootstrap(self):
+    def test_16_juju_bootstrap(self):
         self.setup_juju()
         self._run_juju_command(['bootstrap'])
         self._run_juju_command(['status'])
@@ -428,7 +443,7 @@
             sleep(20)
 
     @skipIf(DO_NOT_TEST_JUJU, "Not testing juju")
-    def test_16_juju_setup(self):
+    def test_17_juju_setup(self):
         # Deploy mediawiki with its mysql db.
         self._run_juju_command(["deploy", "mysql"])
         is_precise = platform.linux_distribution()[2] == 'precise'
@@ -445,13 +460,13 @@
 
     @skipIf(DO_NOT_TEST_JUJU, "Not testing juju")
     @timeout(30*60)
-    def test_17_juju_deploy_mediawiki(self):
+    def test_18_juju_deploy_mediawiki(self):
        self._wait_machines_running(3)
        self._wait_units_started('mediawiki', 1)
 
     @skipIf(DO_NOT_TEST_JUJU, "Not testing juju")
     @timeout(5*60)
-    def test_18_mediawiki_homepage(self):
+    def test_19_mediawiki_homepage(self):
         while True:
             status = self.get_juju_status()
             mediawiki_address = (
@@ -477,6 +492,6 @@
 
     @skipIf(DO_NOT_TEST_JUJU, "Not testing juju")
     @timeout(30*60)
-    def test_19_juju_add_unit_mediawiki(self):
+    def test_20_juju_add_unit_mediawiki(self):
         self._wait_machines_running(4)
         self._wait_units_started('mediawiki', 2)