Repository: libcloud
Updated Branches:
  refs/heads/trunk 4d0f9e0a6 -> 0310ba9ed


Add a test that would fail without the fix

Signed-off-by: Quentin Pradet <quent...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/fca9f833
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/fca9f833
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/fca9f833

Branch: refs/heads/trunk
Commit: fca9f833deffb3c22048063efa610221421976fb
Parents: d04f8d6
Author: Boris Chazalet <bchaza...@companywatch.net>
Authored: Fri Mar 9 11:26:44 2018 +0100
Committer: Quentin Pradet <quent...@apache.org>
Committed: Sat Mar 10 08:27:06 2018 +0400

----------------------------------------------------------------------
 ...tes_my_instance_template_shared_network.json |  4 ++--
 ..._global_networks_shared_network_for_mig.json | 11 +++++++++
 ...1_subnetworks_shared_subnetwork_for_mig.json | 12 ++++++++++
 ...Managers_myinstancegroup_shared_network.json | 24 ++++++++++++++++++++
 ...nceGroup_myinstancegroup_shared_network.json | 14 ++++++++++++
 libcloud/test/compute/test_gce.py               | 24 +++++++++++++++++++-
 6 files changed, 86 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/fca9f833/libcloud/test/compute/fixtures/gce/global_instanceTemplates_my_instance_template_shared_network.json
----------------------------------------------------------------------
diff --git 
a/libcloud/test/compute/fixtures/gce/global_instanceTemplates_my_instance_template_shared_network.json
 
b/libcloud/test/compute/fixtures/gce/global_instanceTemplates_my_instance_template_shared_network.json
index e2a97cd..6795998 100644
--- 
a/libcloud/test/compute/fixtures/gce/global_instanceTemplates_my_instance_template_shared_network.json
+++ 
b/libcloud/test/compute/fixtures/gce/global_instanceTemplates_my_instance_template_shared_network.json
@@ -35,8 +35,8 @@
                         "type": "ONE_TO_ONE_NAT"
                     }
                 ],
