libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [02/10] git commit: GCE: add description parameter to ex_create_forwarding_rule, improve tests; fix documentation and test fixtures for health checks
Date Sat, 20 Sep 2014 20:19:34 GMT
GCE: add description parameter to ex_create_forwarding_rule, improve tests; fix documentation
and test fixtures for health checks

Signed-off-by: Tomaz Muraus <tomaz@apache.org>


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

Branch: refs/heads/trunk
Commit: 7fd9b3b3f7bfade226e831c8a29a2cbc4ccee97a
Parents: 951fb16
Author: Evgeny Egorochkin <phreedom@yandex.ru>
Authored: Wed Jul 2 06:50:26 2014 +0300
Committer: Tomaz Muraus <tomaz@apache.org>
Committed: Sat Sep 20 22:06:36 2014 +0200

----------------------------------------------------------------------
 libcloud/compute/drivers/gce.py                           | 10 ++++++++--
 .../compute/fixtures/gce/aggregated_forwardingRules.json  |  1 +
 .../compute/fixtures/gce/global_httpHealthChecks.json     |  1 +
 ...ions_us-central1_forwardingRules_lcforwardingrule.json |  1 +
 libcloud/test/compute/test_gce.py                         |  9 ++++++++-
 5 files changed, 19 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/7fd9b3b3/libcloud/compute/drivers/gce.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/gce.py b/libcloud/compute/drivers/gce.py
index f096637..6bcd8b2 100644
--- a/libcloud/compute/drivers/gce.py
+++ b/libcloud/compute/drivers/gce.py
@@ -977,7 +977,7 @@ class GCENodeDriver(NodeDriver):
         :type     healthy_threshold: ``int``
 
         :keyword  description: The description of the check.  Defaults to None.
-        :type     description: ``str``
+        :type     description: ``str`` or ``None``
 
         :return:  Health Check object
         :rtype:   :class:`GCEHealthCheck`
@@ -1072,7 +1072,7 @@ class GCENodeDriver(NodeDriver):
 
     def ex_create_forwarding_rule(self, name, targetpool, region=None,
                                   protocol='tcp', port_range=None,
-                                  address=None):
+                                  address=None, description=None):
         """
         Create a forwarding rule.
 
@@ -1097,6 +1097,10 @@ class GCENodeDriver(NodeDriver):
                            in same region.
         :type     address: ``str`` or :class:`GCEAddress`
 
+        :keyword  description: The description of the forwarding rule.
+                               Defaults to None.
+        :type     description: ``str`` or ``None``
+
         :return:  Forwarding Rule object
         :rtype:   :class:`GCEForwardingRule`
         """
@@ -1117,6 +1121,8 @@ class GCENodeDriver(NodeDriver):
             forwarding_rule_data['IPAddress'] = address.extra['selfLink']
         if port_range:
             forwarding_rule_data['portRange'] = port_range
+        if description:
+            forwarding_rule_data['description'] = description
 
         request = '/regions/%s/forwardingRules' % (region.name)
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/7fd9b3b3/libcloud/test/compute/fixtures/gce/aggregated_forwardingRules.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/gce/aggregated_forwardingRules.json b/libcloud/test/compute/fixtures/gce/aggregated_forwardingRules.json
index 06a1a0e..6447e5d 100644
--- a/libcloud/test/compute/fixtures/gce/aggregated_forwardingRules.json
+++ b/libcloud/test/compute/fixtures/gce/aggregated_forwardingRules.json
@@ -34,6 +34,7 @@
           "id": "06342111469679701315",
           "kind": "compute#forwardingRule",
           "name": "lcforwardingrule",
+          "description": "test forwarding rule",
           "portRange": "8000-8500",
           "region": "https://www.googleapis.com/compute/v1/projects/project_name/regions/us-central1",
           "selfLink": "https://www.googleapis.com/compute/v1/projects/project_name/regions/us-central1/forwardingRules/lcforwardingrule",

http://git-wip-us.apache.org/repos/asf/libcloud/blob/7fd9b3b3/libcloud/test/compute/fixtures/gce/global_httpHealthChecks.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/gce/global_httpHealthChecks.json b/libcloud/test/compute/fixtures/gce/global_httpHealthChecks.json
index e1f25a6..97d2159 100644
--- a/libcloud/test/compute/fixtures/gce/global_httpHealthChecks.json
+++ b/libcloud/test/compute/fixtures/gce/global_httpHealthChecks.json
@@ -24,6 +24,7 @@
       "id": "022194976205566532",
       "kind": "compute#httpHealthCheck",
       "name": "lchealthcheck",
+      "description": "test healthcheck",
       "port": 9000,
       "requestPath": "/lc",
       "selfLink": "https://www.googleapis.com/compute/v1/projects/project_name/global/httpHealthChecks/lchealthcheck",

http://git-wip-us.apache.org/repos/asf/libcloud/blob/7fd9b3b3/libcloud/test/compute/fixtures/gce/regions_us-central1_forwardingRules_lcforwardingrule.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/gce/regions_us-central1_forwardingRules_lcforwardingrule.json
b/libcloud/test/compute/fixtures/gce/regions_us-central1_forwardingRules_lcforwardingrule.json
index 6301a55..ead67c4 100644
--- a/libcloud/test/compute/fixtures/gce/regions_us-central1_forwardingRules_lcforwardingrule.json
+++ b/libcloud/test/compute/fixtures/gce/regions_us-central1_forwardingRules_lcforwardingrule.json
@@ -5,6 +5,7 @@
   "id": "10901665092293158938",
   "kind": "compute#forwardingRule",
   "name": "lcforwardingrule",
+  "description": "test forwarding rule",
   "portRange": "8000-8500",
   "region": "https://www.googleapis.com/compute/v1/projects/project_name/regions/us-central1",
   "selfLink": "https://www.googleapis.com/compute/v1/projects/project_name/regions/us-central1/forwardingRules/lcforwardingrule",

http://git-wip-us.apache.org/repos/asf/libcloud/blob/7fd9b3b3/libcloud/test/compute/test_gce.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_gce.py b/libcloud/test/compute/test_gce.py
index d4bdd3e..1912496 100644
--- a/libcloud/test/compute/test_gce.py
+++ b/libcloud/test/compute/test_gce.py
@@ -255,11 +255,18 @@ class GCENodeDriverTest(LibcloudTestCase, TestCaseMixin):
         fwr_name = 'lcforwardingrule'
         targetpool = 'lctargetpool'
         region = 'us-central1'
+        port_range='8000-8500'
+        description = 'test forwarding rule'
         fwr = self.driver.ex_create_forwarding_rule(fwr_name, targetpool,
                                                     region=region,
-                                                    port_range='8000-8500')
+                                                    port_range=port_range,
+                                                    description=description)
         self.assertTrue(isinstance(fwr, GCEForwardingRule))
         self.assertEqual(fwr.name, fwr_name)
+        self.assertEqual(fwr.region.name, region)
+        self.assertEqual(fwr.protocol, 'TCP')
+        self.assertEqual(fwr.extra['portRange'], port_range)
+        self.assertEqual(fwr.extra['description'], description)
 
     def test_ex_create_network(self):
         network_name = 'lcnetwork'


Mime
View raw message