mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-22 22:03:54 +03:00
Fixed openstack tests (due to incorrect initial states of some tests)
This commit is contained in:
parent
4a05ebe074
commit
fedd6507ae
@ -170,7 +170,7 @@ class Environment:
|
||||
Obtains an environment with an unique identifier
|
||||
@return: An environment with an unique identifier
|
||||
"""
|
||||
return Environment('#_#' + str(id(owner)) + '#^#')
|
||||
return Environment('#_#' + str(owner) + '#^#')
|
||||
|
||||
@staticmethod
|
||||
def temporary_environment() -> 'Environment':
|
||||
|
@ -115,7 +115,7 @@ SERVERS_LIST: list[openstack_types.ServerInfo] = [
|
||||
fault=None,
|
||||
admin_pass='',
|
||||
)
|
||||
for n in range(1, 16)
|
||||
for n in range(1, 32)
|
||||
]
|
||||
|
||||
IMAGES_LIST: list[openstack_types.ImageInfo] = [
|
||||
@ -359,7 +359,7 @@ SERVICES_FIXED_VALUES_DICT: typing.Final[gui.ValuesDictType] = {
|
||||
'token': 'token',
|
||||
'region': random.choice(REGIONS_LIST).id,
|
||||
'project': random.choice(PROJECTS_LIST).id,
|
||||
'machines': [i.id for i in random.sample(SERVERS_LIST, 4)],
|
||||
'machines': [i.id for i in random.sample(SERVERS_LIST, 10)],
|
||||
# 'prov_uuid': str(uuid.uuid4()), # Not stored on db, so not needed
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,8 @@ from . import fixtures
|
||||
from ...utils.test import UDSTransactionTestCase
|
||||
from ...utils.generators import limited_iterator
|
||||
|
||||
from uds.services.OpenStack.openstack import types as openstack_types
|
||||
|
||||
|
||||
# We use transactions on some related methods (storage access, etc...)
|
||||
class TestOpenstackFixedService(UDSTransactionTestCase):
|
||||
@ -92,6 +94,10 @@ class TestOpenstackFixedService(UDSTransactionTestCase):
|
||||
self.assertEqual(set(), assigned_machines)
|
||||
|
||||
# set_ready, machine is "stopped" in this test, so must return RUNNING
|
||||
# ensure cache is empty, may affect from other tests
|
||||
userservice.cache.clear()
|
||||
# Also that machine is stopped
|
||||
fixtures.get_id(fixtures.SERVERS_LIST, userservice._vmid).power_state = openstack_types.PowerState.SHUTDOWN
|
||||
state = userservice.set_ready()
|
||||
self.assertEqual(state, types.states.TaskState.RUNNING)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user