You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ts...@apache.org on 2013/07/25 12:04:38 UTC
git commit: updated refs/heads/4.2 to 1067888
Updated Branches:
refs/heads/4.2 0d862a924 -> 1067888f6
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 <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1067888f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1067888f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1067888f
Branch: refs/heads/4.2
Commit: 1067888f6de14d0b69b7c736ef1aa1bd323ec572
Parents: 0d862a9
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Thu Jul 25 15:33:10 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Thu Jul 25 15:34:15 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/1067888f/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/1067888f/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/1067888f/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/1067888f/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"""