Skip to content

Conversation

@gmazoyer
Copy link
Contributor

@gmazoyer gmazoyer commented Dec 31, 2025

Fixes #187

This PR rewrites integration tests that were previously disabled. These tests are now based on the TestInfrahubDockerClient. Some tests are marked as XFAIL for now as they either highlight issues or require a different version of Infrahub server.

Summary by CodeRabbit

  • Chores

    • Added a changelog entry noting integration tests were rewritten and re-enabled.
  • Tests

    • Rewrote and re-enabled integration tests with end-to-end Docker-backed scenarios.
    • Expanded coverage for export/import, object storage, schema behavior, hierarchical relationships, tracking workflows, and IP address pool provisioning.
    • Improved and typed fixtures for more reliable, stricter test validation.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 31, 2025

Walkthrough

The PR rewrites and re-enables the integration test suite. Commented scaffolding in tests/integration/conftest.py was replaced with concrete, typed pytest fixtures providing multiple schema dicts. Many integration test modules were converted from placeholders to active tests (including async and sync client variants), updated with explicit type annotations and Docker-backed client usage via infrahub-testcontainers. pyproject.toml Ruff ignores were changed to exclude the entire tests/integration directory and map specific test files to PLR0904. A changelog entry (187.fixed) was added noting the rewrite and re-enablement.

Pre-merge checks

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Convert and enable integration tests' accurately and concisely summarizes the main purpose of the pull request, which is to rewrite and re-enable disabled integration tests using the new TestInfrahubDockerClient pattern.
Linked Issues check ✅ Passed The pull request successfully converts all six required integration test files (test_node.py, test_object_store.py, test_schema.py, test_infrahub_client.py, test_infrahub_client_sync.py, test_export_import.py) to use the new TestInfrahubDockerClient pattern and enables them with actual test implementations, meeting all objectives from issue #187.
Out of Scope Changes check ✅ Passed All code changes are directly related to converting integration tests to the new TestInfrahubDockerClient pattern. Configuration changes to pyproject.toml (Ruff rules) and conftest.py (fixture definitions) directly support the test conversion objective without introducing unrelated modifications.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Dec 31, 2025

Deploying infrahub-sdk-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0c798dc
Status: ✅  Deploy successful!
Preview URL: https://82263b0c.infrahub-sdk-python.pages.dev
Branch Preview URL: https://gma-20251231-187.infrahub-sdk-python.pages.dev

View logs

@codecov
Copy link

codecov bot commented Dec 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@                 Coverage Diff                  @@
##           infrahub-develop     #730      +/-   ##
====================================================
+ Coverage             76.29%   80.34%   +4.04%     
====================================================
  Files                   114      114              
  Lines                  9831     9854      +23     
  Branches               1509     1515       +6     
====================================================
+ Hits                   7501     7917     +416     
+ Misses                 1834     1411     -423     
- Partials                496      526      +30     
Flag Coverage Δ
integration-tests 41.38% <ø> (+6.92%) ⬆️
python-3.10 51.03% <ø> (+0.87%) ⬆️
python-3.11 51.01% <ø> (+0.85%) ⬆️
python-3.12 51.01% <ø> (+0.87%) ⬆️
python-3.13 50.99% <ø> (+0.85%) ⬆️
python-3.14 52.64% <ø> (+0.85%) ⬆️
python-filler-3.12 23.95% <ø> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 19 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmazoyer gmazoyer marked this pull request as ready for review January 2, 2026 13:22
@gmazoyer gmazoyer requested a review from a team January 2, 2026 13:23
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/integration/test_infrahubctl.py (1)

65-79: Environment variable cleanup may leave residual values.

When original_username or original_password is None (not set originally), the cleanup code doesn't remove the environment variables that were set during the test. This could leak credentials to subsequent tests.

🔎 Proposed fix
         yield
         if original_username:
             os.environ["INFRAHUB_USERNAME"] = original_username
+        elif "INFRAHUB_USERNAME" in os.environ:
+            del os.environ["INFRAHUB_USERNAME"]
         if original_password:
             os.environ["INFRAHUB_PASSWORD"] = original_password
