| 408 | } |
| 409 | |
| 410 | func TestPullRegistryNotFound(t *testing.T) { |
| 411 | t.Parallel() |
| 412 | |
| 413 | // Use a test server that returns 404 for fast failure |
| 414 | server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 415 | w.WriteHeader(http.StatusNotFound) |
| 416 | })) |
| 417 | defer server.Close() |
| 418 | |
| 419 | // Extract host:port from server URL (remove http://) |
| 420 | registry := strings.TrimPrefix(server.URL, "http://") |
| 421 | |
| 422 | // Test various image references that should fail with 404 |
| 423 | refs := []string{ |
| 424 | registry + "/non-existent:latest", |
| 425 | registry + "/test:latest", |
| 426 | } |
| 427 | |
| 428 | for _, ref := range refs { |
| 429 | _, err := Pull(t.Context(), ref, false, crane.Insecure) |
| 430 | require.Error(t, err, "expected error for ref: %s", ref) |
| 431 | } |
| 432 | } |
| 433 | |
| 434 | func TestPullIntegration(t *testing.T) { |
| 435 | t.Parallel() |