You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ta...@apache.org on 2015/01/13 10:53:54 UTC
[1/3] git commit: updated refs/heads/4.5 to b8184d1
Repository: cloudstack
Updated Branches:
refs/heads/4.5 d161642f6 -> b8184d1e7
CLOUDSTACK-8145: Adding new test to test blocker bugs and modifying other test case to work around the bug
Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9278ac11
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9278ac11
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9278ac11
Branch: refs/heads/4.5
Commit: 9278ac1130683057cfbd752138b266565bd0f695
Parents: d161642
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Fri Jan 9 15:41:03 2015 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Tue Jan 13 15:22:06 2015 +0530
----------------------------------------------------------------------
test/integration/component/test_blocker_bugs.py | 146 ++++++++++++++++++-
.../component/test_reset_ssh_keypair.py | 6 +
2 files changed, 150 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9278ac11/test/integration/component/test_blocker_bugs.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_blocker_bugs.py b/test/integration/component/test_blocker_bugs.py
index f9530f0..9e8b916 100644
--- a/test/integration/component/test_blocker_bugs.py
+++ b/test/integration/component/test_blocker_bugs.py
@@ -106,7 +106,6 @@ class Services:
"sleep": 180,
}
-
class TestTemplate(cloudstackTestCase):
def setUp(self):
@@ -253,7 +252,6 @@ class TestTemplate(cloudstackTestCase):
)
return
-
class TestNATRules(cloudstackTestCase):
@classmethod
@@ -1001,3 +999,147 @@ class TestTemplates(cloudstackTestCase):
"Check the name of the template"
)
return
+
+class TestDataPersistency(cloudstackTestCase):
+
+ @classmethod
+ def setUpClass(cls):
+
+ cls.testClient = super(TestDataPersistency, cls).getClsTestClient()
+ cls.api_client = cls.testClient.getApiClient()
+
+ cls.services = cls.testClient.getParsedTestDataConfig()
+ # Get Zone, Domain and templates
+ cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+ cls.domain = get_domain(cls.api_client)
+ cls.services['mode'] = cls.zone.networktype
+ template = get_template(
+ cls.api_client,
+ cls.zone.id,
+ cls.services["ostype"]
+ )
+ cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+
+ #Create an account, network, VM and IP addresses
+ cls.account = Account.create(
+ cls.api_client,
+ cls.services["account"],
+ domainid=cls.domain.id
+ )
+
+ cls.userapiclient = cls.testClient.getUserApiClient(
+ UserName=cls.account.name,
+ DomainName=cls.account.domain)
+
+ cls.service_offering = ServiceOffering.create(
+ cls.api_client,
+ cls.services["service_offering"]
+ )
+ cls.virtual_machine = VirtualMachine.create(
+ cls.api_client,
+ cls.services["virtual_machine"],
+ templateid=template.id,
+ accountid=cls.account.name,
+ domainid=cls.account.domainid,
+ serviceofferingid=cls.service_offering.id,
+ mode=cls.services["mode"]
+ )
+ cls.cleanup = [
+ cls.account,
+ cls.service_offering
+ ]
+ return
+
+ @classmethod
+ def tearDownClass(cls):
+ try:
+ #Clean up, terminate the created templates
+ cleanup_resources(cls.api_client, cls.cleanup)
+
+ except Exception as e:
+ raise Exception("Warning: Exception during cleanup : %s" % e)
+ return
+
+ def setUp(self):
+ self.apiclient = self.testClient.getApiClient()
+ return
+
+ def tearDown(self):
+ # No need
+ return
+
+ @attr(tags=["advanced", "basic", "advancedns", "eip"], required_hardware="true")
+ def test_01_data_persistency_root_disk(self):
+ """
+ Test the timing issue of root disk data sync
+
+ # 1. Write data to root disk of a VM
+ # 2. Create a template from the root disk of VM
+ # 3. Create a new VM from this template
+ # 4. Check that the data is present in the new VM
+
+ This is to test that data is persisted on root disk of VM or not
+ when template is created immediately from it
+ """
+
+ ssh = self.virtual_machine.get_ssh_client()
+
+ sampleText = "This is sample data"
+
+ cmds = [
+ "cd /root/",
+ "touch testFile.txt",
+ "chmod 600 testFile.txt",
+ "echo %s >> testFile.txt" % sampleText
+ ]
+ for c in cmds:
+ ssh.execute(c)
+
+ #Stop virtual machine
+ self.virtual_machine.stop(self.api_client)
+
+ list_volume = Volume.list(
+ self.api_client,
+ virtualmachineid=self.virtual_machine.id,
+ type='ROOT',
+ listall=True)
+
+ if isinstance(list_volume, list):
+ self.volume = list_volume[0]
+ else:
+ raise Exception(
+ "Exception: Unable to find root volume for VM: %s" %
+ self.virtual_machine.id)
+
+ self.services["template"]["ostype"] = self.services["ostype"]
+ #Create templates for Edit, Delete & update permissions testcases
+ customTemplate = Template.create(
+ self.userapiclient,
+ self.services["template"],
+ self.volume.id,
+ account=self.account.name,
+ domainid=self.account.domainid
+ )
+ self.cleanup.append(customTemplate)
+ # Delete the VM - No longer needed
+ self.virtual_machine.delete(self.apiclient)
+
+ virtual_machine = VirtualMachine.create(
+ self.apiclient,
+ self.services["virtual_machine"],
+ templateid=customTemplate.id,
+ accountid=self.account.name,
+ domainid=self.account.domainid,
+ serviceofferingid=self.service_offering.id,
+ mode=self.services["mode"]
+ )
+
+ ssh = virtual_machine.get_ssh_client()
+
+ response = ssh.execute("cat /root/testFile.txt")
+ res = str(response[0])
+
+ self.assertEqual(res, sampleText, "The data %s does not match\
+ with sample test %s" %
+ (res, sampleText))
+ return
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9278ac11/test/integration/component/test_reset_ssh_keypair.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_reset_ssh_keypair.py b/test/integration/component/test_reset_ssh_keypair.py
index a2e743a..db7e9b8 100644
--- a/test/integration/component/test_reset_ssh_keypair.py
+++ b/test/integration/component/test_reset_ssh_keypair.py
@@ -200,6 +200,9 @@ class TestResetSSHKeypair(cloudstackTestCase):
for c in cmds:
ssh.execute(c)
+ # Adding delay of 120 sec to avoid data loss due to timing issue
+ time.sleep(120)
+
#Stop virtual machine
cls.virtual_machine.stop(cls.api_client)
@@ -1031,6 +1034,9 @@ class TestResetSSHKeyUserRights(cloudstackTestCase):
for c in cmds:
ssh.execute(c)
+ # Adding delay of 120 sec to avoid data loss due to timing issue
+ time.sleep(120)
+
try:
#Stop virtual machine
cls.virtual_machine.stop(cls.api_client)
[3/3] git commit: updated refs/heads/4.5 to b8184d1
Posted by ta...@apache.org.
CLOUDSTACK-8149: Code-refactor - test_VirtualRouter_alerts.py
Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b8184d1e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b8184d1e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b8184d1e
Branch: refs/heads/4.5
Commit: b8184d1e74609b0803d234ffb181525c48d28029
Parents: 032a003
Author: Ashutosh K <as...@clogeny.com>
Authored: Mon Jan 12 18:47:29 2015 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Tue Jan 13 15:22:22 2015 +0530
----------------------------------------------------------------------
.../component/test_VirtualRouter_alerts.py | 187 +++++++------------
1 file changed, 70 insertions(+), 117 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8184d1e/test/integration/component/test_VirtualRouter_alerts.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_VirtualRouter_alerts.py b/test/integration/component/test_VirtualRouter_alerts.py
index bff12f9..91a4fcf 100644
--- a/test/integration/component/test_VirtualRouter_alerts.py
+++ b/test/integration/component/test_VirtualRouter_alerts.py
@@ -16,13 +16,20 @@
# under the License.
""" P1 tests for alert receiving from VR on service failure in VR
"""
-#Import Local Modules
-import marvin
-from marvin.cloudstackTestCase import *
-from marvin.cloudstackAPI import *
-from marvin.lib.utils import *
-from marvin.lib.base import *
-from marvin.lib.common import *
+# Import Local Modules
+# import marvin
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.lib.utils import (get_process_status,
+ cleanup_resources)
+from marvin.lib.base import (Account,
+ ServiceOffering,
+ VirtualMachine)
+
+from marvin.lib.common import (list_hosts,
+ list_routers,
+ get_zone,
+ get_domain,
+ get_template)
from nose.plugins.attrib import attr
from marvin.codes import FAILED
import time
@@ -30,76 +37,16 @@ import time
_multiprocess_shared_ = True
-class Services:
- """Test VM Life Cycle Services
- """
-
- def __init__(self):
- self.services = {
-
- "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",
- },
- "small":
- # Create a small virtual machine instance with disk offering
- {
- "displayname": "testserver",
- "username": "root", # VM creds for SSH
- "password": "password",
- "ssh_port": 22,
- "hypervisor": 'XenServer',
- "privateport": 22,
- "publicport": 22,
- "protocol": 'TCP',
- },
- "service_offerings":
- {
- "small":
- {
- # Small service offering ID to for change VM
- # service offering from medium to small
- "name": "SmallInstance",
- "displaytext": "SmallInstance",
- "cpunumber": 1,
- "cpuspeed": 100,
- "memory": 256,
- },
- "big":
- {
- # Big service offering ID to for change VM
- "name": "BigInstance",
- "displaytext": "BigInstance",
- "cpunumber": 1,
- "cpuspeed": 100,
- "memory": 512,
- }
- },
- #Change this
- "template": {
- "displaytext": "xs",
- "name": "xs",
- "passwordenabled": False,
- },
- "sleep": 60,
- "timeout": 10,
- #Migrate VM to hostid
- "ostype": 'CentOS 5.3 (64-bit)',
- # CentOS 5.3 (64-bit)
- }
-
class TestVRServiceFailureAlerting(cloudstackTestCase):
+
@classmethod
def setUpClass(cls):
- cls.testClient = super(TestVRServiceFailureAlerting, cls).getClsTestClient()
+ cls.testClient = super(
+ TestVRServiceFailureAlerting,
+ cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
- cls.services = Services().services
+ cls.services = cls.testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
@@ -113,7 +60,8 @@ class TestVRServiceFailureAlerting(cloudstackTestCase):
)
if template == FAILED:
- assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
+ assert False, "get_template() failed to return template with \
+ description %s" % cls.services["ostype"]
# Set Zones and disk offerings ??
cls.services["small"]["zoneid"] = cls.zone.id
cls.services["small"]["template"] = template.id
@@ -130,7 +78,7 @@ class TestVRServiceFailureAlerting(cloudstackTestCase):
cls.services["service_offerings"]["small"]
)
- #create a virtual machine
+ # create a virtual machine
cls.virtual_machine = VirtualMachine.create(
cls.api_client,
cls.services["small"],
@@ -146,7 +94,9 @@ class TestVRServiceFailureAlerting(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
- cls.api_client = super(TestVRServiceFailureAlerting, cls).getClsTestClient().getApiClient()
+ cls.api_client = super(
+ TestVRServiceFailureAlerting,
+ cls).getClsTestClient().getApiClient()
cleanup_resources(cls.api_client, cls._cleanup)
return
@@ -157,7 +107,7 @@ class TestVRServiceFailureAlerting(cloudstackTestCase):
self.cleanup = []
def tearDown(self):
- #Clean up, terminate the created ISOs
+ # Clean up, terminate the created ISOs
cleanup_resources(self.apiclient, self.cleanup)
return
@@ -165,7 +115,6 @@ class TestVRServiceFailureAlerting(cloudstackTestCase):
@attr(tags=["advanced", "basic"])
def test_01_VRServiceFailureAlerting(self):
-
if self.zone.networktype == "Basic":
list_router_response = list_routers(
self.apiclient,
@@ -184,67 +133,71 @@ class TestVRServiceFailureAlerting(cloudstackTestCase):
)
router = list_router_response[0]
- hosts = list_hosts(
- self.apiclient,
- zoneid=router.zoneid,
- type='Routing',
- state='Up',
- id=router.hostid
- )
- self.assertEqual(
- isinstance(hosts, list),
- True,
- "Check list host returns a valid list"
- )
- host = hosts[0]
-
self.debug("Router ID: %s, state: %s" % (router.id, router.state))
self.assertEqual(
- router.state,
- 'Running',
- "Check list router response for router state"
+ router.state,
+ 'Running',
+ "Check list router response for router state"
)
alertSubject = "Monitoring Service on VR " + router.name
if self.hypervisor.lower() in ('vmware', 'hyperv'):
result = get_process_status(
- self.apiclient.connection.mgtSvr,
- 22,
- self.apiclient.connection.user,
- self.apiclient.connection.passwd,
- router.linklocalip,
- "service dnsmasq status",
- hypervisor=self.hypervisor
- )
+ self.apiclient.connection.mgtSvr,
+ 22,
+ self.apiclient.connection.user,
+ self.apiclient.connection.passwd,
+ router.linklocalip,
+ "service dnsmasq status",
+ hypervisor=self.hypervisor
+ )
else:
try:
- host.user, host.passwd = get_host_credentials(self.config, host.ipaddress)
+ hosts = list_hosts(
+ self.apiclient,
+ zoneid=router.zoneid,
+ type='Routing',
+ state='Up',
+ id=router.hostid
+ )
+
+ self.assertEqual(
+ isinstance(hosts, list),
+ True,
+ "Check list host returns a valid list"
+ )
+
+ host = hosts[0]
result = get_process_status(
- host.ipaddress,
- 22,
- host.user,
- host.passwd,
- router.linklocalip,
- "service apache2 stop"
- )
- except KeyError:
- self.skipTest("Marvin configuration has no host credentials to check router services")
+ host.ipaddress,
+ 22,
+ self.services["configurableData"]["host"]["username"],
+ self.services["configurableData"]["host"]["password"],
+ router.linklocalip,
+ "service apache2 stop"
+ )
+
+ except Exception as e:
+ raise Exception("Exception raised in getting host\
+ credentials: %s " % e)
res = str(result)
self.debug("apache process status: %s" % res)
- time.sleep(2400) #wait for 40 minutes meanwhile monitor service on VR starts the apache service (router.alerts.check.interval default value is 30minutes)
+ time.sleep(2400)
+ # wait for 40 minutes meanwhile monitor service on
+ # VR starts the apache service (
+ # router.alerts.check.interval default value is
+ # 30minutes)
qresultset = self.dbclient.execute(
- "select id from alert where subject = '%s' ORDER BY id DESC LIMIT 1;" \
- % str(alertSubject)
- )
+ "select id from alert where subject = '%s' ORDER BY id DESC LIMIT 1;" %
+ str(alertSubject))
self.assertNotEqual(
len(qresultset),
0,
"Check DB Query result set"
)
-
return
[2/3] git commit: updated refs/heads/4.5 to b8184d1
Posted by ta...@apache.org.
CLOUDSTACK-8147: Fixed typo in test case test_redundant_router.py
Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/032a0039
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/032a0039
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/032a0039
Branch: refs/heads/4.5
Commit: 032a00390561005dabdaa840c8ae8b36d136ccbd
Parents: 9278ac1
Author: Ashutosh K <as...@clogeny.com>
Authored: Mon Jan 12 18:11:20 2015 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Tue Jan 13 15:22:15 2015 +0530
----------------------------------------------------------------------
test/integration/component/maint/test_redundant_router.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/032a0039/test/integration/component/maint/test_redundant_router.py
----------------------------------------------------------------------
diff --git a/test/integration/component/maint/test_redundant_router.py b/test/integration/component/maint/test_redundant_router.py
index 01d635b..98b0bae 100644
--- a/test/integration/component/maint/test_redundant_router.py
+++ b/test/integration/component/maint/test_redundant_router.py
@@ -787,7 +787,7 @@ class TestRVRInternals(cloudstackTestCase):
self.apiclient.connection.mgtSvr,
22,
self.apiclient.connection.user,
- self.apiclient.connction.passwd,
+ self.apiclient.connection.passwd,
backup_router.linklocalip,
'ip addr show eth2',
hypervisor=self.hypervisor