← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/maas/qa-lab-tests-env-var into lp:~maas-maintainers/maas/qa-lab-tests

 

Raphaël Badin has proposed merging lp:~rvb/maas/qa-lab-tests-env-var into lp:~maas-maintainers/maas/qa-lab-tests with lp:~rvb/maas/qa-lab-tests-arm as a prerequisite.

Commit message:
Use environment variables to configure tests.  Add an option to avoid running the juju tests.

Requested reviews:
  MAAS Maintainers (maas-maintainers)

For more details, see:
https://code.launchpad.net/~rvb/maas/qa-lab-tests-env-var/+merge/138421
-- 
https://code.launchpad.net/~rvb/maas/qa-lab-tests-env-var/+merge/138421
Your team MAAS Maintainers is requested to review the proposed merge of lp:~rvb/maas/qa-lab-tests-env-var into lp:~maas-maintainers/maas/qa-lab-tests.
=== modified file 'maas-integration.py'
--- maas-integration.py	2012-12-06 17:21:23 +0000
+++ maas-integration.py	2012-12-06 17:21:23 +0000
@@ -6,6 +6,7 @@
 from testtools import TestCase
 from testtools.matchers import Contains, Equals, StartsWith
 from testtools.content import text_content
+from unittest import skipIf
 import yaml
 import urllib2
 
@@ -19,6 +20,22 @@
 from maasserver.models.user import get_creds_tuple
 from apiclient.creds import convert_tuple_to_string
 
+# Environment variables that can be used to configured
+# what is tested.
+
+# Series to install on deployed nodes.
+NODE_SERIES = os.environ.get('NODE_SERIES', 'precise')
+
+# Whether or not the ARM nodes should be used
+# in the test.
+DO_NOT_USE_ARM_NODES = bool(
+    os.environ.get('DO_NOT_USE_ARM_NODES', False))
+
+# Whether or not the juju tests should be performed.
+DO_NOT_TEST_JUJU = bool(
+    os.environ.get('DO_NOT_TEST_JUJU', False))
+
+
 MAAS_URL = "http://192.168.21.5/MAAS";
 ADMIN_USER = "admin"
 PASSWORD = "test"
@@ -137,15 +154,10 @@
 
 class TestMAASIntegration(TestCase):
 
-    # Series to install on deployed nodes.
-    NODE_SERIES = 'precise'
-
-    USE_ARM_NODES = False
-
     def get_node_count(self):
         """The number of available nodes."""
         count = len(LENOVO_LAB)
-        if self.USE_ARM_NODES:
+        if not DO_NOT_USE_ARM_NODES:
             count += len(ARM_LAB)
         return count
 
@@ -290,7 +302,7 @@
         for ipmi_address in LENOVO_LAB.values():
             self.power_off(ipmi_address, POWER_USER, POWER_PASS)
             self.power_on(ipmi_address, POWER_USER, POWER_PASS)
-        if self.USE_ARM_NODES:
+        if not DO_NOT_USE_ARM_NODES:
             for ipmi_address in ARM_LAB.values():
                 self.power_off(ipmi_address, 'admin', 'admin')
                 self.power_on(ipmi_address, 'admin', 'admin')
@@ -356,7 +368,7 @@
         token_str = get_token_str()
         # Workaround bug 972829 (in juju precise).
         server_url = MAAS_URL.replace('/MAAS', ':80/MAAS')
-        setup_juju_config(server_url, token_str, series=self.NODE_SERIES)
+        setup_juju_config(server_url, token_str, series=NODE_SERIES)
         setup_local_dns()
 
     def _run_juju_command(self, args):
@@ -367,6 +379,7 @@
             "INFO '%s' command finished successfully" % command_name, err)
         return output
 
+    @skipIf(DO_NOT_TEST_JUJU, "Not testing juju")
     @timeout(30*60)
     def test_15_juju_bootstrap(self):
         self.setup_juju()
@@ -406,6 +419,7 @@
                 break
             sleep(20)
 
+    @skipIf(DO_NOT_TEST_JUJU, "Not testing juju")
     def test_16_juju_setup(self):
         # Deploy mediawiki with its mysql db.
         self._run_juju_command(["deploy", "mysql"])
@@ -416,12 +430,14 @@
         # parallelize the installation of the new machine.
         self._run_juju_command(["add-unit", "mediawiki"])
 
+    @skipIf(DO_NOT_TEST_JUJU, "Not testing juju")
     @timeout(30*60)
     def test_17_juju_deploy_mediawiki(self):
        self._wait_machines_running(3)
        self._wait_units_started('mediawiki', 1)
 
-    @timeout(2*60)
+    @skipIf(DO_NOT_TEST_JUJU, "Not testing juju")
+    @timeout(5*60)
     def test_18_mediawiki_homepage(self):
         while True:
             status = self.get_juju_status()
@@ -442,6 +458,7 @@
 
         self.assertIn("<title>Please set name of wiki</title>", homepage)
 
+    @skipIf(DO_NOT_TEST_JUJU, "Not testing juju")
     @timeout(30*60)
     def test_19_juju_add_unit_mediawiki(self):
         self._wait_machines_running(4)