Skip to content

Integration test harness reference

Catalog of helpers, test packages, and invariants for the internal/testsupport/integrationtest package. For when and how to use the harness, see Integration test harness; for how the stack is composed and why, see How the integration test harness works.

  • Package: github.com/holomush/holomush/internal/testsupport/integrationtest
  • Build tag: //go:build integration — the harness is NEVER linked into production binaries.
PackageOrigin epicWhat it asserts
test/integration/privacy/iwztI-PRIV-1..7 history-scope privacy invariants
test/integration/presence/5b2jAC4 (joiner sees prior presence), AC3 / I-PRES-2 (floor bypass)

When you add a new test package that uses the harness, append it to this table.

HelperPurpose
Start(t, opts...) *ServerBoot the stack. Default ABAC engine is allow-all.
Server.Stop()Idempotent teardown.
WithPolicyEngine(eng) StartOptionOverride the default ABAC engine (e.g., DenyAllEngine).
HelperReal-path?
Server.ConnectGuest(ctx) *SessionYes — CreateGuest RPC + SelectCharacter RPC
Server.ConnectAuthed(ctx, name) *SessionMixed — direct character/player creation, then SelectCharacter RPC
Server.ConnectAuthedWithRoles(ctx, name, roles)Mixed — same as above + direct role insertion
Session.SendCommand(ctx, cmd) errorYes — HandleCommand RPC (dispatcher has empty registry, so most commands fail by design)
Session.Logout(ctx)Yes — Logout RPC
Session.QueryStreamHistory(ctx, stream)Yes — QueryStreamHistory RPC
Session.ListFocusPresence(ctx)Yes — ListFocusPresence RPC
Session.EmitDirectEvent(ctx, stream, evType, payload)Yes — eventbus.Publisher.Publish (production publisher path)

These bypass the production pipeline via direct SQL. Each helper’s doc comment notes what it bypasses and why.

HelperWhat it bypasses
Server.NewLocation(ctx) ulid.ULIDBypasses WorldService.CreateLocation; direct repo write.
Server.NewSceneWithoutMember(ctx) ulid.ULIDDelegates to NewLocation (scenes share location PK namespace).
Server.ExpireSession(ctx, sessionID)Forces status='expired' + past expires_at directly.
Server.SetLocationArrivedAt(ctx, sessionID, t)Forces a specific floor timestamp; mirrors post-MovementHook state.
Server.DeleteCharacter(ctx, charID)Cascades cleanup across sessions, player_character_bindings, character_roles, objects (FK-safe order).
Server.DeleteSession(ctx, sessionID)Direct DELETE FROM sessions; cascades to session_connections.
Session.MoveTo(ctx, newLocationID)Updates session row’s location_id + location_arrived_at; does NOT update characters.location_id.
HelperPurpose
Server.GameID() stringReturns the embedded bus’s game ID ("main" by default). Used to construct dot-style NATS subjects like events.<gameID>.scene.<id>.ic.

Whole-system plugin tier (WithInTreePlugins)

Section titled “Whole-system plugin tier (WithInTreePlugins)”

The whole-system tier is the top Go-fidelity integration tier (see the canonical tier table in .claude/rules/testing.md). To opt in and build the prerequisite binary plugins, see Opt into the whole-system plugin tier.

What loads: discover-all finds 8 runtime plugins — 5 core Lua plugins (core-aliases, core-building, core-communication, core-help, core-objects), 1 additional Lua plugin (echo-bot), and 2 binary plugins (core-scenes, test-abac-widget). The 2 setting plugins (setting-crossroads / setting-skeleton, manifest names crossroads / skeleton) are configuration-only: they fall through to loadPlugin’s default branch, which logs a warning and skips them, so they are not registered in the Manager’s loaded set.

Accessors: PluginManager(), CommandRegistry(), and ServiceRegistry() are only valid when WithInTreePlugins was passed; calling them otherwise panics with a clear message.

PackageOrigin epicWhat it asserts
test/integration/wholesystem/0f0f4INV-5: all in-tree plugins load; help command registered

When you add a test package that uses WithInTreePlugins, append it to this table and to the main “Test packages currently using the harness” table above.

#InvariantEnforcement
INV-5The whole-system suite MUST load all in-tree plugins via Manager.LoadAllRouting through PluginSubsystem.Start; census asserts full plugin set
INV-WS-1WithInTreePlugins MUST reuse setup.PluginSubsystem, not fork plugins.NewManager directlyMeta-test TestWithInTreePluginsReusesSubsystem source-scans integrationtest/
INV-WS-3Whole-system suite MUST NOT be silently skipped in CIHOLOMUSH_REQUIRE_PLUGINS=1 converts the missing-artifact skip to t.Fatalf; CI’s task test:int runs plugin:build-all first
INV-WS-4WithInTreePlugins MUST be opt-in; omitting it leaves harness plugin-freeExisting targeted suites pass with no edits; harness test asserts no plugin subsystem starts by default
  • internal/eventbus/eventbustest/ — bus-only harness for unit tests that need an embedded NATS but not a full CoreServer.
  • internal/access/policy/policytest/AllowAllEngine / DenyAllEngine / GrantEngine helpers used with WithPolicyEngine.
  • test/testutil/ — shared Postgres testcontainer + fresh-database helpers.