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 2024/04/16 16:59:29 UTC

(libcloud) branch dependabot/pip/pytest-8.0.2 updated (4593aa355 -> 841dea766)

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

tomaz pushed a change to branch dependabot/pip/pytest-8.0.2
in repository https://gitbox.apache.org/repos/asf/libcloud.git


 discard 4593aa355 Test a change to see if it helps with cross test pollution and related CI test run failures.
     new 9e2a11d50 Test a change to see if it helps with cross test pollution and related CI test run failures.
     new 841dea766 Fix bug in the base MockHttp class which was there for a long time since we incorrectly used class attribute value instead of the value passed to the method.

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (4593aa355)
            \
             N -- N -- N   refs/heads/dependabot/pip/pytest-8.0.2 (841dea766)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

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:
 libcloud/test/__init__.py                    | 2 +-
 libcloud/test/common/test_digitalocean_v2.py | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)


(libcloud) 01/02: Test a change to see if it helps with cross test pollution and related CI test run failures.

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

tomaz pushed a commit to branch dependabot/pip/pytest-8.0.2
in repository https://gitbox.apache.org/repos/asf/libcloud.git

commit 9e2a11d50766ca7d913ee6208d5aa7d61a7452a5
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Tue Apr 16 18:39:03 2024 +0200

    Test a change to see if it helps with cross test pollution and related
    CI test run failures.
---
 libcloud/test/common/test_digitalocean_v2.py  | 17 +++++---
 libcloud/test/compute/test_digitalocean_v2.py | 57 +++++++++++++++------------
 libcloud/test/dns/test_digitalocean.py        |  5 +++
 3 files changed, 48 insertions(+), 31 deletions(-)

diff --git a/libcloud/test/common/test_digitalocean_v2.py b/libcloud/test/common/test_digitalocean_v2.py
index e73979ae8..90fc365f3 100644
--- a/libcloud/test/common/test_digitalocean_v2.py
+++ b/libcloud/test/common/test_digitalocean_v2.py
@@ -15,22 +15,29 @@
 import sys
 import unittest
 
+from libcloud.http import LibcloudConnection
 from libcloud.test import MockHttp, LibcloudTestCase
 from libcloud.utils.py3 import httplib
 from libcloud.common.types import InvalidCredsError
 from libcloud.test.secrets import DIGITALOCEAN_v2_PARAMS
 from libcloud.test.file_fixtures import FileFixtures
 from libcloud.common.digitalocean import DigitalOceanBaseDriver
+from libcloud.dns.drivers.digitalocean import DigitalOceanDNSDriver
 
 
 class DigitalOceanTests(LibcloudTestCase):
     def setUp(self):
-        DigitalOceanBaseDriver.connectionCls.conn_class = DigitalOceanMockHttp
-        DigitalOceanMockHttp.type = None
+        DigitalOceanBaseDriver.connectionCls.conn_class = DigitalOceanCommonMockHttp
+        DigitalOceanCommonMockHttp.type = None
         self.driver = DigitalOceanBaseDriver(*DIGITALOCEAN_v2_PARAMS)
 
+    def tearDown(self):
+        LibcloudConnection.type = None
+        DigitalOceanCommonMockHttp.type = None
+        DigitalOceanBaseDriver.connectionCls.conn_class = LibcloudConnection
+
     def test_authentication(self):
-        DigitalOceanMockHttp.type = "UNAUTHORIZED"
+        DigitalOceanCommonMockHttp.type = "UNAUTHORIZED"
         self.assertRaises(InvalidCredsError, self.driver.ex_account_info)
 
     def test_ex_account_info(self):
@@ -51,13 +58,13 @@ class DigitalOceanTests(LibcloudTestCase):
         self.assertEqual(action["type"], "power_on")
 
     def test__paginated_request(self):
-        DigitalOceanMockHttp.type = "page_1"
+        DigitalOceanCommonMockHttp.type = "page_1"
         actions = self.driver._paginated_request("/v2/actions", "actions")
         self.assertEqual(actions[0]["id"], 12345671)
         self.assertEqual(actions[0]["status"], "completed")
 
 