+        elif "INFRAHUB_PASSWORD" in os.environ:
+            del os.environ["INFRAHUB_PASSWORD"]
🧹 Nitpick comments (1)
tests/integration/test_export_import.py (1)

101-105: Duplicated reset_export_directory method.

The reset_export_directory method is identical in both TestSchemaExportImportBase (lines 101-104) and TestSchemaExportImportManyRelationships (lines 265-268). Consider extracting this to a base class or a standalone helper function.

🔎 Suggested refactor

Create a shared mixin or move to a common base:

class ExportImportTestMixin:
    def reset_export_directory(self, temporary_directory: Path) -> None:
        for file in temporary_directory.iterdir():
            if file.is_file():
                file.unlink()

Then inherit from both the Docker client and the mixin.

Also applies to: 265-269

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 854412b and c5b7aa6.

📒 Files selected for processing (12)
  • changelog/187.fixed.md
  • pyproject.toml
  • tests/integration/conftest.py
  • tests/integration/test_convert_object_type.py
  • tests/integration/test_export_import.py
  • tests/integration/test_infrahub_client.py
  • tests/integration/test_infrahub_client_sync.py
  • tests/integration/test_infrahubctl.py
  • tests/integration/test_node.py
  • tests/integration/test_object_store.py
  • tests/integration/test_repository.py
  • tests/integration/test_schema.py
🧰 Additional context used
📓 Path-based instructions (4)
**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

**/*.py: Use type hints on all function signatures
Never mix async/sync inappropriately
Never bypass type checking without justification

Files:

  • tests/integration/test_convert_object_type.py
  • tests/integration/test_repository.py
  • tests/integration/test_infrahub_client_sync.py
  • tests/integration/test_infrahubctl.py
  • tests/integration/test_object_store.py
  • tests/integration/conftest.py
  • tests/integration/test_schema.py
  • tests/integration/test_node.py
  • tests/integration/test_infrahub_client.py
  • tests/integration/test_export_import.py
tests/**/*.py

📄 CodeRabbit inference engine (tests/AGENTS.md)

tests/**/*.py: Use httpx_mock fixture for HTTP mocking in tests instead of making real HTTP requests
Do not add @pytest.mark.asyncio decorator to async test functions (async auto-mode is globally enabled)

Files:

  • tests/integration/test_convert_object_type.py
  • tests/integration/test_repository.py
  • tests/integration/test_infrahub_client_sync.py
  • tests/integration/test_infrahubctl.py
  • tests/integration/test_object_store.py
  • tests/integration/conftest.py
  • tests/integration/test_schema.py
  • tests/integration/test_node.py
  • tests/integration/test_infrahub_client.py
  • tests/integration/test_export_import.py
tests/integration/**/*.py

📄 CodeRabbit inference engine (tests/AGENTS.md)

tests/integration/**/*.py: Integration tests should use testcontainers to interact with real Infrahub instances
Clean up resources in integration tests

Files:

  • tests/integration/test_convert_object_type.py
  • tests/integration/test_repository.py
  • tests/integration/test_infrahub_client_sync.py
  • tests/integration/test_infrahubctl.py
  • tests/integration/test_object_store.py
  • tests/integration/conftest.py
  • tests/integration/test_schema.py
  • tests/integration/test_node.py
  • tests/integration/test_infrahub_client.py
  • tests/integration/test_export_import.py
**/*.{md,mdx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{md,mdx}: Use text language for directory structure code blocks in markdown documentation
Add blank lines before and after lists in markdown documentation
Always specify language in fenced code blocks in markdown documentation

Files:

  • changelog/187.fixed.md
🧠 Learnings (6)
📓 Common learnings
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: tests/AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:37.990Z
Learning: Applies to tests/integration/**/*.py : Integration tests should use testcontainers to interact with real Infrahub instances
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: infrahub_sdk/pytest_plugin/AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:29.593Z
Learning: Applies to infrahub_sdk/pytest_plugin/**/*.yaml : Use YAML test format with required fields: `infrahub_tests`, `resource`, `resource_name`, `tests` array containing `name`, `spec.kind`, `input`, and `output`
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:08.136Z
Learning: Applies to infrahub_sdk/**/*.py : Follow async/sync dual pattern for new features in the Python SDK
📚 Learning: 2025-12-10T17:13:08.136Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:08.136Z
Learning: Applies to infrahub_sdk/client.py : Always provide both async and sync versions of client implementations in InfrahubClient

Applied to files:

  • tests/integration/test_convert_object_type.py
📚 Learning: 2025-12-10T17:13:37.990Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: tests/AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:37.990Z
Learning: Applies to tests/integration/**/*.py : Integration tests should use testcontainers to interact with real Infrahub instances

Applied to files:

  • tests/integration/test_convert_object_type.py
  • tests/integration/test_infrahub_client_sync.py
  • tests/integration/test_object_store.py
  • tests/integration/test_export_import.py
📚 Learning: 2025-12-10T17:13:29.593Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: infrahub_sdk/pytest_plugin/AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:29.593Z
Learning: Applies to infrahub_sdk/pytest_plugin/**/*.yaml : Use YAML test format with required fields: `infrahub_tests`, `resource`, `resource_name`, `tests` array containing `name`, `spec.kind`, `input`, and `output`

Applied to files:

  • tests/integration/test_convert_object_type.py
  • tests/integration/test_infrahub_client_sync.py
  • tests/integration/test_infrahubctl.py
  • tests/integration/conftest.py
  • tests/integration/test_infrahub_client.py
📚 Learning: 2025-12-10T17:13:21.977Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: infrahub_sdk/ctl/AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:21.977Z
Learning: Applies to infrahub_sdk/ctl/**/*.py : Do not instantiate InfrahubClient directly; always use initialize_client() or initialize_client_sync() helper functions

Applied to files:

  • tests/integration/test_convert_object_type.py
