Add integration tests for file objects#802
Conversation
These tests won't pass yet, as we need the upcoming Infrahub 1.8 to run them, hence marking them as XFAIL for now.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Tip We've launched Issue Planner and it is currently in beta. Please try it out and share your feedback on Discord! 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. Comment |
Deploying infrahub-sdk-python with
|
| Latest commit: |
5d9bad8
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://b1a2f68d.infrahub-sdk-python.pages.dev |
| Branch Preview URL: | https://gma-20260206-ihs193-integrat.infrahub-sdk-python.pages.dev |
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## infrahub-develop #802 +/- ##
====================================================
+ Coverage 80.33% 80.50% +0.17%
====================================================
Files 115 118 +3
Lines 9865 10249 +384
Branches 1504 1547 +43
====================================================
+ Hits 7925 8251 +326
- Misses 1419 1462 +43
- Partials 521 536 +15
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
327143c to
7fc5250
Compare
| ) -> InfrahubNodeSync: | ||
| obj = client_sync.create(kind=TESTING_CIRCUIT, circuit_id="CIRCUIT-SYNC-001", bandwidth=2000) | ||
| obj.save() | ||
| return obj |
There was a problem hiding this comment.
I wonder if it's valuable to have this included in the SDK or if it should just be a fixture within the integration tests directory. Not a bit issue for me but do you think we'll use it outside of the SDK tests?
There was a problem hiding this comment.
I think it kinda highlight that the line I drew between SDK integration tests and backend integration tests is a bit blurry to me. I think I will remove these completely from the SDK as they don't seem very well suited here and we have something similar in the backend integration tests anyway.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@infrahub_sdk/testing/schemas/file_object.py`:
- Around line 70-82: The async fixture load_file_object_schema and the sync
fixture load_file_object_schema_sync call client.schema.load but don't check the
returned SchemaLoadResponse for errors; update both fixtures
(load_file_object_schema and load_file_object_schema_sync) to capture the
response (e.g., resp = await client.schema.load(...) and resp =
client_sync.schema.load(...)), inspect resp.errors, and if present raise an
exception (use raise GraphQLError(errors=[resp.errors]) as in the established
pattern) so schema load failures surface immediately.
🧹 Nitpick comments (1)
tests/integration/test_file_object.py (1)
36-73: Implicit test ordering dependency — tests must run in definition order.
test_create_file_object_with_uploadcreates contracts linked tocircuit_mainthattest_query_contracts_through_circuit_relationshiplater counts vialen(contract_refs) >= 2. Iftest_query_contracts_through_circuit_relationshipruns before the other tests, there may be fewer than 2 contracts linked to the circuit. This works only because pytest runs tests in definition order by default, but it's fragile.The
>=assertion at line 184 mitigates this somewhat, but it's worth noting the implicit ordering dependency.
These tests won't pass yet, as we need the upcoming Infrahub 1.8 to run them, hence marking them as XFAIL for now.
Summary by CodeRabbit