feat: Add integration test framework and fix embedded vrf field#71
Merged
Conversation
Implement comprehensive integration testing infrastructure for Netbox API client with support for multiple Netbox versions and reproducible test execution without requiring live Netbox instances. Key components: - Declarative test definitions in YAML with version targeting - VCR.py-based HTTP recording/replay for deterministic tests - Tamper detection via lock files - Automated fixture generation from live Netbox instances - Multi-version Docker Compose setup (shared postgres/redis) - Consistency validation tests for fixture integrity Test workflow: 1. Define tests in tests/integration/definitions.yaml with target versions 2. Generate fixtures: `make fixtures` (requires Docker) 3. Run tests: `make test` (no Docker needed, uses recorded cassettes) Structure: - tests/integration/definitions.yaml - Shared test definitions - tests/integration/fixtures/vXX/ - Per-version cassettes and expected outputs - tests/integration/helpers.py - Utilities (lock files, version discovery) - tests/integration/generate_fixtures.py - Fixture generator - tests/integration/test_declarative.py - API behavior tests - tests/integration/test_consistency.py - Fixture integrity validation - compose.yaml - Multi-version Netbox setup with demo data Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
ipam_vlans() is not defined for the clients version other than v42.
% make docker
docker compose up -d --wait --wait-timeout 120
[+] up 8/8
✔ Container annetbox-redis-1 Healthy
✔ Container annetbox-postgres-1 Healthy
✔ Container annetbox-netbox-v37-1 Healthy
✔ Container annetbox-netbox-v41-1 Healthy
✔ Container annetbox-netbox-v42-1 Healthy
✔ Container annetbox-netbox-init-v41-1 Exited
✔ Container annetbox-netbox-init-v37-1 Exited
✔ Container annetbox-netbox-init-v42-1 Exited
% make fixtures
python -m tests.integration.generate_fixtures
Processing v37/
Ok: 9 Failed: 0
Processing v41/
Ok: 9 Failed: 0
Processing v42/
Ok: 10 Failed: 0
Problem summary:
* v42 there are two Vrf classes.
* v37 does not return description for Vrf.
Change summary:
v37:
* rename embedded vrf: Vrf -> VrfBrief
* remove description field from VrfBrief
v41:
* rename embedded vrf: Vrf -> VrfBrief
v42:
* rename embedded vrf: Vrf -> VrfBrief
Tishka17
approved these changes
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Integration Test Framework
Test Infrastructure
Developer Workflow
Structure
Known limitations
localhost:{8037,8041,8042}Bug Fixes
Model Updates (v3.7, v4.1, v4.2)
Misc