diff --git a/pkg/registry/http.go b/pkg/registry/http.go index 7bfbf44..ecf5ede 100644 --- a/pkg/registry/http.go +++ b/pkg/registry/http.go @@ -80,7 +80,7 @@ func (r SchemaRegistry) DownloadSchema(resourceKind, resourceAPIVersion, k8sVers } if resp.StatusCode != http.StatusOK { - return nil, fmt.Errorf("error while downloading schema - received HTTP status %d", resp.StatusCode) + return nil, fmt.Errorf("error while downloading schema at %s - received HTTP status %d", url, resp.StatusCode) } body, err := ioutil.ReadAll(resp.Body) diff --git a/pkg/registry/http_test.go b/pkg/registry/http_test.go index 3885b70..6abffaa 100644 --- a/pkg/registry/http_test.go +++ b/pkg/registry/http_test.go @@ -61,6 +61,22 @@ func TestDownloadSchema(t *testing.T) { nil, fmt.Errorf("no schema found"), }, + { + "getting 503", + newMockHTTPGetter(func(url string) (resp *http.Response, err error) { + return &http.Response{ + StatusCode: http.StatusServiceUnavailable, + Body: ioutil.NopCloser(strings.NewReader("http response mock body")), + }, nil + }), + "http://kubernetesjson.dev", + true, + "Deployment", + "v1", + "1.18.0", + nil, + fmt.Errorf("error while downloading schema at http://kubernetesjson.dev - received HTTP status 503"), + }, { "200", newMockHTTPGetter(func(url string) (resp *http.Response, err error) {