5.0 KiB
Test Scenarios for NetBird GitOps PoC
Test instance: vps-a.networkmonitor.cc
State file: state/test.json
Gitea: gitea.vps-a.networkmonitor.cc
Current state on the instance: 2 groups, 3 setup keys, 1 policy, 1 user.
Each scenario: create a branch, edit state/test.json, push, open PR (dry-run),
review plan, merge (apply), verify on NetBird dashboard.
Scenario 1: Add a new group and policy
Goal: Verify creating multiple resources in one PR.
Changes to state/test.json:
Add a new group observers and a policy allowing observers to see
ground-stations:
"groups": {
"ground-stations": { "peers": [] },
"pilots": { "peers": [] },
"observers": { "peers": [] }
},
"policies": {
"pilots-to-gs": { ... },
"observers-to-gs": {
"description": "Observers can view ground stations",
"enabled": true,
"sources": ["observers"],
"destinations": ["ground-stations"],
"bidirectional": false,
"protocol": "all",
"action": "accept"
}
}
Expected dry-run:
- Create: group
observers, policyobservers-to-gs
Verify after merge:
- Dashboard shows the
observersgroup - Policy
observers-to-gsexists with correct sources/destinations
Scenario 2: Update an existing policy
Goal: Verify update detection works.
Changes to state/test.json:
Disable the pilots-to-gs policy:
"pilots-to-gs": {
"enabled": false,
...
}
Expected dry-run:
- Update: policy
pilots-to-gs
Verify after merge:
- Policy shows as disabled on the dashboard
Scenario 3: Delete a resource
Goal: Verify deletion works safely.
Changes to state/test.json:
Remove Pilot-Vlad-2 from setup_keys (delete the entire key).
Expected dry-run:
- Delete: setup_key
Pilot-Vlad-2
Verify after merge:
- Setup key no longer appears on the dashboard
Scenario 4: Enroll a peer (full lifecycle)
Goal: Verify the enrollment detection and peer rename flow.
Prerequisite: Runner and Gitea token must be configured for the reconciler poller. Run ansible-playbook with filled vault.yml first.
Steps:
-
Make sure
state/test.jsonhas an unenrolled setup key, e.g.:"GS-TestHawk-1": { "type": "one-off", "expires_in": 604800, "usage_limit": 1, "auto_groups": ["ground-stations"], "enrolled": false } -
Copy the setup key value from the NetBird dashboard (or from a previous reconcile run's created_keys output)
-
Enroll a peer:
sudo netbird up --management-url https://vps-a.networkmonitor.cc --setup-key <KEY> -
Wait for the poller to detect enrollment (~30 seconds)
-
Verify:
- Peer is renamed to
GS-TestHawk-1on the dashboard state/test.jsonin Gitea repo has"enrolled": truefor that key- The commit was made by the reconciler automatically
- Peer is renamed to
Scenario 5: Multi-resource create (bigger change)
Goal: Test a realistic initial deployment scenario.
Changes to state/test.json:
Add network, posture check, and DNS in one PR:
"posture_checks": {
"geo-restrict-ua": {
"description": "Allow only UA/PL locations",
"checks": {
"geo_location_check": {
"locations": [
{ "country_code": "UA" },
{ "country_code": "PL" }
],
"action": "allow"
}
}
}
},
"dns": {
"nameserver_groups": {
"cloudflare": {
"nameservers": [
{ "ip": "1.1.1.1", "ns_type": "udp", "port": 53 }
],
"domains": [],
"enabled": true,
"primary": true,
"groups": ["pilots", "ground-stations"]
}
}
}
Expected dry-run:
- Create: posture_check
geo-restrict-ua, dnscloudflare
Verify after merge:
- Posture check appears in dashboard
- DNS nameserver group exists
Scenario 6: No-op (idempotency check)
Goal: Verify that pushing state that matches what's already deployed produces no operations.
Steps:
-
Export current state:
deno task export -- \ --netbird-api-url https://vps-a.networkmonitor.cc/api \ --netbird-api-token <TOKEN> > state/test.json -
Push to a branch, open PR
-
Expected dry-run: "No changes detected."
Scenario 7: Conflicting change (error handling)
Goal: Verify the reconciler handles errors gracefully.
Steps:
-
Reference a group that doesn't exist in a policy:
"bad-policy": { "enabled": true, "sources": ["nonexistent-group"], "destinations": ["pilots"], "bidirectional": true } -
This should fail schema validation before hitting the API.
-
Expected: CI job fails with a clear error message.
Quick reference
# Create test branch
git checkout -b test-scenario-N
# Edit state/test.json
# Push and open PR
git push poc test-scenario-N
# After testing, clean up
git checkout main && git branch -D test-scenario-N