📚 Learning: 2025-12-10T17:13:29.593Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: infrahub_sdk/pytest_plugin/AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:29.593Z
Learning: Applies to infrahub_sdk/pytest_plugin/**/infrahub_sdk/pytest_plugin/items/*.py : Inherit from `InfrahubItem` base class when creating new test item classes in `infrahub_sdk/pytest_plugin/items/`

Applied to files:

  • tests/integration/test_convert_object_type.py
🧬 Code graph analysis (9)
tests/integration/test_convert_object_type.py (2)
infrahub_sdk/client.py (4)
  • convert_object_type (1732-1762)
  • convert_object_type (3153-3183)
  • InfrahubClient (318-1762)
  • InfrahubClientSync (1765-3183)
infrahub_sdk/testing/docker.py (1)
  • TestInfrahubDockerClient (36-47)
tests/integration/test_infrahub_client_sync.py (4)
infrahub_sdk/constants.py (1)
  • InfrahubClientMode (4-7)
infrahub_sdk/exceptions.py (1)
  • URLNotFoundError (148-151)
infrahub_sdk/task/models.py (4)
  • Task (32-62)
  • TaskFilter (65-76)
  • TaskLog (21-24)
  • TaskState (9-18)
infrahub_sdk/types.py (1)
  • Order (71-72)
tests/integration/test_infrahubctl.py (5)
tests/fixtures/repos/ctl_integration/generators/tag_generator.py (1)
  • Generator (4-15)
tests/fixtures/repos/ctl_integration/generators/tag_generator_convert.py (1)
  • Generator (4-16)
infrahub_sdk/node/node.py (1)
  • InfrahubNode (493-1298)
infrahub_sdk/transforms.py (1)
  • client (49-50)
infrahub_sdk/generator.py (2)
  • client (59-62)
  • client (65-66)
tests/integration/test_object_store.py (1)
infrahub_sdk/testing/docker.py (1)
  • TestInfrahubDockerClient (36-47)
tests/integration/conftest.py (2)
infrahub_sdk/utils.py (1)
  • str_to_bool (165-194)
infrahub_sdk/schema/__init__.py (2)
  • get (251-279)
  • get (565-605)
tests/integration/test_schema.py (3)
infrahub_sdk/exceptions.py (1)
  • BranchNotFoundError (51-55)
infrahub_sdk/schema/main.py (2)
  • NodeSchemaAPI (312-314)
  • kind (279-280)
infrahub_sdk/schema/__init__.py (4)
  • all (281-308)
  • all (536-563)
  • get (251-279)
  • get (565-605)
tests/integration/test_node.py (3)
infrahub_sdk/exceptions.py (1)
  • UninitializedError (158-159)
infrahub_sdk/protocols.py (1)
  • IpamNamespace (587-588)
tests/integration/conftest.py (1)
  • ipam_schema (159-201)
tests/integration/test_infrahub_client.py (3)
infrahub_sdk/constants.py (1)
  • InfrahubClientMode (4-7)
infrahub_sdk/types.py (1)
  • Order (71-72)
tests/unit/sdk/conftest.py (1)
  • client (32-33)
tests/integration/test_export_import.py (6)
infrahub_sdk/exceptions.py (1)
  • SchemaNotFoundError (58-62)
infrahub_sdk/testing/schemas/car_person.py (6)
  • SchemaCarPerson (43-253)
  • person_joe (169-172)
  • person_jane (175-178)
  • tag_blue (201-204)
  • tag_red (207-210)
  • tag_green (213-216)
infrahub_sdk/transfer/exceptions.py (1)
  • TransferFileNotFoundError (7-7)
infrahub_sdk/transfer/exporter/json.py (2)
  • LineDelimitedJSONExporter (24-169)
  • export (101-169)
infrahub_sdk/transfer/importer/json.py (2)
  • LineDelimitedJSONImporter (27-200)
  • import_data (54-99)
infrahub_sdk/transfer/schema_sorter.py (1)
  • InfrahubSchemaTopologicalSorter (13-33)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: integration-tests-latest-infrahub
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (22)
changelog/187.fixed.md (1)

1-1: LGTM!

The changelog entry accurately summarizes the PR's work to convert and re-enable the integration test suite.

pyproject.toml (1)

350-352: LGTM!

The restructuring consolidates per-file ignores by excluding the entire tests/integration/ directory, with specific exceptions for test files that have many test methods (PLR0904). This approach improves maintainability while addressing the "too many public methods" warnings appropriately.

tests/integration/test_repository.py (2)

9-10: LGTM!

Proper use of TYPE_CHECKING to conditionally import Path for type hints without runtime overhead.


16-16: LGTM!

Type annotation correctly added for the remote_repos_dir parameter. This improves static type checking and aligns with the coding guideline to use type hints on all function signatures.

tests/integration/test_schema.py (4)

1-2: LGTM!

Type imports correctly added to support the new test methods. The Any type is appropriately used for schema fixture typing, and NodeSchemaAPI is used for runtime type validation in tests.

Also applies to: 7-7


18-24: LGTM!

The test correctly validates schema retrieval by checking for expected namespaces and built-in types. The use of NodeSchemaAPI for type validation is appropriate.


26-31: LGTM!

The test correctly validates both schema retrieval and caching behavior for a specific kind. The cache assertion ensures the schema manager is functioning as expected.


33-45: LGTM!

The test correctly validates loading multiple schemas with convergence. The pattern of loading with wait_until_converged=True followed by refresh=True ensures the schemas are both processed server-side and visible in the client cache.

tests/integration/test_convert_object_type.py (2)

4-4: LGTM!

Proper use of TYPE_CHECKING to conditionally import client types for type hints. This avoids runtime import overhead while enabling static type checking.

Also applies to: 12-13


69-71: LGTM!

Type annotations correctly added for all parameters. The test appropriately receives both async and sync client fixtures to test the convert_object_type method in both modes while using async operations for setup and verification.

tests/integration/test_object_store.py (1)

1-25: LGTM!

The test follows the testcontainers pattern correctly by inheriting from TestInfrahubDockerClient. Type hints are properly applied, and the test logic for upload/retrieval verification is sound. Based on learnings, this correctly uses testcontainers to interact with a real Infrahub instance.

tests/integration/test_infrahub_client_sync.py (1)

26-353: Well-structured sync client test suite.

The TestInfrahubClientSync class provides comprehensive coverage of the synchronous client API including branch management, node operations, filtering, profiles, tasks, and tracking mode. The xfail markers appropriately document known issues and version requirements.

tests/integration/conftest.py (1)

14-201: LGTM!

The schema fixtures are well-typed and provide reusable schema definitions for integration tests. The module scope is appropriate since these schemas are static and can be shared across tests within a module.

tests/integration/test_infrahubctl.py (1)

81-165: LGTM!

The CLI integration tests properly verify both transform and generator commands with and without node conversion. The test assertions correctly validate the expected output structures.

tests/integration/test_infrahub_client.py (2)

356-380: Potential async/sync mismatch on relationship access.

Line 379 uses site_node.parent.get() without await. If parent is a relationship that requires fetching, this might need to be await site_node.parent.get() or the relationship should be fetched first. However, since populate_store=True was used on line 373, the parent node may already be in the store, making the sync access valid.

Please verify that parent.get() works synchronously when populate_store=True is used, or if it should be await parent.get().


23-354: Comprehensive async client test suite.

The TestInfrahubNode class provides thorough coverage of the async client API including branch operations, node CRUD, filtering, profiles, tasks, and tracking mode with proper rollback verification. The xfail markers appropriately document known issues.

tests/integration/test_export_import.py (2)

25-188: LGTM!

The TestSchemaExportImportBase class provides thorough coverage of the export/import workflow, including edge cases like exporting before schema loading, importing with existing data (idempotency), and error handling for invalid directories.


190-327: LGTM!

The TestSchemaExportImportManyRelationships class properly tests the export/import workflow for many-to-many relationships, ensuring relationship counts are preserved after import.

tests/integration/test_node.py (4)

415-417: Potential type mismatch in IP address assertion.

Line 417 compares fetched_device.primary_address.peer.address.value (likely a string like "192.168.0.1/32") with ipaddress.ip_interface("192.168.0.1/32") (an IPv4Interface object). This comparison may fail unless address.value returns an ip_interface object.

Please verify that address.value returns an ipaddress.ip_interface object, or adjust the assertion:

-        assert fetched_device.primary_address.peer.address.value == ipaddress.ip_interface("192.168.0.1/32")
+        assert str(fetched_device.primary_address.peer.address.value) == "192.168.0.1/32"

142-193: LGTM!

The tests for _generate_input_data, property creation, and the new relationship management tests (test_relationship_manager_errors_without_fetch, test_relationships_not_overwritten) provide valuable coverage for edge cases and ensure proper error handling.


296-324: Good idempotency test coverage.

The test_node_update_idempotency test properly validates that re-saving a node with unchanged values doesn't generate unnecessary update data, which is important for performance and avoiding spurious mutations.


326-417: LGTM for IPAM pool tests!

The TestNodeWithPools class provides good coverage for IP address pool functionality including device creation from pools, idempotent allocation, and updating existing assignments. The fixtures properly set up the IPAM infrastructure.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
tests/integration/test_infrahub_client_sync.py (1)

271-332: Consider exposing a public method for retrieving the generated group name.

Lines 292, 303, 314, and 329 access client_sync.group_context._generate_group_name(), a private method. While this pattern is acceptable here since no public API exists and the method is explicitly unit tested, it would be cleaner to expose a public get_group_name() method on group_context to avoid relying on private implementation details.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c5b7aa6 and 0c798dc.

📒 Files selected for processing (1)
  • tests/integration/test_infrahub_client_sync.py
🧰 Additional context used
📓 Path-based instructions (3)
**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

**/*.py: Use type hints on all function signatures
Never mix async/sync inappropriately
Never bypass type checking without justification

Files:

  • tests/integration/test_infrahub_client_sync.py
tests/**/*.py

📄 CodeRabbit inference engine (tests/AGENTS.md)

tests/**/*.py: Use httpx_mock fixture for HTTP mocking in tests instead of making real HTTP requests
Do not add @pytest.mark.asyncio decorator to async test functions (async auto-mode is globally enabled)

Files:

  • tests/integration/test_infrahub_client_sync.py
tests/integration/**/*.py

📄 CodeRabbit inference engine (tests/AGENTS.md)

tests/integration/**/*.py: Integration tests should use testcontainers to interact with real Infrahub instances
Clean up resources in integration tests

Files:

  • tests/integration/test_infrahub_client_sync.py
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: tests/AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:37.990Z
Learning: Applies to tests/integration/**/*.py : Integration tests should use testcontainers to interact with real Infrahub instances
📚 Learning: 2025-12-10T17:13:37.990Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: tests/AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:37.990Z
Learning: Applies to tests/integration/**/*.py : Integration tests should use testcontainers to interact with real Infrahub instances

Applied to files:

  • tests/integration/test_infrahub_client_sync.py
📚 Learning: 2025-12-10T17:13:29.593Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: infrahub_sdk/pytest_plugin/AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:29.593Z
Learning: Applies to infrahub_sdk/pytest_plugin/**/*.yaml : Use YAML test format with required fields: `infrahub_tests`, `resource`, `resource_name`, `tests` array containing `name`, `spec.kind`, `input`, and `output`