-class DigitalOceanMockHttp(MockHttp):
+class DigitalOceanCommonMockHttp(MockHttp):
     fixtures = FileFixtures("common", "digitalocean")
 
     response = {
diff --git a/libcloud/test/compute/test_digitalocean_v2.py b/libcloud/test/compute/test_digitalocean_v2.py
index 168ada99a..e5593284d 100644
--- a/libcloud/test/compute/test_digitalocean_v2.py
+++ b/libcloud/test/compute/test_digitalocean_v2.py
@@ -16,6 +16,7 @@ import sys
 import unittest
 from datetime import datetime
 
+from libcloud.http import LibcloudConnection
 from libcloud.test import MockHttp, LibcloudTestCase
 from libcloud.utils.py3 import httplib, assertRaisesRegex
 from libcloud.common.types import InvalidCredsError
@@ -35,10 +36,14 @@ except ImportError:
 # class DigitalOceanTests(unittest.TestCase, TestCaseMixin):
 class DigitalOcean_v2_Tests(LibcloudTestCase):
     def setUp(self):
-        DigitalOceanNodeDriver.connectionCls.conn_class = DigitalOceanMockHttp
-        DigitalOceanMockHttp.type = None
+        DigitalOceanNodeDriver.connectionCls.conn_class = DigitalOceanComputeMockHttp
+        DigitalOceanComputeMockHttp.type = None
         self.driver = DigitalOceanNodeDriver(*DIGITALOCEAN_v2_PARAMS)
 
+    def tearDown(self):
+        LibcloudConnection.type = None
+        DigitalOceanComputeMockHttp.type = None
+
     def test_v1_Error(self):
         self.assertRaises(
             DigitalOcean_v1_Error,
@@ -56,7 +61,7 @@ class DigitalOcean_v2_Tests(LibcloudTestCase):
         )
 
     def test_authentication(self):
-        DigitalOceanMockHttp.type = "UNAUTHORIZED"
+        DigitalOceanComputeMockHttp.type = "UNAUTHORIZED"
         self.assertRaises(InvalidCredsError, self.driver.list_nodes)
 
     def test_list_images_success(self):
@@ -128,7 +133,7 @@ class DigitalOcean_v2_Tests(LibcloudTestCase):
         size = self.driver.list_sizes()[0]
         location = self.driver.list_locations()[0]
 
-        DigitalOceanMockHttp.type = "INVALID_IMAGE"
+        DigitalOceanComputeMockHttp.type = "INVALID_IMAGE"
         expected_msg = (
             r"You specified an invalid image for Droplet creation."
             + r" \(code: (404|HTTPStatus.NOT_FOUND)\)"
@@ -146,13 +151,13 @@ class DigitalOcean_v2_Tests(LibcloudTestCase):
 
     def test_reboot_node_success(self):
         node = self.driver.list_nodes()[0]
-        DigitalOceanMockHttp.type = "REBOOT"
+        DigitalOceanComputeMockHttp.type = "REBOOT"
         result = self.driver.reboot_node(node)
         self.assertTrue(result)
 
     def test_create_image_success(self):
         node = self.driver.list_nodes()[0]
-        DigitalOceanMockHttp.type = "SNAPSHOT"
+        DigitalOceanComputeMockHttp.type = "SNAPSHOT"
         result = self.driver.create_image(node, "My snapshot")
         self.assertTrue(result)
 
@@ -164,62 +169,62 @@ class DigitalOcean_v2_Tests(LibcloudTestCase):
 
     def test_delete_image_success(self):
         image = self.driver.get_image(12345)
-        DigitalOceanMockHttp.type = "DESTROY"
+        DigitalOceanComputeMockHttp.type = "DESTROY"
         result = self.driver.delete_image(image)
         self.assertTrue(result)
 
     def test_ex_power_on_node_success(self):
         node = self.driver.list_nodes()[0]
-        DigitalOceanMockHttp.type = "POWERON"
+        DigitalOceanComputeMockHttp.type = "POWERON"
         result = self.driver.ex_power_on_node(node)
         self.assertTrue(result)
 
     def test_ex_shutdown_node_success(self):
         node = self.driver.list_nodes()[0]
-        DigitalOceanMockHttp.type = "SHUTDOWN"
+        DigitalOceanComputeMockHttp.type = "SHUTDOWN"
         result = self.driver.ex_shutdown_node(node)
         self.assertTrue(result)
 
     def test_ex_hard_reboot_success(self):
         node = self.driver.list_nodes()[0]
-        DigitalOceanMockHttp.type = "POWERCYCLE"
+        DigitalOceanComputeMockHttp.type = "POWERCYCLE"
         result = self.driver.ex_hard_reboot(node)
         self.assertTrue(result)
 
     def test_ex_rebuild_node_success(self):
         node = self.driver.list_nodes()[0]
-        DigitalOceanMockHttp.type = "REBUILD"
+        DigitalOceanComputeMockHttp.type = "REBUILD"
         result = self.driver.ex_rebuild_node(node)
         self.assertTrue(result)
 
     def test_ex_resize_node_success(self):
         node = self.driver.list_nodes()[0]
         size = self.driver.list_sizes()[0]
-        DigitalOceanMockHttp.type = "RESIZE"
+        DigitalOceanComputeMockHttp.type = "RESIZE"
         result = self.driver.ex_resize_node(node, size)
         self.assertTrue(result)
 
     def test_destroy_node_success(self):
         node = self.driver.list_nodes()[0]
-        DigitalOceanMockHttp.type = "DESTROY"
+        DigitalOceanComputeMockHttp.type = "DESTROY"
         result = self.driver.destroy_node(node)
         self.assertTrue(result)
 
     def test_ex_change_kernel_success(self):
         node = self.driver.list_nodes()[0]
-        DigitalOceanMockHttp.type = "KERNELCHANGE"
+        DigitalOceanComputeMockHttp.type = "KERNELCHANGE"
         result = self.driver.ex_change_kernel(node, 7515)
         self.assertTrue(result)
 
     def test_ex_enable_ipv6_success(self):
         node = self.driver.list_nodes()[0]
-        DigitalOceanMockHttp.type = "ENABLEIPV6"
+        DigitalOceanComputeMockHttp.type = "ENABLEIPV6"
         result = self.driver.ex_enable_ipv6(node)
         self.assertTrue(result)
 
     def test_ex_rename_node_success(self):
         node = self.driver.list_nodes()[0]
-        DigitalOceanMockHttp.type = "RENAME"
+        DigitalOceanComputeMockHttp.type = "RENAME"
         result = self.driver.ex_rename_node(node, "fedora helios")
         self.assertTrue(result)
 
@@ -231,7 +236,7 @@ class DigitalOcean_v2_Tests(LibcloudTestCase):
         self.assertEqual(keys[0].public_key, "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAQQDGk5 example")
 
     def test_create_key_pair(self):
-        DigitalOceanMockHttp.type = "CREATE"
+        DigitalOceanComputeMockHttp.type = "CREATE"
         key = self.driver.create_key_pair(
             name="test1", public_key="ssh-rsa AAAAB3NzaC1yc2EAAAADAQsxRiUKn example"
         )
@@ -250,7 +255,7 @@ class DigitalOcean_v2_Tests(LibcloudTestCase):
         self.assertEqual(nodes[0]["size_slug"], "s-1vcpu-1gb")
 
     def test__paginated_request_two_pages(self):
-        DigitalOceanMockHttp.type = "PAGE_ONE"
+        DigitalOceanComputeMockHttp.type = "PAGE_ONE"
         nodes = self.driver._paginated_request("/v2/droplets", "droplets")
         self.assertEqual(len(nodes), 2)
 
@@ -264,13 +269,13 @@ class DigitalOcean_v2_Tests(LibcloudTestCase):
         self.assertEqual(volume.driver, self.driver)
 
     def test_list_volumes_empty(self):
-        DigitalOceanMockHttp.type = "EMPTY"
+        DigitalOceanComputeMockHttp.type = "EMPTY"
         volumes = self.driver.list_volumes()
         self.assertEqual(len(volumes), 0)
 
     def test_create_volume(self):
         nyc1 = [r for r in self.driver.list_locations() if r.id == "nyc1"][0]
-        DigitalOceanMockHttp.type = "CREATE"
+        DigitalOceanComputeMockHttp.type = "CREATE"
         volume = self.driver.create_volume(4, "example", nyc1)
         self.assertEqual(volume.id, "62766883-2c28-11e6-b8e6-000f53306ae1")
         self.assertEqual(volume.name, "example")
@@ -280,19 +285,19 @@ class DigitalOcean_v2_Tests(LibcloudTestCase):
     def test_attach_volume(self):
         node = self.driver.list_nodes()[0]
         volume = self.driver.list_volumes()[0]
-        DigitalOceanMockHttp.type = "ATTACH"
+        DigitalOceanComputeMockHttp.type = "ATTACH"
         resp = self.driver.attach_volume(node, volume)
         self.assertTrue(resp)
 
     def test_detach_volume(self):
         volume = self.driver.list_volumes()[0]
-        DigitalOceanMockHttp.type = "DETACH"
+        DigitalOceanComputeMockHttp.type = "DETACH"
         resp = self.driver.detach_volume(volume)
         self.assertTrue(resp)
 
     def test_destroy_volume(self):
         volume = self.driver.list_volumes()[0]
-        DigitalOceanMockHttp.type = "DESTROY"
+        DigitalOceanComputeMockHttp.type = "DESTROY"
         resp = self.driver.destroy_volume(volume)
         self.assertTrue(resp)
 
@@ -307,7 +312,7 @@ class DigitalOcean_v2_Tests(LibcloudTestCase):
 
     def test_create_volume_snapshot(self):
         volume = self.driver.list_volumes()[0]
-        DigitalOceanMockHttp.type = "CREATE"
+        DigitalOceanComputeMockHttp.type = "CREATE"
         snapshot = self.driver.create_volume_snapshot(volume, "test-snapshot")
         self.assertEqual(snapshot.id, "c0def940-9324-11e6-9a56-000f533176b1")
         self.assertEqual(snapshot.name, "test-snapshot")
@@ -316,7 +321,7 @@ class DigitalOcean_v2_Tests(LibcloudTestCase):
     def test_delete_volume_snapshot(self):
         volume = self.driver.list_volumes()[0]
         snapshot = self.driver.list_volume_snapshots(volume)[0]
-        DigitalOceanMockHttp.type = "DELETE"
+        DigitalOceanComputeMockHttp.type = "DELETE"
         result = self.driver.delete_volume_snapshot(snapshot)
         self.assertTrue(result)
 
@@ -396,7 +401,7 @@ class DigitalOcean_v2_Tests(LibcloudTestCase):
         self.assertTrue(ret)
 
 
-class DigitalOceanMockHttp(MockHttp):
+class DigitalOceanComputeMockHttp(MockHttp):
     fixtures = ComputeFileFixtures("digitalocean_v2")
 
     def _v2_regions(self, method, url, body, headers):
diff --git a/libcloud/test/dns/test_digitalocean.py b/libcloud/test/dns/test_digitalocean.py
index 41c195874..e65435d45 100644
--- a/libcloud/test/dns/test_digitalocean.py
+++ b/libcloud/test/dns/test_digitalocean.py
@@ -15,6 +15,7 @@
 import sys
 import unittest
 
+from libcloud.http import LibcloudConnection
 from libcloud.test import MockHttp, LibcloudTestCase
 from libcloud.dns.types import RecordType
 from libcloud.utils.py3 import httplib
@@ -29,6 +30,10 @@ class DigitalOceanDNSTests(LibcloudTestCase):
         DigitalOceanDNSMockHttp.type = None
         self.driver = DigitalOceanDNSDriver(*DIGITALOCEAN_v2_PARAMS)
 
+    def tearDown(self):
+        LibcloudConnection.type = None
+        DigitalOceanDNSMockHttp.type = None
+
     def test_list_zones(self):
         zones = self.driver.list_zones()
         self.assertTrue(len(zones) >= 1)


(libcloud) 02/02: Fix bug in the base MockHttp class which was there for a long time since we incorrectly used class attribute value instead of the value passed to the method.

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

tomaz pushed a commit to branch dependabot/pip/pytest-8.0.2
in repository https://gitbox.apache.org/repos/asf/libcloud.git

commit 841dea766478f37c086dbc19f0a88c5107dad99b
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Tue Apr 16 18:57:24 2024 +0200

    Fix bug in the base MockHttp class which was there for a long time since
    we incorrectly used class attribute value instead of the value passed to
    the method.
    
    This could result in all kinds of weird edge cases and test failures in
    case the environment wasn't correctly reset before / after each test.
---
 libcloud/test/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcloud/test/__init__.py b/libcloud/test/__init__.py
index 37a74b2b3..d45c82c84 100644
--- a/libcloud/test/__init__.py
+++ b/libcloud/test/__init__.py
@@ -205,7 +205,7 @@ class MockHttp(LibcloudConnection):
         )  # Python 3.7 no longer quotes ~
 
         if type:
-            meth_name = "{}_{}".format(meth_name, self.type)
+            meth_name = "{}_{}".format(meth_name, type)
 
         if use_param and use_param in qs:
             param = qs[use_param][0].replace(".", "_").replace("-", "_")