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/04 16:46:05 UTC
[1/2] git commit: updated refs/heads/4.2 to a14a9c1
Updated Branches:
refs/heads/4.2 5a57e82ea -> a14a9c192
CLOUDSTACK-2884: Fixed test_04_change_offering_small
Added method to compare if two digits are almost equal within given range
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
(cherry picked from commit 048cf5aae84786d2d3515a3199271e87c0c7bafb)
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ee9e7230
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ee9e7230
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ee9e7230
Branch: refs/heads/4.2
Commit: ee9e7230222e9f63c617a2a7be1f39232f37562e
Parents: 5a57e82
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Wed Jul 3 23:37:52 2013 -0400
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Thu Jul 4 20:15:21 2013 +0530
----------------------------------------------------------------------
.../integration/smoke/test_service_offerings.py | 23 +++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee9e7230/test/integration/smoke/test_service_offerings.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_service_offerings.py b/test/integration/smoke/test_service_offerings.py
index 0213c04..8b6b013 100644
--- a/test/integration/smoke/test_service_offerings.py
+++ b/test/integration/smoke/test_service_offerings.py
@@ -273,6 +273,21 @@ class TestServiceOfferings(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e)
return
+ def isAlmostEqual(self, first_digit, second_digit, range=0):
+
+ digits_equal_within_range = False
+
+ try:
+ if ((first_digit - range) < second_digit < (first_digit + range)):
+ digits_equal_within_range = True
+
+ except Exception as e:
+ self.fail(
+ "%s: Failed while comparing the numbers %s & %s" %
+ (e, first_digit, second_digit))
+
+ return digits_equal_within_range
+
@attr(tags=["advanced", "advancedns", "smoke", "basic", "eip", "sg"])
def test_02_edit_service_offering(self):
"""Test to update existing service offering"""
@@ -431,9 +446,11 @@ class TestServiceOfferings(cloudstackTestCase):
self.small_offering.cpuspeed,
"Check CPU Speed for small offering"
)
- self.assertAlmostEqual(
- int(total_mem) / 1024, # In MBs
- int(self.small_offering.memory),
+ self.assertTrue(
+ self.isAlmostEqual(int(int(total_mem)/1024),
+ int(self.small_offering.memory),
+ range=20
+ ),
"Check Memory(kb) for small offering"
)
return
[2/2] git commit: updated refs/heads/4.2 to a14a9c1
Posted by ts...@apache.org.
move isAlmostEqual to utils
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
(cherry picked from commit da9552b7f31149e051c5345fbeb0d4858636536e)
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a14a9c19
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a14a9c19
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a14a9c19
Branch: refs/heads/4.2
Commit: a14a9c1926802d2b6d4de0a07aa46c3309367a01
Parents: ee9e723
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Thu Jul 4 20:14:03 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Thu Jul 4 20:15:31 2013 +0530
----------------------------------------------------------------------
.../integration/smoke/test_service_offerings.py | 25 ++----
tools/marvin/marvin/integration/lib/utils.py | 87 ++++++++++++--------
2 files changed, 56 insertions(+), 56 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a14a9c19/test/integration/smoke/test_service_offerings.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_service_offerings.py b/test/integration/smoke/test_service_offerings.py
index 8b6b013..22273d7 100644
--- a/test/integration/smoke/test_service_offerings.py
+++ b/test/integration/smoke/test_service_offerings.py
@@ -20,7 +20,7 @@
import marvin
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
-from marvin.integration.lib.utils import *
+from marvin.integration.lib.utils import isAlmostEqual
from marvin.integration.lib.base import *
from marvin.integration.lib.common import *
from nose.plugins.attrib import attr
@@ -273,21 +273,6 @@ class TestServiceOfferings(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e)
return
- def isAlmostEqual(self, first_digit, second_digit, range=0):
-
- digits_equal_within_range = False
-
- try:
- if ((first_digit - range) < second_digit < (first_digit + range)):
- digits_equal_within_range = True
-
- except Exception as e:
- self.fail(
- "%s: Failed while comparing the numbers %s & %s" %
- (e, first_digit, second_digit))
-
- return digits_equal_within_range
-
@attr(tags=["advanced", "advancedns", "smoke", "basic", "eip", "sg"])
def test_02_edit_service_offering(self):
"""Test to update existing service offering"""
@@ -447,10 +432,10 @@ class TestServiceOfferings(cloudstackTestCase):
"Check CPU Speed for small offering"
)
self.assertTrue(
- self.isAlmostEqual(int(int(total_mem)/1024),
- int(self.small_offering.memory),
- range=20
- ),
+ isAlmostEqual(int(int(total_mem) / 1024),
+ int(self.small_offering.memory),
+ range=20
+ ),
"Check Memory(kb) for small offering"
)
return
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a14a9c19/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 839ec89..9ab199a 100644
--- a/tools/marvin/marvin/integration/lib/utils.py
+++ b/tools/marvin/marvin/integration/lib/utils.py
@@ -35,11 +35,11 @@ def restart_mgmt_server(server):
try:
# Get the SSH client
ssh = is_server_ssh_ready(
- server["ipaddress"],
- server["port"],
- server["username"],
- server["password"],
- )
+ server["ipaddress"],
+ server["port"],
+ server["username"],
+ server["password"],
+ )
result = ssh.execute("/etc/init.d/cloud-management restart")
res = str(result)
# Server Stop - OK
@@ -57,21 +57,21 @@ def fetch_latest_mail(services, from_mail):
# Login to mail server to verify email
mail = imaplib.IMAP4_SSL(services["server"])
mail.login(
- services["email"],
- services["password"]
- )
+ services["email"],
+ services["password"]
+ )
mail.list()
mail.select(services["folder"])
date = (datetime.date.today() - datetime.timedelta(1)).strftime("%d-%b-%Y")
result, data = mail.uid(
- 'search',
- None,
- '(SENTSINCE {date} HEADER FROM "{mail}")'.format(
- date=date,
- mail=from_mail
- )
- )
+ 'search',
+ None,
+ '(SENTSINCE {date} HEADER FROM "{mail}")'.format(
+ date=date,
+ mail=from_mail
+ )
+ )
# Return False if email is not present
if data == []:
return False
@@ -112,11 +112,11 @@ def is_server_ssh_ready(ipaddress, port, username, password, retries=50, keyPair
while True:
try:
ssh = remoteSSHClient(
- host=ipaddress,
- port=port,
- user=username,
- passwd=password,
- keyPairFileLocation=keyPairFileLocation)
+ host=ipaddress,
+ port=port,
+ user=username,
+ passwd=password,
+ keyPairFileLocation=keyPairFileLocation)
except Exception as e:
if loop_cnt == 0:
raise e
@@ -129,9 +129,9 @@ def is_server_ssh_ready(ipaddress, port, username, password, retries=50, keyPair
def format_volume_to_ext3(ssh_client, device="/dev/sda"):
"""Format attached storage to ext3 fs"""
cmds = [
- "echo -e 'n\np\n1\n\n\nw' | fdisk %s" % device,
- "mkfs.ext3 %s1" % device,
- ]
+ "echo -e 'n\np\n1\n\n\nw' | fdisk %s" % device,
+ "mkfs.ext3 %s1" % device,
+ ]
for c in cmds:
ssh_client.execute(c)
@@ -143,15 +143,15 @@ def fetch_api_client(config_file='datacenterCfg'):
testClientLogger = logging.getLogger("testClient")
asyncTimeout = 3600
return cloudstackAPIClient.CloudStackAPIClient(
- marvin.cloudstackConnection.cloudConnection(
- mgt.mgtSvrIp,
- mgt.port,
- mgt.apiKey,
- mgt.securityKey,
- asyncTimeout,
- testClientLogger
- )
- )
+ marvin.cloudstackConnection.cloudConnection(
+ mgt.mgtSvrIp,
+ mgt.port,
+ mgt.apiKey,
+ mgt.securityKey,
+ asyncTimeout,
+ testClientLogger
+ )
+ )
def get_process_status(hostip, port, username, password, linklocalip, process, hypervisor=None):
@@ -164,10 +164,10 @@ def get_process_status(hostip, port, username, password, linklocalip, process, h
else:
ssh_command = "ssh -i ~/.ssh/id_rsa.cloud -ostricthostkeychecking=no "
- ssh_command = ssh_command + \
- "-oUserKnownHostsFile=/dev/null -p 3922 %s %s" % (
- linklocalip,
- process)
+ ssh_command = ssh_command +\
+ "-oUserKnownHostsFile=/dev/null -p 3922 %s %s" % (
+ linklocalip,
+ process)
# Double hop into router
timeout = 5
@@ -183,3 +183,18 @@ def get_process_status(hostip, port, username, password, linklocalip, process, h
time.sleep(5)
timeout = timeout - 1
return res
+
+
+def isAlmostEqual(self, first_digit, second_digit, range=0):
+ digits_equal_within_range = False
+
+ try:
+ if ((first_digit - range) < second_digit < (first_digit + range)):
+ digits_equal_within_range = True
+
+ except Exception as e:
+ self.fail(
+ "%s: Failed while comparing the numbers %s & %s" %
+ (e, first_digit, second_digit))
+
+ return digits_equal_within_range