//go:build linux package host import ( "os" "testing" ) // Task 10b: the box's claim assembly is where its Reconciler is built // (OpenProductionClaimAssembly, whose adapter ClaimAssembly.Build copies). // It sets FenceClosed and HoldRow with CARLOS_REGION_HA on, and neither // with it off, so reconcile there is main's. func TestProductionClaimAssemblySetsTheSourceHoldOnlyWithRegionHA(t *testing.T) { fixtureWithoutRootMigrationCensus(t) for _, v := range []string{"", "0", "1"} { on := v == "1" t.Run("CARLOS_REGION_HA="+v, func(t *testing.T) { t.Setenv("CARLOS_REGION_HA", v) store, resources, owners, legacy := fix4JournalFixture(t) if err := os.Remove(legacy); err != nil { t.Fatal(err) } assembly, err := OpenProductionClaimAssembly(t.Context(), store, resources, owners) if err != nil { t.Fatal(err) } defer assembly.Close(t.Context()) r := assembly.Reconcile.Reconciler if (r.FenceClosed != nil) != on || (r.HoldRow != nil) != on { t.Fatalf("CARLOS_REGION_HA=%q: FenceClosed set %v, HoldRow set %v", v, r.FenceClosed != nil, r.HoldRow != nil) } }) } }