package host import "testing" // The root's held-release route is registered only with both flags on // (whole-branch fixes, item 6): heldReleaseRouteHandler is nil with // CARLOS_MOVES_PHASE1 off, so instancectl registers nothing and main's 404 // stands; with both on it is the claim root, which answers the path // itself (refusing while no held release is wired). func TestHeldReleaseRouteOnlyWithBothFlags(t *testing.T) { root := ClaimRootWithLaunch{} off := func(k string) string { if k == "CARLOS_HOST_CLAIM" { return "1" } return "" } if h := heldReleaseRouteHandler(root, off); h != nil { t.Fatalf("moves off: %v", h) } both := func(string) string { return "1" } if h := heldReleaseRouteHandler(root, both); h == nil { t.Fatal("both flags on: no route") } if h := heldReleaseRouteHandler(root, func(string) string { return "" }); h != nil { t.Fatalf("claim off: %v", h) } }