You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by wi...@apache.org on 2013/04/03 12:33:44 UTC
[36/50] [abbrv] git commit: updated refs/heads/kvm-vnc-listen to
3890860
moving out the vmpasswd into its own suite
vm passwords are extended features that don't need to be part of the
smoke suite.
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/fe48bbeb
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/fe48bbeb
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/fe48bbeb
Branch: refs/heads/kvm-vnc-listen
Commit: fe48bbebda0ff05653fc2341649e410db6bfb159
Parents: 3075d0c
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Thu Mar 21 15:34:26 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Tue Apr 2 18:31:29 2013 +0530
----------------------------------------------------------------------
.../integration/component/test_vm_passwdenabled.py | 242 +++++++++++++++
test/integration/smoke/test_vm_life_cycle.py | 170 ----------
tools/marvin/marvin/testSetupSuccess.py | 2 +-
3 files changed, 243 insertions(+), 171 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fe48bbeb/test/integration/component/test_vm_passwdenabled.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vm_passwdenabled.py b/test/integration/component/test_vm_passwdenabled.py
new file mode 100644
index 0000000..fb88170
--- /dev/null
+++ b/test/integration/component/test_vm_passwdenabled.py
@@ -0,0 +1,242 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+import marvin
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from marvin.remoteSSHClient import remoteSSHClient
+from marvin.integration.lib.utils import *
+from marvin.integration.lib.base import *
+from marvin.integration.lib.common import *
+from nose.plugins.attrib import attr
+
+
+_multiprocess_shared_ = True
+class Services:
+ """Test VM Life Cycle Services
+ """
+
+ def __init__(self):
+ self.services = {
+ "disk_offering":{
+ "displaytext": "Small",
+ "name": "Small",
+ "disksize": 1
+ },
+ "account": {
+ "email": "test@test.com",
+ "firstname": "Test",
+ "lastname": "User",
+ "username": "test",
+ # Random characters are appended in create account to
+ # ensure unique username generated each time
+ "password": "password",
+ },
+ "service_offerings":
+ {
+ "small":
+ {
+ # Small service offering ID to for change VM
+ # service offering from medium to small
+ "name": "Small Instance",
+ "displaytext": "Small Instance",
+ "cpunumber": 1,
+ "cpuspeed": 100,
+ "memory": 256,
+ },
+ },
+ "template": {
+ "displaytext": "Cent OS Template",
+ "name": "Cent OS Template",
+ "passwordenabled": True,
+ },
+ "sleep": 60,
+ "timeout": 10,
+ "ostype": 'CentOS 5.3 (64-bit)',
+ # CentOS 5.3 (64-bit)
+ }
+
+@unittest.skip("Additional test")
+class TestVMPasswordEnabled(cloudstackTestCase):
+
+ @classmethod
+ def setUpClass(cls):
+ cls.api_client = super(
+ TestVMPasswordEnabled,
+ cls
+ ).getClsTestClient().getApiClient()
+ cls.services = Services().services
+
+ # Get Zone, Domain and templates
+ domain = get_domain(cls.api_client, cls.services)
+ zone = get_zone(cls.api_client, cls.services)
+ template = get_template(
+ cls.api_client,
+ zone.id,
+ cls.services["ostype"]
+ )
+ # Set Zones and disk offerings
+ cls.services["small"]["zoneid"] = zone.id
+ cls.services["small"]["template"] = template.id
+
+ # Create VMs, NAT Rules etc
+ cls.account = Account.create(
+ cls.api_client,
+ cls.services["account"],
+ domainid=domain.id
+ )
+
+ cls.small_offering = ServiceOffering.create(
+ cls.api_client,
+ cls.services["service_offerings"]["small"]
+ )
+
+ cls.virtual_machine = VirtualMachine.create(
+ cls.api_client,
+ cls.services["small"],
+ accountid=cls.account.account.name,
+ domainid=cls.account.account.domainid,
+ serviceofferingid=cls.small_offering.id,
+ mode=cls.services["mode"]
+ )
+ #Stop virtual machine
+ cls.virtual_machine.stop(cls.api_client)
+
+ # Poll listVM to ensure VM is stopped properly
+ timeout = cls.services["timeout"]
+ while True:
+ time.sleep(cls.services["sleep"])
+
+ # Ensure that VM is in stopped state
+ list_vm_response = list_virtual_machines(
+ cls.api_client,
+ id=cls.virtual_machine.id
+ )
+
+ if isinstance(list_vm_response, list):
+
+ vm = list_vm_response[0]
+ if vm.state == 'Stopped':
+ break
+
+ if timeout == 0:
+ raise Exception(
+ "Failed to stop VM (ID: %s) in change service offering" %
+ vm.id)
+
+ timeout = timeout - 1
+
+ list_volume = list_volumes(
+ cls.api_client,
+ virtualmachineid=cls.virtual_machine.id,
+ type='ROOT',
+ listall=True
+ )
+ if isinstance(list_volume, list):
+ cls.volume = list_volume[0]
+ else:
+ raise Exception(
+ "Exception: Unable to find root volume foe VM: %s" %
+ cls.virtual_machine.id)
+
+ cls.services["template"]["ostype"] = cls.services["ostype"]
+ #Create templates for Edit, Delete & update permissions testcases
+ cls.pw_enabled_template = Template.create(
+ cls.api_client,
+ cls.services["template"],
+ cls.volume.id,
+ account=cls.account.account.name,
+ domainid=cls.account.account.domainid
+ )
+ # Delete the VM - No longer needed
+ cls.virtual_machine.delete(cls.api_client)
+ cls.services["small"]["template"] = cls.pw_enabled_template.id
+
+ cls.vm = VirtualMachine.create(
+ cls.api_client,
+ cls.services["small"],
+ accountid=cls.account.account.name,
+ domainid=cls.account.account.domainid,
+ serviceofferingid=cls.small_offering.id,
+ mode=cls.services["mode"]
+ )
+ cls._cleanup = [
+ cls.small_offering,
+ cls.pw_enabled_template,
+ cls.account
+ ]
+
+ @classmethod
+ def tearDownClass(cls):
+ # Cleanup VMs, templates etc.
+ cleanup_resources(cls.api_client, cls._cleanup)
+ return
+
+ def setUp(self):
+ self.apiclient = self.testClient.getApiClient()
+ self.dbclient = self.testClient.getDbConnection()
+ self.cleanup = []
+
+ def tearDown(self):
+ #Clean up, terminate the created instances
+ cleanup_resources(self.apiclient, self.cleanup)
+ return
+
+ @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
+ def test_11_get_vm_password(self):
+ """Test get VM password for password enabled template"""
+
+ # Validate the following
+ # 1. Create an account
+ # 2. Deploy VM with default service offering and "password enabled"
+ # template. Vm should be in running state.
+ # 3. Stop VM deployed in step 2
+ # 4. Reset VM password. SSH with new password should be successful
+
+ self.debug("Stopping VM: %s" % self.vm.name)
+ self.vm.stop(self.apiclient)
+
+ # Sleep to ensure VM is stopped properly
+ time.sleep(self.services["sleep"])
+
+ self.debug("Resetting VM password for VM: %s" % self.vm.name)
+ password = self.vm.resetPassword(self.apiclient)
+ self.debug("Password reset to: %s" % password)
+
+ self.debug("Starting VM to verify new password..")
+ self.vm.start(self.apiclient)
+ self.debug("VM - %s stated!" % self.vm.name)
+
+ vms = VirtualMachine.list(self.apiclient, id=self.vm.id, listall=True)
+ self.assertEqual(
+ isinstance(vms, list),
+ True,
+ "List VMs should retun valid response for VM: %s" % self.vm.name
+ )
+ virtual_machine = vms[0]
+
+ self.assertEqual(
+ virtual_machine.state,
+ "Running",
+ "VM state should be running"
+ )
+ try:
+ self.debug("SSHing into VM: %s" % self.vm.ssh_ip)
+ self.vm.password = password
+ ssh = self.vm.get_ssh_client()
+ except Exception as e:
+ self.fail("SSH into VM: %s failed" % self.vm.ssh_ip)
+ return
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fe48bbeb/test/integration/smoke/test_vm_life_cycle.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_vm_life_cycle.py b/test/integration/smoke/test_vm_life_cycle.py
index 0a5fbad..719984d 100644
--- a/test/integration/smoke/test_vm_life_cycle.py
+++ b/test/integration/smoke/test_vm_life_cycle.py
@@ -998,174 +998,4 @@ class TestVMLifeCycle(cloudstackTestCase):
)
return
-@unittest.skip("Additional test")
-class TestVMPasswordEnabled(cloudstackTestCase):
- @classmethod
- def setUpClass(cls):
- cls.api_client = super(
- TestVMPasswordEnabled,
- cls
- ).getClsTestClient().getApiClient()
- cls.services = Services().services
-
- # Get Zone, Domain and templates
- domain = get_domain(cls.api_client, cls.services)
- zone = get_zone(cls.api_client, cls.services)
- template = get_template(
- cls.api_client,
- zone.id,
- cls.services["ostype"]
- )
- # Set Zones and disk offerings
- cls.services["small"]["zoneid"] = zone.id
- cls.services["small"]["template"] = template.id
-
- # Create VMs, NAT Rules etc
- cls.account = Account.create(
- cls.api_client,
- cls.services["account"],
- domainid=domain.id
- )
-
- cls.small_offering = ServiceOffering.create(
- cls.api_client,
- cls.services["service_offerings"]["small"]
- )
-
- cls.virtual_machine = VirtualMachine.create(
- cls.api_client,
- cls.services["small"],
- accountid=cls.account.account.name,
- domainid=cls.account.account.domainid,
- serviceofferingid=cls.small_offering.id,
- mode=cls.services["mode"]
- )
- #Stop virtual machine
- cls.virtual_machine.stop(cls.api_client)
-
- # Poll listVM to ensure VM is stopped properly
- timeout = cls.services["timeout"]
- while True:
- time.sleep(cls.services["sleep"])
-
- # Ensure that VM is in stopped state
- list_vm_response = list_virtual_machines(
- cls.api_client,
- id=cls.virtual_machine.id
- )
-
- if isinstance(list_vm_response, list):
-
- vm = list_vm_response[0]
- if vm.state == 'Stopped':
- break
-
- if timeout == 0:
- raise Exception(
- "Failed to stop VM (ID: %s) in change service offering" %
- vm.id)
-
- timeout = timeout - 1
-
- list_volume = list_volumes(
- cls.api_client,
- virtualmachineid=cls.virtual_machine.id,
- type='ROOT',
- listall=True
- )
- if isinstance(list_volume, list):
- cls.volume = list_volume[0]
- else:
- raise Exception(
- "Exception: Unable to find root volume foe VM: %s" %
- cls.virtual_machine.id)
-
- cls.services["template"]["ostype"] = cls.services["ostype"]
- #Create templates for Edit, Delete & update permissions testcases
- cls.pw_enabled_template = Template.create(
- cls.api_client,
- cls.services["template"],
- cls.volume.id,
- account=cls.account.account.name,
- domainid=cls.account.account.domainid
- )
- # Delete the VM - No longer needed
- cls.virtual_machine.delete(cls.api_client)
- cls.services["small"]["template"] = cls.pw_enabled_template.id
-
- cls.vm = VirtualMachine.create(
- cls.api_client,
- cls.services["small"],
- accountid=cls.account.account.name,
- domainid=cls.account.account.domainid,
- serviceofferingid=cls.small_offering.id,
- mode=cls.services["mode"]
- )
- cls._cleanup = [
- cls.small_offering,
- cls.pw_enabled_template,
- cls.account
- ]
-
- @classmethod
- def tearDownClass(cls):
- # Cleanup VMs, templates etc.
- cleanup_resources(cls.api_client, cls._cleanup)
- return
-
- def setUp(self):
- self.apiclient = self.testClient.getApiClient()
- self.dbclient = self.testClient.getDbConnection()
- self.cleanup = []
-
- def tearDown(self):
- #Clean up, terminate the created instances
- cleanup_resources(self.apiclient, self.cleanup)
- return
-
- @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
- def test_11_get_vm_password(self):
- """Test get VM password for password enabled template"""
-
- # Validate the following
- # 1. Create an account
- # 2. Deploy VM with default service offering and "password enabled"
- # template. Vm should be in running state.
- # 3. Stop VM deployed in step 2
- # 4. Reset VM password. SSH with new password should be successful
-
- self.debug("Stopping VM: %s" % self.vm.name)
- self.vm.stop(self.apiclient)
-
- # Sleep to ensure VM is stopped properly
- time.sleep(self.services["sleep"])
-
- self.debug("Resetting VM password for VM: %s" % self.vm.name)
- password = self.vm.resetPassword(self.apiclient)
- self.debug("Password reset to: %s" % password)
-
- self.debug("Starting VM to verify new password..")
- self.vm.start(self.apiclient)
- self.debug("VM - %s stated!" % self.vm.name)
-
- vms = VirtualMachine.list(self.apiclient, id=self.vm.id, listall=True)
- self.assertEqual(
- isinstance(vms, list),
- True,
- "List VMs should retun valid response for VM: %s" % self.vm.name
- )
- virtual_machine = vms[0]
-
- self.assertEqual(
- virtual_machine.state,
- "Running",
- "VM state should be running"
- )
- try:
- self.debug("SSHing into VM: %s" % self.vm.ssh_ip)
- self.vm.password = password
- ssh = self.vm.get_ssh_client()
- except Exception as e:
- self.fail("SSH into VM: %s failed" % self.vm.ssh_ip)
- return
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fe48bbeb/tools/marvin/marvin/testSetupSuccess.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/testSetupSuccess.py b/tools/marvin/marvin/testSetupSuccess.py
index 319fd21..b1721c4 100644
--- a/tools/marvin/marvin/testSetupSuccess.py
+++ b/tools/marvin/marvin/testSetupSuccess.py
@@ -33,7 +33,7 @@ class TestSetupSuccess(cloudstackTestCase):
zones = listZones.listZonesCmd()
cls.zones_list = cls.apiClient.listZones(zones)
- cls.retry = 50
+ cls.retry = 2
def test_systemVmReady(self):
"""