From bb23d9fbff3722d94de5348b538ebbcbd3f723dc Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Tue, 16 Apr 2024 19:06:09 +0200 Subject: [PATCH] Additional changes to the DigitalOcean tests to avoid cross test pollution and related failures when running tests in parallel. --- libcloud/test/common/test_digitalocean_v2.py | 2 ++ libcloud/test/compute/test_digitalocean_v2.py | 5 ++++- libcloud/test/dns/test_digitalocean.py | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libcloud/test/common/test_digitalocean_v2.py b/libcloud/test/common/test_digitalocean_v2.py index 90fc365f3a..b3b647484c 100644 --- a/libcloud/test/common/test_digitalocean_v2.py +++ b/libcloud/test/common/test_digitalocean_v2.py @@ -22,12 +22,14 @@ from libcloud.test.secrets import DIGITALOCEAN_v2_PARAMS from libcloud.test.file_fixtures import FileFixtures from libcloud.common.digitalocean import DigitalOceanBaseDriver +from libcloud.common.digitalocean import DigitalOcean_v2_BaseDriver from libcloud.dns.drivers.digitalocean import DigitalOceanDNSDriver class DigitalOceanTests(LibcloudTestCase): def setUp(self): DigitalOceanBaseDriver.connectionCls.conn_class = DigitalOceanCommonMockHttp + DigitalOcean_v2_BaseDriver.connectionCls.conn_class = DigitalOceanCommonMockHttp DigitalOceanCommonMockHttp.type = None self.driver = DigitalOceanBaseDriver(*DIGITALOCEAN_v2_PARAMS) diff --git a/libcloud/test/compute/test_digitalocean_v2.py b/libcloud/test/compute/test_digitalocean_v2.py index e5593284dc..c58d5a6986 100644 --- a/libcloud/test/compute/test_digitalocean_v2.py +++ b/libcloud/test/compute/test_digitalocean_v2.py @@ -24,7 +24,7 @@ from libcloud.test.secrets import DIGITALOCEAN_v1_PARAMS, DIGITALOCEAN_v2_PARAMS from libcloud.utils.iso8601 import UTC from libcloud.test.file_fixtures import ComputeFileFixtures -from libcloud.common.digitalocean import DigitalOcean_v1_Error +from libcloud.common.digitalocean import DigitalOcean_v1_Error, DigitalOceanBaseDriver from libcloud.compute.drivers.digitalocean import DigitalOceanNodeDriver try: @@ -36,6 +36,7 @@ # class DigitalOceanTests(unittest.TestCase, TestCaseMixin): class DigitalOcean_v2_Tests(LibcloudTestCase): def setUp(self): + DigitalOceanBaseDriver.connectionCls.conn_class = DigitalOceanComputeMockHttp DigitalOceanNodeDriver.connectionCls.conn_class = DigitalOceanComputeMockHttp DigitalOceanComputeMockHttp.type = None self.driver = DigitalOceanNodeDriver(*DIGITALOCEAN_v2_PARAMS) @@ -43,6 +44,8 @@ def setUp(self): def tearDown(self): LibcloudConnection.type = None DigitalOceanComputeMockHttp.type = None + DigitalOceanBaseDriver.connectionCls.conn_class = LibcloudConnection + DigitalOceanNodeDriver.connectionCls.conn_class = LibcloudConnection def test_v1_Error(self): self.assertRaises( diff --git a/libcloud/test/dns/test_digitalocean.py b/libcloud/test/dns/test_digitalocean.py index e65435d45a..ed92e59bb6 100644 --- a/libcloud/test/dns/test_digitalocean.py +++ b/libcloud/test/dns/test_digitalocean.py @@ -21,11 +21,13 @@ from libcloud.utils.py3 import httplib from libcloud.test.secrets import DIGITALOCEAN_v2_PARAMS from libcloud.test.file_fixtures import DNSFileFixtures +from libcloud.common.digitalocean import DigitalOceanBaseDriver from libcloud.dns.drivers.digitalocean import DigitalOceanDNSDriver class DigitalOceanDNSTests(LibcloudTestCase): def setUp(self): + DigitalOceanBaseDriver.connectionCls.conn_class = DigitalOceanDNSMockHttp DigitalOceanDNSDriver.connectionCls.conn_class = DigitalOceanDNSMockHttp DigitalOceanDNSMockHttp.type = None self.driver = DigitalOceanDNSDriver(*DIGITALOCEAN_v2_PARAMS) @@ -33,6 +35,8 @@ def setUp(self): def tearDown(self): LibcloudConnection.type = None DigitalOceanDNSMockHttp.type = None + DigitalOceanBaseDriver.connectionCls.conn_class = LibcloudConnection + DigitalOceanDNSDriver.connectionCls.conn_class = LibcloudConnection def test_list_zones(self): zones = self.driver.list_zones()