From d436782511c8c1b19844fc5facd13e864b85cc75 Mon Sep 17 00:00:00 2001 From: Alec Warren Date: Thu, 30 Jan 2025 11:16:16 -0500 Subject: [PATCH] feat(integration_tests): add optional INSTANCE_TYPE setting (#5988) --- doc/rtd/development/integration_tests.rst | 24 +++++++++++++++++++++++ tests/integration_tests/clouds.py | 4 ++++ 2 files changed, 28 insertions(+) diff --git a/doc/rtd/development/integration_tests.rst b/doc/rtd/development/integration_tests.rst index 18733929aba..17010c05706 100644 --- a/doc/rtd/development/integration_tests.rst +++ b/doc/rtd/development/integration_tests.rst @@ -237,6 +237,30 @@ on of: PLATFORM = 'lxd_container' +Selecting Instance Type +----------------------- + +To select a specific instance type, modify the ``INSTANCE_TYPE`` variable to be +the desired instance type. This value is cloud-specific, so refer to the +cloud's documentation for the available instance types. If you specify an +instance type, be sure to also specify respective cloud platform you are +testing against. + +.. tab-set:: + + .. tab-item:: Inline environment variable + + .. code-block:: bash + + CLOUD_INIT_PLATFORM=ec2 CLOUD_INIT_INSTANCE_TYPE='t2.micro' tox -e integration_tests + + .. tab-item:: user_settings.py file + + .. code-block:: python + + PLATFORM = 'ec2' # need to specify the cloud in order to use the instance type setting + INSTANCE_TYPE = 't2.micro' + Image selection =============== diff --git a/tests/integration_tests/clouds.py b/tests/integration_tests/clouds.py index cfa120c232a..415802c58f9 100644 --- a/tests/integration_tests/clouds.py +++ b/tests/integration_tests/clouds.py @@ -132,6 +132,10 @@ def launch( "user_data": user_data, "username": DISTRO_TO_USERNAME[CURRENT_RELEASE.os], } + if self.settings.INSTANCE_TYPE: + default_launch_kwargs["instance_type"] = ( + self.settings.INSTANCE_TYPE + ) launch_kwargs = {**default_launch_kwargs, **launch_kwargs} display_launch_kwargs = deepcopy(launch_kwargs) if display_launch_kwargs.get("user_data") is not None: