mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-08 19:26:48 +00:00
test(computes): the storage page tests use the suite's own pool
test_default_storage and test_default_storage_volumes opened a pool named default, which a compute need not have (an openEuler host had none, and the two tests failed there). They now use the wvc-test pool the live suite creates and removes, and run only on a named test host.
This commit is contained in:
parent
1cd1d63f0c
commit
50f861b2aa
1 changed files with 15 additions and 8 deletions
|
|
@ -7,6 +7,7 @@ from django.test import RequestFactory, TestCase, TransactionTestCase
|
|||
|
||||
from vrtManager.connection import CONN_SOCKET, connection_manager
|
||||
from computes.models import Compute
|
||||
from instances.tests import livetest
|
||||
|
||||
TEST_COMPUTE_HOST = os.environ.get("TEST_LIBVIRT_HOST", "localhost")
|
||||
TEST_COMPUTE_LOGIN = os.environ.get("TEST_LIBVIRT_LOGIN", "")
|
||||
|
|
@ -116,18 +117,24 @@ class ComputesTestCase(TestCase):
|
|||
response = self.client.get(reverse("storages", args=[self.compute.id]))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
def test_default_storage_volumes(self):
|
||||
def _test_pool(self):
|
||||
"""The suite's own pool on the named test host: a host need not have one called default."""
|
||||
self._require_live_compute()
|
||||
response = self.client.get(
|
||||
reverse("volumes", kwargs={"compute_id": self.compute.id, "pool": "default"})
|
||||
if not livetest.enabled():
|
||||
self.skipTest("TEST_LIBVIRT_HOST is not set")
|
||||
conn = connection_manager.get_connection(
|
||||
self.compute.hostname, self.compute.login, self.compute.password, self.compute.type
|
||||
)
|
||||
livetest.ensure_pool(conn)
|
||||
self.addCleanup(livetest.remove_pool, conn)
|
||||
return livetest.POOL
|
||||
|
||||
def test_storage_volumes(self):
|
||||
response = self.client.get(reverse("volumes", kwargs={"compute_id": self.compute.id, "pool": self._test_pool()}))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
def test_default_storage(self):
|
||||
self._require_live_compute()
|
||||
response = self.client.get(
|
||||
reverse("storage", kwargs={"compute_id": self.compute.id, "pool": "default"})
|
||||
)
|
||||
def test_storage(self):
|
||||
response = self.client.get(reverse("storage", kwargs={"compute_id": self.compute.id, "pool": self._test_pool()}))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
def test_networks(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue