Download this file
| 1 | package release_test |
| 2 | |
| 3 | import ( |
| 4 | "strings" |
| 5 | "testing" |
| 6 | |
| 7 | "github.com/carlosframework/platform/internal/release" |
| 8 | ) |
| 9 | |
| 10 | // canary -> stable is the jump that would make the ladder decorative: it is |
| 11 | // exactly what a production app parked on a migration canary channel would do |
| 12 | // if nothing stopped it. |
| 13 | func TestCanaryToStableIsRefused(t *testing.T) { |
| 14 | err := release.PromotionAllowed(release.RungCanary, release.RungStable) |
| 15 | if err == nil { |
| 16 | t.Fatal("canary -> stable was ALLOWED — the ladder is decorative") |
| 17 | } |
| 18 | if !strings.Contains(err.Error(), "-hotfix") { |
| 19 | t.Errorf("refusal %q does not name --hotfix", err) |
| 20 | } |
| 21 | t.Logf("refusal: %v", err) |
| 22 | // And the same jump for beta, for completeness. |
| 23 | if release.PromotionAllowed(release.RungCanary, release.RungBeta) == nil { |
| 24 | t.Error("canary -> beta was allowed") |
| 25 | } |
| 26 | } |
| 27 | |