Skip to content

Commit

Permalink
feat(integration_tests): add optional INSTANCE_TYPE setting (#5988)
Browse files Browse the repository at this point in the history
  • Loading branch information
a-dubs authored Jan 30, 2025
1 parent 4dce22a commit d436782
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
24 changes: 24 additions & 0 deletions doc/rtd/development/integration_tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
===============

Expand Down
4 changes: 4 additions & 0 deletions tests/integration_tests/clouds.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit d436782

Please sign in to comment.