package tenantoverlay_test

import (
	"os"
	"testing"

	"github.com/pingcap-inc/nexuscrm-controlplane/internal/seamtestwiring"
)

// TestMain wires the control-plane seam ports before any tenantoverlay test runs.
//
// The tenantoverlay package no longer imports internal/bootstrap; its seam vars
// (schemaProvisioner, autoNumberSeeder) are declared nil and must be injected by
// a composition root. The tenantoverlay Apply path
// (pack.go: schemaProvisioner.ReconcileTableColumns,
// autoNumberSeeder.SeedAutoNumberCounters) is exercised by these tests via
// New(dir).Apply(...); without this wiring any test that reaches those calls
// nil-derefs. (Preflight-only tests error before the seam, but wiring here keeps
// every Apply path safe.)
//
// As of PR2 this wires the seams directly from the neutral homes
// (controlplane/bootstrapimpl + db) via the internal seamtestwiring helper —
// NOT through backend/pkg/serverruntime — so no file under the controlplane
// module imports backend (the controlplane->backend dependency PR2 severs).
func TestMain(m *testing.M) {
	seamtestwiring.Wire()
	os.Exit(m.Run())
}