-                "network": 
"https://www.googleapis.com/compute/v1/projects/other_name/global/networks/cf";,
-                "subnetwork": 
"https://www.googleapis.com/compute/v1/projects/other_name/regions/us-central1/subnetworks/cf-972cf02e6ad49112";
+                "network": 
"https://www.googleapis.com/compute/v1/projects/other_name/global/networks/shared_network_for_mig";,
+                "subnetwork": 
"https://www.googleapis.com/compute/v1/projects/other_name/regions/us-central1/subnetworks/shared_subnetwork_for_mig";
             }
         ],
         "scheduling": {

http://git-wip-us.apache.org/repos/asf/libcloud/blob/fca9f833/libcloud/test/compute/fixtures/gce/projects_other_name_global_networks_shared_network_for_mig.json
----------------------------------------------------------------------
diff --git 
a/libcloud/test/compute/fixtures/gce/projects_other_name_global_networks_shared_network_for_mig.json
 
b/libcloud/test/compute/fixtures/gce/projects_other_name_global_networks_shared_network_for_mig.json
new file mode 100644
index 0000000..ca8c68c
--- /dev/null
+++ 
b/libcloud/test/compute/fixtures/gce/projects_other_name_global_networks_shared_network_for_mig.json
@@ -0,0 +1,11 @@
+{
+ "kind": "compute#network",
+ "id": "5125152985904090796",
+ "creationTimestamp": "2016-03-25T05:34:15.077-07:00",
+ "name": "shared_network_for_mig",
+ "selfLink": 
"https://www.googleapis.com/compute/v1/projects/other_name/global/networks/shared_network_for_mig";,
+ "autoCreateSubnetworks": true,
+ "subnetworks": [
+  
"https://www.googleapis.com/compute/v1/projects/other_name/regions/us-central1/subnetworks/shared_subnetwork_for_mig";
+ ]
+}

http://git-wip-us.apache.org/repos/asf/libcloud/blob/fca9f833/libcloud/test/compute/fixtures/gce/projects_other_name_regions_us-central1_subnetworks_shared_subnetwork_for_mig.json
----------------------------------------------------------------------
diff --git 
a/libcloud/test/compute/fixtures/gce/projects_other_name_regions_us-central1_subnetworks_shared_subnetwork_for_mig.json
 
b/libcloud/test/compute/fixtures/gce/projects_other_name_regions_us-central1_subnetworks_shared_subnetwork_for_mig.json
new file mode 100644
index 0000000..d7ec3ba
--- /dev/null
+++ 
b/libcloud/test/compute/fixtures/gce/projects_other_name_regions_us-central1_subnetworks_shared_subnetwork_for_mig.json
@@ -0,0 +1,12 @@
+{
+ "status": "DONE",
+ "kind": "compute#subnetwork",
+ "id": "4297043163355844289",
+ "creationTimestamp": "2016-03-25T05:34:27.209-07:00",
+ "gatewayAddress": "10.128.0.1",
+ "name": "shared_subnetwork_for_mig",
+ "network": 
"https://www.googleapis.com/compute/v1/projects/other_name/global/networks/shared_network_for_mig";,
+ "ipCidrRange": "10.128.0.0/20",
+ "region": 
"https://www.googleapis.com/compute/v1/projects/other_name/regions/us-central1";,
+ "selfLink": 
"https://www.googleapis.com/compute/v1/projects/other_name/regions/us-central1/subnetworks/shared_subnetwork_for_mig";
+}

http://git-wip-us.apache.org/repos/asf/libcloud/blob/fca9f833/libcloud/test/compute/fixtures/gce/zones_us-central1-a_instanceGroupManagers_myinstancegroup_shared_network.json
----------------------------------------------------------------------
diff --git 
a/libcloud/test/compute/fixtures/gce/zones_us-central1-a_instanceGroupManagers_myinstancegroup_shared_network.json
 
b/libcloud/test/compute/fixtures/gce/zones_us-central1-a_instanceGroupManagers_myinstancegroup_shared_network.json
new file mode 100644
index 0000000..61ec675
--- /dev/null
+++ 
b/libcloud/test/compute/fixtures/gce/zones_us-central1-a_instanceGroupManagers_myinstancegroup_shared_network.json
@@ -0,0 +1,24 @@
+{
+
+    "kind": "compute#instanceGroupManager",
+    "id": "8604381270851510465",
+    "creationTimestamp": "2016-07-18T15:54:39.153-07:00",
+    "zone": 
"https://content.googleapis.com/compute/v1/projects/project_name/zones/us-central1-a";,
+    "name": "myinstancegroup-shared-network",
+    "description": "my description for myinstancegroup",
+    "instanceTemplate": 
"https://content.googleapis.com/compute/v1/projects/project_name/global/instanceTemplates/my-instance-template-shared-network";,
+    "instanceGroup": 
"https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central1-a/instanceGroups/myinstancegroup-shared-network";,
+    "baseInstanceName": "base-foo",
+    "fingerprint": "Q21hYveq9do=",
+    "currentActions": {
+       "none": 4,
+       "creating": 0,
+       "recreating": 0,
+       "deleting": 0,
+       "abandoning": 0,
+       "restarting": 0,
+       "refreshing": 0
+    },
+    "targetSize": 4,
+    "selfLink": 
"https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central1-a/instanceGroupManagers/myinstancegroup-shared-network";
+}

http://git-wip-us.apache.org/repos/asf/libcloud/blob/fca9f833/libcloud/test/compute/fixtures/gce/zones_us-central1-a_instanceGroup_myinstancegroup_shared_network.json
----------------------------------------------------------------------
diff --git 
a/libcloud/test/compute/fixtures/gce/zones_us-central1-a_instanceGroup_myinstancegroup_shared_network.json
 
b/libcloud/test/compute/fixtures/gce/zones_us-central1-a_instanceGroup_myinstancegroup_shared_network.json
new file mode 100644
index 0000000..1a0592f
--- /dev/null
+++ 
b/libcloud/test/compute/fixtures/gce/zones_us-central1-a_instanceGroup_myinstancegroup_shared_network.json
@@ -0,0 +1,14 @@
+{
+
+    "kind": "compute#instanceGroup",
+    "id": "1968709502073089770",
+    "creationTimestamp": "2016-08-11T16:53:42.413-07:00",
+    "zone": 
"https://content.googleapis.com/compute/v1/projects/project_name/zones/us-central1-a";,
+    "name": "myinstancegroup_shared_network",
+    "description": "This instance group is controlled by Instance Group 
Manager 'myinstancegroup'. To modify instances in this group, use the Instance 
Group Manager API: 
https://cloud.google.com/compute/docs/reference/latest/instanceGroupManagers";,
+    "network": 
"https://www.googleapis.com/compute/v1/projects/other_name/global/networks/shared_network_for_mig";,
+    "subnetwork": 
"https://www.googleapis.com/compute/v1/projects/other_name/regions/us-central1/subnetworks/shared_subnetwork_for_mig";,
+    "fingerprint": "42WmSpB8rSM=",
+    "selfLink": 
"https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central1-a/instanceGroups/myinstancegroup_shared_network";,
+    "size": 4
+}

http://git-wip-us.apache.org/repos/asf/libcloud/blob/fca9f833/libcloud/test/compute/test_gce.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_gce.py 
b/libcloud/test/compute/test_gce.py
index ab92693..35aa4d8 100644
--- a/libcloud/test/compute/test_gce.py
+++ b/libcloud/test/compute/test_gce.py
@@ -462,7 +462,7 @@ class GCENodeDriverTest(GoogleTestCase, TestCaseMixin):
         self.assertEqual(mig.zone.name, zone)
 
     def test_ex_create_instancegroupmanager_shared_network(self):
-        name = 'myinstancegroup'
+        name = 'myinstancegroup-shared-network'
         zone = 'us-central1-a'
         size = 4
         template_name = 'my-instance-template-shared-network'
@@ -2707,12 +2707,22 @@ class GCEMockHttp(MockHttp):
         body = 
self.fixtures.load('projects_other_name_global_networks_cf.json')
         return (httplib.OK, body, self.json_hdr, httplib.responses[httplib.OK])
 
+    def _projects_other_name_global_networks_shared_network_for_mig(self, 
method, url, body, headers):
+        body = 
self.fixtures.load('projects_other_name_global_networks_shared_network_for_mig.json')
+        return (httplib.OK, body, self.json_hdr, httplib.responses[httplib.OK])
+
     def 
_projects_other_name_regions_us_central1_subnetworks_cf_972cf02e6ad49114(
             self, method, url, body, headers):
         body = self.fixtures.load(
             
'projects_other_name_regions_us-central1_subnetworks_cf_972cf02e6ad49114.json')
         return (httplib.OK, body, self.json_hdr, httplib.responses[httplib.OK])
 
+    def 
_projects_other_name_regions_us_central1_subnetworks_shared_subnetwork_for_mig(
+            self, method, url, body, headers):
+        body = self.fixtures.load(
+            
'projects_other_name_regions_us-central1_subnetworks_shared_subnetwork_for_mig.json')
+        return (httplib.OK, body, self.json_hdr, httplib.responses[httplib.OK])
+
     def 
_regions_us_central1_operations_operation_regions_us_central1_addresses_lcaddress_delete(
             self, method, url, body, headers):
         body = self.fixtures.load(
@@ -3497,12 +3507,24 @@ class GCEMockHttp(MockHttp):
             'zones_us-east1-b_instanceGroup_myinstancegroup.json')
         return (httplib.OK, body, self.json_hdr, httplib.responses[httplib.OK])
 
+    def _zones_us_central1_a_instanceGroups_myinstancegroup_shared_network(
+            self, method, url, body, headers):
+        body = self.fixtures.load(
+            
'zones_us-central1-a_instanceGroup_myinstancegroup_shared_network.json')
+        return (httplib.OK, body, self.json_hdr, httplib.responses[httplib.OK])
+
     def _zones_us_central1_a_instanceGroupManagers_myinstancegroup(
             self, method, url, body, headers):
         body = self.fixtures.load(
             'zones_us-central1-a_instanceGroupManagers_myinstancegroup.json')
         return (httplib.OK, body, self.json_hdr, httplib.responses[httplib.OK])
 
+    def 
_zones_us_central1_a_instanceGroupManagers_myinstancegroup_shared_network(
+            self, method, url, body, headers):
+        body = self.fixtures.load(
+            
'zones_us-central1-a_instanceGroupManagers_myinstancegroup_shared_network.json')
+        return (httplib.OK, body, self.json_hdr, httplib.responses[httplib.OK])
+
     def _zones_us_central1_b_instanceGroupManagers_myinstancegroup(
             self, method, url, body, headers):
         body = self.fixtures.load(

Reply via email to