Download this file
| 1 | package console |
| 2 | |
| 3 | import ( |
| 4 | "net/http" |
| 5 | "testing" |
| 6 | ) |
| 7 | |
| 8 | // Final review carry item: a console with no deployment bucket answers its |
| 9 | // operator doors with the door's own failure sentence and a 503, instead of |
| 10 | // panicking in the store read. |
| 11 | func TestOperatorDoorsWithNoDeploymentBucket(t *testing.T) { |
| 12 | fx := legacyFixture(t, "code-no-bucket") |
| 13 | fx.srv.cfg.Releases = nil |
| 14 | for _, c := range []struct { |
| 15 | path string |
| 16 | body map[string]any |
| 17 | want string |
| 18 | }{ |
| 19 | {"/api/cli/system/seeds-floor", map[string]any{"min_release": "v0.27.0"}, "could not publish the seeds floor. Try again."}, |
| 20 | {"/api/cli/system/legacy-routes", map[string]any{"name": "shop", "to": "cdef/shop"}, "could not read the legacy route assignments. Try again."}, |
| 21 | } { |
| 22 | st, out := postJSON(t, fx.ts.URL+c.path, c.body, fx.owner) |
| 23 | if st != http.StatusServiceUnavailable || str(t, out, "error") != c.want { |
| 24 | t.Errorf("%s = %d %v, want 503 %q", c.path, st, out, c.want) |
| 25 | } |
| 26 | } |
| 27 | } |
| 28 | |