2
0
Эх сурвалжийг харах

Fixed azure router issue and added more tests

Nuwan Goonasekera 7 жил өмнө
parent
commit
b320d0b45f

+ 3 - 5
cloudbridge/cloud/providers/azure/services.py

@@ -421,12 +421,10 @@ class AzureSnapshotService(BaseSnapshotService):
                 'create_option': DiskCreateOption.copy,
                 'source_uri': volume.resource_id
             },
-            'disk_size_gb': volume.size
+            'disk_size_gb': volume.size,
+            'tags': tags
         }
 
-        if tags:
-            params.update(tags=tags)
-
         azure_snap = self.provider.azure_client.create_snapshot(snapshot_name,
                                                                 params)
         return AzureSnapshot(self.provider, azure_snap)
@@ -1101,7 +1099,7 @@ class AzureRouterService(BaseRouterService):
         router_name = AzureRouter._generate_name_from_label(label, "cb-router")
 
         parameters = {"location": self.provider.region_name,
-                      "Label": label}
+                      "tags": {'Label': label}}
 
         route = self.provider.azure_client. \
             create_route_table(router_name, parameters)

+ 5 - 0
test/helpers/standard_interface_tests.py

@@ -143,8 +143,13 @@ def check_obj_label(test, obj):
     if isinstance(label_property, property):
         test.assertIsInstance(obj, LabeledCloudResource)
         original_label = obj.label
+        # Three character labels should be allowed
+        obj.label = "abc"
         VALID_LABEL = u"hello-world-123"
         obj.label = VALID_LABEL
+        # Two character labels should not be allowed
+        with test.assertRaises(InvalidLabelException):
+            obj.label = "ab"
         # A none value should not be allowed
         with test.assertRaises(InvalidLabelException):
             obj.label = None