Skip to content

Commit 136deca

Browse files
committed
Test image tag readiness errors
1 parent 6fa3940 commit 136deca

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

pkg/cmd/imagecmd_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,18 @@ func TestTagCommandFallsBackToDockerWhenHypemanMisses(t *testing.T) {
106106
})
107107
require.ErrorContains(t, err, "was not found in Hypeman; stage it from Docker")
108108
}
109+
110+
func TestTagCommandPropagatesNotReady(t *testing.T) {
111+
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
112+
w.Header().Set("Content-Type", "application/json")
113+
w.WriteHeader(http.StatusConflict)
114+
_, _ = w.Write([]byte(`{"code":"image_not_ready","message":"image is not ready"}`))
115+
}))
116+
defer server.Close()
117+
118+
err := Command.Run(context.Background(), []string{
119+
"hypeman", "--base-url", server.URL,
120+
"tag", "alpine:pending", "myapp:latest",
121+
})
122+
require.ErrorContains(t, err, "image is not ready")
123+
}

0 commit comments

Comments
 (0)