Integration Test Patterns
Recipes for testing Nimbus licensing flows end-to-end without hitting live KeyAuth.
Mock the License Server
Replace the real KeyAuth endpoint with a local HTTP interceptor. Return signed Ed25519 payloads that match your test fixture keys so the loader's verify step passes deterministically.
POST /api/1.2/ ?type=init
→ 200 { "success": true, "sessionid": "test-session" }
POST /api/1.2/ ?type=license&key=TEST-KEY
→ 200 { "success": true, "response": "<signed-ed25519-blob>" }Fingerprint Stubbing
Override the hardware-fingerprint collector with a static hash. This keeps license-bound identity stable across CI runners and containerized environments.
// In test harness — inject before loader init
set_fingerprint_override("deadbeef-fixed-hw-id");Offline Grace Cache
Write a pre-signed HMAC cache file to disk before the test. The loader reads it, validates the HMAC against a test secret, and skips the network round-trip entirely.
echo -n "license-valid-until=2099-12-31" | \ openssl dgst -sha256 -hmac "test-hmac-secret" \ > nimbus_cache.bin
CI Pipeline Snippet
Wire the mock server, stub the fingerprint, seed the cache, then run the loader in headless mode. Assert exit code 0 and check stdout for the license-valid token.
# .github/workflows/test.yml
- name: Integration smoke
run: |
python3 mock_keyauth.py &
export NIMBUS_FINGERPRINT_OVERRIDE=ci-stub
./nimbus_loader --headless --cache nimbus_cache.bin
echo "Exit: $?"These patterns ship with the Meridian SDK in tests/integration/. Run them locally with cargo test -- --include-ignored.