Skip to content

test: integration harness for standalone→central migration#32

Merged
bodaay merged 2 commits into
masterfrom
test/integration-harness
Jun 8, 2026
Merged

test: integration harness for standalone→central migration#32
bodaay merged 2 commits into
masterfrom
test/integration-harness

Conversation

@bodaay

@bodaay bodaay commented Jun 8, 2026

Copy link
Copy Markdown
Owner

Self-contained multi-container integration harness under test/integration/does not touch the production docker-compose.yml. Exercises the v2.2 migration feature across real container boundaries (real TLS push, real cross-install HTTP) that the Go unit tests can't reach.

Phase 1 (this PR, green)

postgres + central (Postgres, serves HTTPS) + standalone-local (BoltDB, local accounts) migrating in over TLS the standalone actually verifies (internal CA, SSL_CERT_FILE). The Go driver (//go:build integration, reuses internal/migrate types) seeds, mints a token, asserts the cleartext-http push is refused, runs preflight→commit, verifies the import landed, and logs the migrated user into the central with her carried hash — asserting roles, perms, and the carried audience.

cd test/integration && make test    # up → driver → assert → down

Excluded from go build/vet/test ./... by the integration tag, so the release gate is unaffected.

Phase 2 (incoming on this branch)

LDAP/AD nodes (vanilla OpenLDAP, username_attr=uid) for same-AD (policy-only migration, AD re-bind on the central), different-AD (preflight blocks), central-not-on-AD (blocks), and a direct app.

🤖 Generated with Claude Code

bodaay and others added 2 commits June 8, 2026 01:54
…ation

Self-contained multi-container harness under test/integration/ (does NOT touch
the production docker-compose.yml). Phase 1: a Postgres-backed central serving
HTTPS + a BoltDB local-accounts standalone that migrates into it over real
cross-container TLS.

- docker-compose.yml: postgres + central (TLS, cert SAN=central/localhost) +
  standalone-local (HTTP, trusts the internal CA via SSL_CERT_FILE).
- certs/gen.sh: internal CA + central cert (generated certs are gitignored).
- driver_test.go (//go:build integration): seeds the standalone, mints a token on
  the central, asserts the cleartext-http push is refused, runs preflight+commit
  over TLS, verifies the import landed, and logs the migrated user into the
  CENTRAL with her carried password hash — asserting roles, permissions, and the
  CARRIED audience.
- Makefile (make up / test / down), README.

Excluded from the normal build by the `integration` tag, so `go build/vet/test
./...` (the release gate) is unaffected. Verified green end-to-end locally.

Phase 2 (planned): LDAP/AD nodes for same-AD (policy-only), different-AD (blocked)
and a direct app.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…irect)

Extends the harness with two OpenLDAP directories and AD-backed standalones,
proving the AD half of the migration matrix end to end:

- ldap-corp (corp.local) + ldap-other (other.local): vanilla OpenLDAP seeded via
  LDIF. SimpleAuth uses username_attr=uid, so User.SAMAccountName comes from `uid`
  and no samba schema is needed; AD users are provisioned via login/JIT.
- standalone-ad (same AD as central) + standalone-addiff (different AD).
- ad_test.go (TestADMigrationScenarios):
  * same-AD  -> POLICY-ONLY migration (no record/password copied, local_users=0);
    the AD user re-binds from the same AD on the central and resolves his role.
  * different-AD -> blocked at preflight + commit refused (409).
  * direct app -> an app registered straight on the central; AD user authenticates
    directly (no migration).

Also: phase-1 driver now asserts the CARRIED source audience (not the target app
id), and the README/topology reflect the full topology.

All scenarios green; release gate (`go build/vet/test ./...`) unaffected (the
driver is behind the `integration` tag).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@bodaay bodaay merged commit f573974 into master Jun 8, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant