You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2019/07/01 21:13:27 UTC

[libcloud] branch trunk updated (195ba82 -> f8deceb)

This is an automated email from the ASF dual-hosted git repository.

tomaz pushed a change to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git.


    from 195ba82  Merge pull request #1300 from palashgandhi/list_volumes_filters
     new e886e73  Add changelog entry for #1300.
     new f8deceb  Improve tests - use separate mock method for two different test scenarios.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 CHANGES.rst                       |  5 +++++
 libcloud/test/compute/test_ec2.py | 37 +++++++++++++++----------------------
 2 files changed, 20 insertions(+), 22 deletions(-)


[libcloud] 01/02: Add changelog entry for #1300.

Posted by to...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git

commit e886e73f692f81745eb5618cecc6f2b935d350b8
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Mon Jul 1 22:49:38 2019 +0200

    Add changelog entry for #1300.
---
 CHANGES.rst | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/CHANGES.rst b/CHANGES.rst
index 61a91a5..96c7339 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -41,6 +41,11 @@ Compute
   - Add functionality to check IP address availability (GITHUB-1244)
   [Palash Gandhi - @palashgandhi]
 
+- [EC2] Allow user to pass arbitrary filters to ``list_volumes`` method by
+  passing a dictionary with filters as ``ex_filters`` method argument value.
+  (GITHUB-1300)
+  [Palash Gandhi - @palashgandhi]
+
 Storage
 ~~~~~~~
 


[libcloud] 02/02: Improve tests - use separate mock method for two different test scenarios.

Posted by to...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git

commit f8deceb04c41e36bc3002b3fd9c4f0d6e752b383
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Mon Jul 1 22:59:45 2019 +0200

    Improve tests - use separate mock method for two different test
    scenarios.
---
 libcloud/test/compute/test_ec2.py | 37 +++++++++++++++----------------------
 1 file changed, 15 insertions(+), 22 deletions(-)

diff --git a/libcloud/test/compute/test_ec2.py b/libcloud/test/compute/test_ec2.py
index 475c2be..4049155 100644
--- a/libcloud/test/compute/test_ec2.py
+++ b/libcloud/test/compute/test_ec2.py
@@ -869,9 +869,11 @@ class EC2Tests(LibcloudTestCase, TestCaseMixin):
         self.assertEqual('snap-30d37269', volumes[2].extra['snapshot_id'])
         self.assertEqual(StorageVolumeState.UNKNOWN, volumes[2].state)
 
-        EC2MockHttp.type = 'filters'
+        EC2MockHttp.type = 'filters_nodes'
         node = Node('i-d334b4b3', None, None, None, None, self.driver)
         self.driver.list_volumes(node=node)
+
+        EC2MockHttp.type = 'filters_status'
         self.driver.list_volumes(ex_filters={'status': 'available'})
 
     def test_create_volume(self):
@@ -1553,22 +1555,24 @@ class EC2MockHttp(MockHttp):
         body = self.fixtures.load('describe_volumes.xml')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
-    def _filters_DescribeVolumes(self, method, url, body, headers):
-        expected_params_1 = {
+    def _filters_nodes_DescribeVolumes(self, method, url, body, headers):
+        expected_params = {
             'Filter.1.Name': 'attachment.instance-id',
             'Filter.1.Value.1': 'i-d334b4b3',
         }
 
-        expected_params_2 = {
+        self.assertUrlContainsQueryParams(url, expected_params)
+
+        body = self.fixtures.load('describe_volumes.xml')
+        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+    def _filters_status_DescribeVolumes(self, method, url, body, headers):
+        expected_params = {
             'Filter.1.Name': 'status',
             'Filter.1.Value.1': 'available'
         }
 
-        try:
-            self.assertUrlContainsQueryParams(url, expected_params_1)
-        except AssertionError:
-            # dict ordering is not guaranteed
-            self.assertUrlContainsQueryParams(url, expected_params_2)
+        self.assertUrlContainsQueryParams(url, expected_params)
 
         body = self.fixtures.load('describe_volumes.xml')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
@@ -1629,25 +1633,14 @@ class EC2MockHttp(MockHttp):
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
     def _filters_DescribeVpcs(self, method, url, body, headers):
-        expected_params_1 = {
+        expected_params = {
             'Filter.1.Name': 'dhcp-options-id',
             'Filter.1.Value.1': 'dopt-7eded312',
             'Filter.2.Name': 'cidr',
             'Filter.2.Value.1': '192.168.51.0/24'
         }
 
-        expected_params_2 = {
-            'Filter.1.Name': 'cidr',
-            'Filter.1.Value.1': '192.168.51.0/24',
-            'Filter.2.Name': 'dhcp-options-id',
-            'Filter.2.Value.1': 'dopt-7eded312'
-        }
-
-        try:
-            self.assertUrlContainsQueryParams(url, expected_params_1)
-        except AssertionError:
-            # dict ordering is not guaranteed
-            self.assertUrlContainsQueryParams(url, expected_params_2)
+        self.assertUrlContainsQueryParams(url, expected_params)
 
         body = self.fixtures.load('describe_vpcs.xml')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])