From 999365f5f9aa56e65f07d99080d7dde570aff30a Mon Sep 17 00:00:00 2001 From: Yoan Blanc Date: Sat, 20 Jun 2020 10:42:59 +0200 Subject: [PATCH] fixup! fixup! add should fail on 40x Signed-off-by: Yoan Blanc --- integration/integration_test.go | 17 ++++++----------- pkg/util/fs_util.go | 2 +- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/integration/integration_test.go b/integration/integration_test.go index 8eb356923..4406fe42c 100644 --- a/integration/integration_test.go +++ b/integration/integration_test.go @@ -397,9 +397,9 @@ func TestBuildWithHTTPError(t *testing.T) { "-t", dockerImage, "-f", dockerfile, repo})...) - out, err := RunCommandWithoutTest(dockerCmd) - if err != nil { - t.Errorf("Failed to build image %s with docker command %q: %s %s", dockerImage, dockerCmd.Args, err, string(out)) + _, err := RunCommandWithoutTest(dockerCmd) + if err == nil { + t.Fatalf("an error was expected") } // Build with kaniko @@ -414,15 +414,10 @@ func TestBuildWithHTTPError(t *testing.T) { kanikoCmd := exec.Command("docker", dockerRunFlags...) - out, err = RunCommandWithoutTest(kanikoCmd) - if err != nil { - t.Errorf("Failed to build image %s with kaniko command %q: %v %s", dockerImage, kanikoCmd.Args, err, string(out)) + _, err = RunCommandWithoutTest(kanikoCmd) + if err == nil { + t.Fatalf("an error was expected") } - - diff := containerDiff(t, daemonPrefix+dockerImage, kanikoImage, "--no-cache") - - expected := fmt.Sprintf(emptyContainerDiff, dockerImage, kanikoImage, dockerImage, kanikoImage) - checkContainerDiffOutput(t, diff, expected) } func TestLayers(t *testing.T) { diff --git a/pkg/util/fs_util.go b/pkg/util/fs_util.go index 38c91357e..71657ac94 100644 --- a/pkg/util/fs_util.go +++ b/pkg/util/fs_util.go @@ -547,7 +547,7 @@ func DownloadFileToDest(rawurl, dest string, uid, gid int64) error { defer resp.Body.Close() if resp.StatusCode >= 400 { - return fmt.Errorf("%s failed with %d", rawurl, resp.StatusCode) + return fmt.Errorf("invalid response status %d", resp.StatusCode) } if err := CreateFile(dest, resp.Body, 0600, uint32(uid), uint32(gid)); err != nil {