cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject [2/2] git commit: updated refs/heads/4.2 to a14a9c1
Date Thu, 04 Jul 2013 14:46:06 GMT
move isAlmostEqual to utils

Signed-off-by: Prasanna Santhanam <tsp@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 <tsp@apache.org>
Authored: Thu Jul 4 20:14:03 2013 +0530
Committer: Prasanna Santhanam <tsp@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


Mime
View raw message