Skip to content

Commit

Permalink
Merge pull request #1479 from Nordix/ensure-image-fix-download/adil
Browse files Browse the repository at this point in the history
🐛 EnsureImage download image fix
  • Loading branch information
metal3-io-bot authored Mar 4, 2024
2 parents 913ee7e + b963e37 commit 686d7e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions test/e2e/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
ipamv1 "github.com/metal3-io/ip-address-manager/api/v1alpha1"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/pkg/errors"
"golang.org/x/crypto/ssh"
corev1 "k8s.io/api/core/v1"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
Expand Down Expand Up @@ -181,6 +182,9 @@ func DownloadFile(filePath string, url string) error {
if err != nil {
return err
}
if resp.StatusCode != http.StatusOK {
return errors.Errorf("failed to download image from %q got %d %s", filePath, resp.StatusCode, http.StatusText(resp.StatusCode))
}
defer resp.Body.Close()

// Create the file
Expand Down
2 changes: 1 addition & 1 deletion test/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
github.com/metal3-io/ip-address-manager/api v1.6.0
github.com/onsi/ginkgo/v2 v2.15.0
github.com/onsi/gomega v1.31.1
github.com/pkg/errors v0.9.1
golang.org/x/crypto v0.20.0
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.29.2
Expand Down Expand Up @@ -90,7 +91,6 @@ require (
github.com/opencontainers/image-spec v1.0.2 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.18.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
Expand Down

0 comments on commit 686d7e6

Please sign in to comment.