mirror of
https://github.com/yannh/kubeconform.git
synced 2026-02-11 05:59:22 +00:00
chore: print the url of failed download (#96)
This commit is contained in:
parent
c5f7348af8
commit
932b35d71f
2 changed files with 17 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue