cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject git commit: updated refs/heads/master to 9e8663c
Date Thu, 25 Jul 2013 10:04:26 GMT
Updated Branches:
  refs/heads/master 1f64354ec -> 9e8663c7c


CLOUDSTACK-3617: Skip the test if config is not suitable

Provided a utility method to ensure the config is suitable for running
the test. If vm.instancename.flag is unset then skip the tests.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
(cherry picked from commit 8b8cee52f09f9f2c1b612ece16fc7ffc4b2c9176)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9e8663c7
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9e8663c7
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9e8663c7

Branch: refs/heads/master
Commit: 9e8663c7cab525910f26396dc3c58633ae88bfd8
Parents: 1f64354
Author: Prasanna Santhanam <tsp@apache.org>
Authored: Thu Jul 25 15:33:10 2013 +0530
Committer: Prasanna Santhanam <tsp@apache.org>
Committed: Thu Jul 25 15:34:04 2013 +0530

----------------------------------------------------------------------
 test/integration/component/test_accounts.py        |  2 +-
 test/integration/component/test_custom_hostname.py |  9 ++++++---
 tools/marvin/marvin/integration/lib/common.py      | 11 +++++++++--
 tools/marvin/marvin/integration/lib/utils.py       |  6 ++++--
 4 files changed, 20 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9e8663c7/test/integration/component/test_accounts.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_accounts.py b/test/integration/component/test_accounts.py
index 1170c79..67b56fd 100644
--- a/test/integration/component/test_accounts.py
+++ b/test/integration/component/test_accounts.py
@@ -915,7 +915,7 @@ class TestTemplateHierarchy(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags=["advanced", "basic", "eip", "advancedns", "sg", "needle"])
+    @attr(tags=["advanced", "basic", "eip", "advancedns", "sg"])
     def test_01_template_hierarchy(self):
         """Test to verify template at same level in hierarchy"""
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9e8663c7/test/integration/component/test_custom_hostname.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_custom_hostname.py b/test/integration/component/test_custom_hostname.py
index e569215..0898e1e 100644
--- a/test/integration/component/test_custom_hostname.py
+++ b/test/integration/component/test_custom_hostname.py
@@ -20,12 +20,9 @@
 import marvin
 from nose.plugins.attrib import attr
 from marvin.cloudstackTestCase import *
-from marvin.cloudstackAPI import *
 from marvin.integration.lib.utils import *
 from marvin.integration.lib.base import *
 from marvin.integration.lib.common import *
-from marvin.remoteSSHClient import remoteSSHClient
-import datetime
 
 
 class Services:
@@ -157,6 +154,8 @@ class TestInstanceNameFlagTrue(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
+
+
     @attr(configuration='vm.instancename.flag')
     @attr(tags=["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
     def test_01_user_provided_hostname(self):
@@ -168,6 +167,8 @@ class TestInstanceNameFlagTrue(cloudstackTestCase):
         #    should be user provided display name
         # 2. Give the user provided user name. Internal name should be
         #    i-<userid>-<vmid>-display name
+        if not is_config_suitable(apiclient=self.apiclient, name='vm.instancename.flag',
value='true'):
+            self.skipTest('vm.instancename.flag should be true. skipping')
 
         self.debug("Deploying VM in account: %s" % self.account.name)
         # Spawn an instance in that network
@@ -270,6 +271,8 @@ class TestInstanceNameFlagTrue(cloudstackTestCase):
         #    should be user provided display name
         # 2. Dont give the user provided user name. Internal name should be
         #    i-<userid>-<vmid>-<instance.name> in global config
+        if not is_config_suitable(apiclient=self.apiclient, name='vm.instancename.flag',
value='true'):
+            self.skipTest('vm.instancename.flag should be true. skipping')
 
         # Removing display name from config
         del self.services["virtual_machine"]["displayname"]

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9e8663c7/tools/marvin/marvin/integration/lib/common.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/common.py b/tools/marvin/marvin/integration/lib/common.py
index e78f64a..4f5acef 100644
--- a/tools/marvin/marvin/integration/lib/common.py
+++ b/tools/marvin/marvin/integration/lib/common.py
@@ -18,8 +18,6 @@
 """
 
 #Import Local Modules
-import marvin
-from marvin.cloudstackTestCase import *
 from marvin.cloudstackAPI import *
 from marvin.remoteSSHClient import remoteSSHClient
 from utils import *
@@ -29,6 +27,15 @@ from base import *
 import time
 
 
+def is_config_suitable(apiclient, name, value):
+    """
+    Ensure if the deployment has the expected `value` for the global setting `name'
+    @return: true if value is set, else false
+    """
+    configs = Configurations.list(apiclient, name=name)
+    assert(configs is not None and isinstance(configs, list) and len(configs) > 0)
+    return configs[0].value == value
+
 def wait_for_cleanup(apiclient, configs=None):
     """Sleeps till the cleanup configs passed"""
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9e8663c7/tools/marvin/marvin/integration/lib/utils.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/utils.py b/tools/marvin/marvin/integration/lib/utils.py
index f7f39c9..16bbb7e 100644
--- a/tools/marvin/marvin/integration/lib/utils.py
+++ b/tools/marvin/marvin/integration/lib/utils.py
@@ -109,7 +109,7 @@ def cleanup_resources(api_client, resources):
         obj.delete(api_client)
 
 
-def is_server_ssh_ready(ipaddress, port, username, password, retries=50, keyPairFileLocation=None):
+def is_server_ssh_ready(ipaddress, port, username, password, retries=5, timeout=20, keyPairFileLocation=None):
     """Return ssh handle else wait till sshd is running"""
     loop_cnt = retries
     while True:
@@ -124,9 +124,10 @@ def is_server_ssh_ready(ipaddress, port, username, password, retries=50,
keyPair
             if loop_cnt == 0:
                 raise e
             loop_cnt = loop_cnt - 1
-            time.sleep(30)
+            time.sleep(timeout)
         else:
             return ssh
+    raise Exception("Failed to bring up ssh service in time. Waited %ss" % retries*timeout)
 
 
 def format_volume_to_ext3(ssh_client, device="/dev/sda"):
@@ -157,6 +158,7 @@ def fetch_api_client(config_file='datacenterCfg'):
     )
 
 
+
 def get_process_status(hostip, port, username, password, linklocalip, process, hypervisor=None):
     """Double hop and returns a process status"""
 


Mime
View raw message