Download this file
| 1 | package hostguard |
| 2 | |
| 3 | import ( |
| 4 | "github.com/carlosframework/platform/internal/hostclaim" |
| 5 | "testing" |
| 6 | ) |
| 7 | |
| 8 | func TestPlan11Fix1RelocationWriterStopAuthority(t *testing.T) { |
| 9 | for _, phase := range []string{"probing", "serving"} { |
| 10 | for _, fault := range []string{"none", "source", "region", "session", "duplicate", "phase", "warm"} { |
| 11 | t.Run(phase+"/"+fault, func(t *testing.T) { |
| 12 | c, target := plan9D4Writer(phase) |
| 13 | c.Op.Kind = hostclaim.KindRelocating |
| 14 | switch fault { |
| 15 | case "source": |
| 16 | c.Holder.WriterBox = "source" |
| 17 | case "region": |
| 18 | target.Region = "other" |
| 19 | case "session": |
| 20 | target.ObligationID = WriterStopObligation(9) |
| 21 | case "duplicate": |
| 22 | c.Holder.Admissions = append(c.Holder.Admissions, c.Holder.Admissions[1]) |
| 23 | case "phase": |
| 24 | c.Op.Phase = "releasing" |
| 25 | target.Phase = "releasing" |
| 26 | case "warm": |
| 27 | c.Holder.Admissions[1].Mode = "warm" |
| 28 | } |
| 29 | if got := StopAuthorityMatches(c, target); got != (fault == "none") { |
| 30 | t.Fatalf("authority=%v", got) |
| 31 | } |
| 32 | }) |
| 33 | } |
| 34 | } |
| 35 | } |
| 36 | |