carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1package host
2
3import "testing"
4
5// The root's held-release route is registered only with both flags on
6// (whole-branch fixes, item 6): heldReleaseRouteHandler is nil with
7// CARLOS_MOVES_PHASE1 off, so instancectl registers nothing and main's 404
8// stands; with both on it is the claim root, which answers the path
9// itself (refusing while no held release is wired).
10func TestHeldReleaseRouteOnlyWithBothFlags(t *testing.T) {
11 root := ClaimRootWithLaunch{}
12 off := func(k string) string {
13 if k == "CARLOS_HOST_CLAIM" {
14 return "1"
15 }
16 return ""
17 }
18 if h := heldReleaseRouteHandler(root, off); h != nil {
19 t.Fatalf("moves off: %v", h)
20 }
21 both := func(string) string { return "1" }
22 if h := heldReleaseRouteHandler(root, both); h == nil {
23 t.Fatal("both flags on: no route")
24 }
25 if h := heldReleaseRouteHandler(root, func(string) string { return "" }); h != nil {
26 t.Fatalf("claim off: %v", h)
27 }
28}
29