summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/integration_tests/clouds.py11
-rw-r--r--tests/integration_tests/conftest.py10
-rw-r--r--tox.ini1
3 files changed, 18 insertions, 4 deletions
diff --git a/tests/integration_tests/clouds.py b/tests/integration_tests/clouds.py
index 06f1c623..08c86198 100644
--- a/tests/integration_tests/clouds.py
+++ b/tests/integration_tests/clouds.py
@@ -54,13 +54,18 @@ class IntegrationCloud(ABC):
self.settings.EXISTING_INSTANCE_ID
)
return
- launch_kwargs = {
+ kwargs = {
'image_id': self.image_id,
'user_data': user_data,
'wait': False,
}
- launch_kwargs.update(launch_kwargs)
- pycloudlib_instance = self.cloud_instance.launch(**launch_kwargs)
+ kwargs.update(launch_kwargs)
+ log.info(
+ "Launching instance with launch_kwargs:\n{}".format(
+ "\n".join("{}={}".format(*item) for item in kwargs.items())
+ )
+ )
+ pycloudlib_instance = self.cloud_instance.launch(**kwargs)
pycloudlib_instance.wait(raise_on_cloudinit_failure=False)
log.info('Launched instance: %s', pycloudlib_instance)
return self.get_instance(pycloudlib_instance, settings)
diff --git a/tests/integration_tests/conftest.py b/tests/integration_tests/conftest.py
index 9163ac66..34e674e9 100644
--- a/tests/integration_tests/conftest.py
+++ b/tests/integration_tests/conftest.py
@@ -111,7 +111,15 @@ def _client(request, fixture_utils, session_cloud):
"""
user_data = fixture_utils.closest_marker_first_arg_or(
request, 'user_data', None)
- with session_cloud.launch(user_data=user_data) as instance:
+ name = fixture_utils.closest_marker_first_arg_or(
+ request, 'instance_name', None
+ )
+ launch_kwargs = {}
+ if name is not None:
+ launch_kwargs = {"name": name}
+ with session_cloud.launch(
+ user_data=user_data, launch_kwargs=launch_kwargs
+ ) as instance:
yield instance
diff --git a/tox.ini b/tox.ini
index a8681197..816e6e8e 100644
--- a/tox.ini
+++ b/tox.ini
@@ -158,3 +158,4 @@ markers =
oci: test will only run on OCI platform
lxd_container: test will only run in LXD container
user_data: the user data to be passed to the test instance
+ instance_name: the name to be used for the test instance