Applied to files:

  • tests/integration/test_infrahub_client_sync.py
📚 Learning: 2025-12-10T17:13:08.136Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:08.136Z
Learning: Applies to infrahub_sdk/**/*.py : Follow async/sync dual pattern for new features in the Python SDK

Applied to files:

  • tests/integration/test_infrahub_client_sync.py
📚 Learning: 2025-12-10T17:13:08.136Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:08.136Z
Learning: Applies to **/*.py : Never mix async/sync inappropriately

Applied to files:

  • tests/integration/test_infrahub_client_sync.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: unit-tests (3.11)
  • GitHub Check: unit-tests (3.14)
  • GitHub Check: unit-tests (3.13)
  • GitHub Check: unit-tests (3.12)
  • GitHub Check: unit-tests (3.10)
  • GitHub Check: documentation
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (6)
tests/integration/test_infrahub_client_sync.py (6)

1-40: LGTM!

The imports, class structure, and base dataset fixture are well-organized. The async fixture correctly uses the async client for test setup.


334-354: LGTM!

The recorder and playback test is well-structured. It correctly creates a fresh client for recording and validates playback functionality with proper assertions.


356-380: LGTM!

The hierarchical schema tests are correctly implemented with synchronous methods matching the synchronous client usage. The past async/sync mismatch has been properly addressed.


42-270: LGTM!

The test methods comprehensively cover client functionality including branch operations, node retrieval, filtering, counting, profiles, and task management. All methods correctly use synchronous APIs with proper type hints and assertions.


333-333: Issue #733 remains open and unresolved; xfail marker should remain.

Issue #733 ("task: JSONPlayback can be tricky to test") is still in OPEN state and has not been closed. The xfail marker is correctly applied and should not be removed at this time.


164-164: Remove or update xfail marker—v1.7 requirement is likely outdated.

The xfail marker referencing "Require Infrahub v1.7" appears outdated. The SDK version is 1.17.0 and integration tests run against a locally built Infrahub instance (INFRAHUB_IMAGE_VER: "local" in CI), not a pinned v1.7 release. Test whether test_profile_relationship_is_from_profile passes without the xfail marker. If it passes, remove the marker. If it fails, replace the reason with a reference to the specific blocking issue.

Copy link
Contributor

@ogenstad ogenstad left a comment

Choose a reason for hiding this comment

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

Great initiative!

@gmazoyer gmazoyer merged commit 4b70399 into infrahub-develop Jan 2, 2026
21 checks passed
@gmazoyer gmazoyer deleted the gma-20251231-187 branch January 2, 2026 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants