ci(tests): load schemas through infrahub-testcontainers with a pinned Infrahub
BA
9d ago+1510+1510+0123456789012345678901234567890123456789-38-38-01234567890123456789
Jira: https://opsmill.atlassian.net/browse/INFP-697
What changes and why
The schema-test job started the latest Infrahub image with invoke start, so the Infrahub version was not pinned and a load failure showed only the output of one long task. It now runs pytest tests/integration through infrahub-testcontainers, pinned to Infrahub 1.12.1.
pyproject.tomlanduv.lock: newintegrationdependency group withinfrahub-testcontainers==1.12.1. It resolves withinfrahub-sdk[all].tests/unit/:test_docs.pyandtest_marketplace.pymoved here.python-lintrunspytest tests/unitand syncs theintegrationgroup so mypy and pylint resolve the imports. A barepytestwithout the group skipstests/integrationinstead of failing at collection.tasks/schemas.py: publicload_order(include_experimental=False), whichload_all_schemasnow uses. It returns only directories that can be loaded (thebase/dcim-style keys are files and are left out).tests/integration/: base classTestSchemaLibrarywithinfrahub_addressandctl.test_schema_load.pystarts one Infrahub per class and runs one test perload_order()entry withinfrahubctl schema load <path> --wait 60onmain. A test is skipped when a dependency from.metadata.ymlfailed to load. A load is retried up to twice when the command exits 1 but its output says the schema loaded, which happens when only the--waitpoll fails.ci.ymlschema-test: single-entry matrixinfrahub-versionexported asINFRAHUB_TESTING_IMAGE_VER,PYTEST_DEBUG_TEMPROOTstep,tini,uv sync --group dev --group integration. The existingneeds,ifandschema-validatelines are unchanged.pyproject.toml,uv.lock,tasks/schemas.pyandtests/integration/**now triggerschema-test.update-infrahub.yml: ontrigger-infrahub-updateor manual dispatch it validates the version as X.Y.Z, runsuv add --group integration infrahub-testcontainers==X.Y.Z, updates the matrix literal inci.yml(so the two stay equal), adds a news fragment, pushesinfrahub-update/vX.Y.Zand opens a pull request labelledchanges/patchwithopsmill/saas reviewer. It does not merge..github/CODEOWNERS:* @opsmill/sa.tasks/__init__.py:INFRAHUB_VERSIONdefaults to the installed testcontainers version, orstablewhen the package is not installed.RELEASING.md: how the pin moves and how to run the test locally.
How it was verified
ruff check,ruff format --check,mypy,pylint,yamllint -s,rumdl check: pass.pytest tests/unit: 66 passed. A barepytestin an environment without theintegrationgroup: 66 passed, 1 skipped.invoke --listworks.actionlintis not installed locally.- Local integration runs on Infrahub 1.12.1 (OrbStack, 12 GB): not a clean pass. Seven full runs took between 4 and 37 minutes. Schemas reported "loaded successfully" in every run, and no schema was rejected. The failures were the
--waitpoll or the Infrahub server on the laptop (Timeout reading from cache:6379,Server disconnected,Unable to read from ... (timeout: 60 sec)), and in some runs the Docker daemon itself stopped. The retry described above was added after the first run. The last full run still had 4 failures (circuit_contract,routing_bgp,routing_policies_ospf,routing_policies_pim) and their dependents were skipped. That run was cut off before pytest printed the failure messages, so their cause is not known. The result onhuge-runnersin this pull request is the verification of the full load.
Steps outside this repository
- Add
opsmill/schema-libraryto therepomatrix inopsmill/infrahub/.github/workflows/repository-dispatch.yml. - Confirm that
GH_UPDATE_PACKAGE_OTTOreaches this repository. - Confirm that
@opsmill/sahas write access, which CODEOWNERS requires.
🤖 Generated with Claude Code