mirror of https://github.com/apache/cloudstack.git
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)
This commit is contained in:
parent
1f64354ec8
commit
9e8663c7ca
|
|
@ -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"""
|
||||
|
||||
|
|
|
|||
|
|
@ -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"]
|
||||
|
|
|
|||
|
|
@ -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"""
|
||||
|
||||
|
|
|
|||
|
|
@ -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"""
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue