Skip to content

Conversation

@dhaustein
Copy link

@dhaustein dhaustein commented Sep 8, 2025

Refactors the structure of the integration test suite in an attempt to decouple it from its downstream consumers, such as mender-orchestrator, mender-configure-module, mender-gateway, and mender-binary-delta

The project is now configured as a Python package by adding a pyproject.toml file. In it, two new packages are defined: integration_tests and integration_testutils as the two that will actually install.

Renamed the top-level tests dir to integration_tests and the testutils to integration_testutils. This is to avoid potential conflicts (module shadowing) in projects that import these tow packages.

Additionally, a MANIFEST.in file ensures that non-Python files, such as the docker-compose YAML files, are included with integration_tests under a new sub/directory.

Key changes

  • Project Structure Refactoring:

    • The main test directory tests has been renamed to integration_tests
    • The test utility directory testutils has been renamed to integration_testutils
    • All internal imports have been updated across the test suite to reflect these new paths
  • Python Package Conversion:

    • Added a pyproject.toml to define the project as an installable Python package named mender-integration. The top level project itself is not installable howerver, two sub-packages integration_tests and integration_testutils were defined as installable instead.
    • Added a MANIFEST.in file to ensure that *.yml compose files are included in the integration_tests package data
  • Test Asset Relocation:

    • Docker compose files previously in the root directory have been moved to integration_tests/data/compose/
    • conftest.py has been updated to use importlib.resources to locate these compose files within the package
    • Copies of integration_tests/data/compose/common.yml and integration_tests/data/compose/docker-compose.gateway.yml from elsewhere in the integration were added to ensure they are included with the package data. This is a temporary solution and should be addressed in a cleaner way later. (I did this as a last ditch attempt at making downstream tests work, as they required compose files from all over the place.)
  • New Test Fixture:

    • A new pytest fixture docker_compose_demo_server has been added to conftest.py to simplify the setup of a demo server environment for testing.

Ticket: QA-1170
Changelog: Packaged integration test suite as a python package, so it can be imported in other Mender client related tests.

How to test

See the description for https://github.com/mendersoftware/mender-orchestrator/pull/151

@dhaustein dhaustein added the python Pull requests that update Python code label Sep 8, 2025
Comment on lines +20 to +40
dependencies = [
"cryptography==45.0.7",
"docker==7.1.0",
"filelock==3.19.1",
"kubernetes==33.1.0",
"msgpack==1.1.1",
"py3dns==4.0.2",
"pymongo==4.14.1",
"pytest==8.4.1",
"pytest-html==4.1.1",
"pytest-metadata==3.1.1",
"pytest-timeout==2.4.0",
"pytest-xdist==3.8.0",
"redo==3.0.0",
"requests==2.32.5",
"urllib3==1.26.20",
"websockets==15.0.1",
"flaky==3.8.1",
"stripe==12.5.0",
"aiosmtpd==1.4.6",
]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note to self: not all of these are probably needed, will need to go through them and clean up

@dhaustein dhaustein self-assigned this Sep 8, 2025
@dhaustein dhaustein force-pushed the integration-python-pkg branch from 8801d7e to 11b9610 Compare September 9, 2025 12:45
Copy link
Member

@lluiscampos lluiscampos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks promising! I drooped some comments 📝

@dhaustein dhaustein force-pushed the integration-python-pkg branch 2 times, most recently from ab31599 to 2d953da Compare September 11, 2025 11:49
pyproject.toml file has been updated to correctly define the package structure

tests and testutils directories are now exposed as top-level packages named
integration_tests and integration_testutils respectively

sub-packages are now explicitly listed in pyproject.toml

docker-compose*.yml files have been moved from the project root into a new
tests/data/compose/ dir

docker-compose*.yml files are now treated as package data and included
in the integration_tests.data.compose package

import statements within the integration_tests and integration_testutils
directories have been updated

code that previously loaded docker-compose files using relative file paths
(e.g., in tests/conftest.py) has been refactored to use the compose files
trough importlib.resources

Ticket: QA-1170
Changelog: Refactored the integration testing suite into an actual, installable Python package named mender-integration
Signed-off-by: Dusan Haustein <[email protected]>
@dhaustein dhaustein force-pushed the integration-python-pkg branch from 9a0cc80 to e0f4d52 Compare September 24, 2025 09:18
@dhaustein dhaustein removed their assignment Sep 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants