cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject [1/2] git commit: updated refs/heads/master-6-17-stable to d1ce66e
Date Thu, 04 Jul 2013 14:46:27 GMT
Updated Branches:
  refs/heads/master-6-17-stable 45ef73e50 -> d1ce66e34


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 <tsp@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/05173a68
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/05173a68
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/05173a68

Branch: refs/heads/master-6-17-stable
Commit: 05173a68892d28ae6c0854c981c6248a79ac8e0b
Parents: 45ef73e
Author: Gaurav Aradhye <gaurav.aradhye@clogeny.com>
Authored: Wed Jul 3 23:37:52 2013 -0400
Committer: Prasanna Santhanam <tsp@apache.org>
Committed: Thu Jul 4 20:15:52 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/05173a68/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


Mime
View raw message