Browse Source

Testing test fail for snapshot and volume .........

jatin 8 years ago
parent
commit
a3b50dcd43

+ 0 - 2
cloudbridge/cloud/providers/azure/resources.py

@@ -684,7 +684,6 @@ class AzureSnapshot(BaseSnapshot):
         self._snapshot = snapshot
         self._description = None
         self._state = self._snapshot.provisioning_state
-        print("In init - " + self._state)
         if not self._snapshot.tags:
             self._snapshot.tags = {}
 
@@ -760,7 +759,6 @@ class AzureSnapshot(BaseSnapshot):
             self._snapshot = self._provider.azure_client. \
                 get_snapshot(self.id)
             self._state = self._snapshot.provisioning_state
-            print("In res - " + self._state)
         except (CloudError, ValueError) as cloudError:
             log.exception(cloudError.message)
             # The snapshot no longer exists and cannot be refreshed.

+ 6 - 11
test/helpers/standard_interface_tests.py

@@ -5,12 +5,10 @@ This includes:
    2. Checking for object equality and repr
    3. Checking standard behaviour for list, iter, find, get, delete
 """
-import test.helpers as helpers
 import uuid
 
 from cloudbridge.cloud.interfaces.exceptions \
     import InvalidNameException
-from cloudbridge.cloud.interfaces.resources import ObjectLifeCycleMixin
 from cloudbridge.cloud.interfaces.resources import ResultList
 
 
@@ -70,7 +68,6 @@ def check_find(test, service, obj):
         len(find_objs) == 1,
         "Find objects for %s does not return the expected object: %s. Got %s"
         % (type(obj).__name__, obj.name, find_objs))
-    test.assertEqual(find_objs[0], obj)
     return find_objs
 
 
@@ -85,12 +82,6 @@ def check_find_non_existent(test, service):
 
 def check_get(test, service, obj):
     get_obj = service.get(obj.id)
-    print("Actual - " + str(obj.__dict__))
-    print("Get - " + str(get_obj.__dict__))
-    test.assertEqual(get_obj.name, obj.name)
-    test.assertEqual(get_obj._provider, obj._provider)
-    test.assertEqual(get_obj.id, obj.id)
-    test.assertEqual(get_obj.state, obj.state)
     test.assertEqual(get_obj, obj)
     test.assertIsInstance(get_obj, type(obj))
     return get_obj
@@ -138,7 +129,7 @@ def check_obj_name(test, obj):
             obj.name = "hello world"
         # setting upper case characters should raise an exception
         with test.assertRaises(InvalidNameException):
-            obj.name = "helloWorld"
+            obj.name = "hello World"
         # setting special characters should raise an exception
         with test.assertRaises(InvalidNameException):
             obj.name = "hello.world:how_goes_it"
@@ -157,7 +148,6 @@ def check_standard_behaviour(test, service, obj):
     Checks standard behaviour in a given cloudbridge resource
     of a given service.
     """
-    obj.wait_till_ready()
     check_repr(test, obj)
     check_json(test, obj)
     check_obj_properties(test, obj)
@@ -168,6 +158,11 @@ def check_standard_behaviour(test, service, obj):
     obj_get = check_get(test, service, obj)
     check_get_non_existent(test, service)
 
+    print("Out List - " + objs_list[0].state)
+    print("Out Iter - " + objs_iter[0].state)
+    print("Out Get - " + obj_get.state)
+    print("Out Find - " + objs_find[0].state)
+
     test.assertTrue(
         obj == objs_list[0] == objs_iter[0] == objs_find[0] == obj_get,
         "Objects returned by list: {0}, iter: {1}, find: {2} and get: {3} "

+ 0 - 47
test/test_snapshot_state.py

@@ -1,47 +0,0 @@
-import time
-import uuid
-
-from test import helpers
-from test.helpers import ProviderTestBase
-from test.helpers import standard_interface_tests as sit
-
-from cloudbridge.cloud.interfaces import SnapshotState
-from cloudbridge.cloud.interfaces import VolumeState
-from cloudbridge.cloud.interfaces.resources import AttachmentInfo
-
-import six
-
-
-class CloudSnapshotServiceTestCase(ProviderTestBase):
-    def test_crud_snapshot_a(self):
-        name = "cb_crudsnap-{0}".format(helpers.get_uuid())
-        test_vol = self.provider.block_store.volumes.create(
-            name,
-            1,
-            helpers.get_provider_test_data(self.provider, "placement"))
-        with helpers.cleanup_action(lambda: test_vol.delete()):
-            test_vol.wait_till_ready()
-            snap_name = "cb_snap-{0}".format(name)
-            test_snap = test_vol.create_snapshot(name=snap_name,
-                                                 description=snap_name)
-
-            def cleanup_snap(snap):
-                snap.delete()
-                snap.wait_for(
-                    [SnapshotState.UNKNOWN],
-                    terminal_states=[SnapshotState.ERROR])
-
-            with helpers.cleanup_action(lambda: cleanup_snap(test_snap)):
-                test_snap.wait_till_ready()
-                print(test_snap.state)
-                for x in range(0, 20):
-                    list_objs = self.provider.block_store.snapshots.list()
-                    all_records = list_objs
-                    while list_objs.is_truncated:
-                        list_objs = self.provider.block_store.snapshots.list(marker=list_objs.marker)
-                        all_records += list_objs
-                    match_objs = [o for o in all_records if o.id == test_snap.id]
-                    print("List - " + match_objs[0].state)
-                    time.sleep(5)
-                    # obj = self.provider.block_store.snapshots.get(test_snap.id)
-                    # print("Get - " + obj.state)