Add NAT-tier resources and testcontainers integration tests #4

Merged
benvin merged 1 commits from benvin/longtail-resources into main 2026-07-20 23:46:19 +10:00
Owner

Why

The control plane stored zones/groups/rules but not the NAT tier you called out (masquerade, netmap, 1:1 nat). This adds those as terraformable resources, and adds real integration coverage against Postgres (previously the store/server were only unit-tested).

Changes

  • Add snat/masquerade, netmap, and 1:1 nat resources: migration 0003 (verified against Postgres 17), model types, id-keyed store CRUD that bumps the config generation, and REST handlers.
  • Add a testcontainers-backed store integration suite: CRUD lifecycle, generation bumping on write/delete, source/dest grammar validation at the store boundary, NAT round-trip, and device→nat FK cascade. Verified green against a real Postgres.
  • The suite self-skips under go test -short (the CI path), so a container runtime is only needed for the full run.

Follow-ups

  • Compiler rendering of the NAT tier into per-device configs (these are stored/terraformable now, not yet compiled).
  • Terraform provider resources for snat/netmap/nat.
  • Remaining long-tail sections (providers, routes, tc, conntrack, blrules).
## Why The control plane stored zones/groups/rules but not the NAT tier you called out (masquerade, netmap, 1:1 nat). This adds those as terraformable resources, and adds real integration coverage against Postgres (previously the store/server were only unit-tested). ## Changes - Add `snat`/masquerade, `netmap`, and 1:1 `nat` resources: migration 0003 (verified against Postgres 17), model types, id-keyed store CRUD that bumps the config generation, and REST handlers. - Add a testcontainers-backed store integration suite: CRUD lifecycle, generation bumping on write/delete, source/dest grammar validation at the store boundary, NAT round-trip, and device→nat FK cascade. Verified green against a real Postgres. - The suite self-skips under `go test -short` (the CI path), so a container runtime is only needed for the full run. ## Follow-ups - Compiler rendering of the NAT tier into per-device configs (these are stored/terraformable now, not yet compiled). - Terraform provider resources for snat/netmap/nat. - Remaining long-tail sections (providers, routes, tc, conntrack, blrules).
unkinben added 1 commit 2026-07-20 22:25:49 +10:00
Add NAT-tier resources and testcontainers integration tests
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
5060804359
- Add snat/masquerade, netmap, and 1:1 nat as stored, terraformable resources:
  migration 0003, model types, store CRUD (id-keyed, generation-bumping), and
  REST handlers. These are the global-intent/device-resolved NAT tier; compiler
  rendering of NAT into per-device configs is a tracked follow-up.
- Add a testcontainers-backed store integration suite exercising the CRUD
  lifecycle, generation bumping, source/dest grammar validation, and FK cascade
  against a real Postgres. It self-skips under 'go test -short' (the CI path) so
  a container runtime is only needed for the full run.
benvin merged commit b350c8d198 into main 2026-07-20 23:46:19 +10:00
benvin deleted branch benvin/longtail-resources 2026-07-20 23:46:20 +10:00
Sign in to join this conversation.