Skip to content

Commit

Permalink
Additional changes to the DigitalOcean tests to avoid cross test
Browse files Browse the repository at this point in the history
pollution and related failures when running tests in parallel.
  • Loading branch information
Kami committed Apr 16, 2024
1 parent 841dea7 commit bb23d9f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions libcloud/test/common/test_digitalocean_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
5 changes: 4 additions & 1 deletion libcloud/test/compute/test_digitalocean_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -36,13 +36,16 @@
# 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)

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(
Expand Down
4 changes: 4 additions & 0 deletions libcloud/test/dns/test_digitalocean.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,22 @@
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)

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()
Expand Down

0 comments on commit bb23d9f

Please sign in to comment.