From 4100f65d71dac79a49eb85e680b3b06a8529e946 Mon Sep 17 00:00:00 2001 From: Grachev Mikhail Date: Tue, 13 Aug 2019 16:28:03 +0300 Subject: [PATCH] test: add error handling (#1111) closes #1047 --- internal/pipe/build/build_test.go | 5 +++-- internal/pipe/sign/sign_test.go | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/pipe/build/build_test.go b/internal/pipe/build/build_test.go index 3f98612c5..3e7b2336d 100644 --- a/internal/pipe/build/build_test.go +++ b/internal/pipe/build/build_test.go @@ -399,8 +399,9 @@ func TestHookEnvs(t *testing.T) { t.Skip("this fails on travis for some reason") var shell = `#!/bin/sh -e touch "$BAR"` - ioutil.WriteFile(filepath.Join(tmp, "test.sh"), []byte(shell), 0750) - var err = runHook(context.New(config.Project{ + err := ioutil.WriteFile(filepath.Join(tmp, "test.sh"), []byte(shell), 0750) + assert.NoError(t, err) + err = runHook(context.New(config.Project{ Builds: []config.Build{ build, }, diff --git a/internal/pipe/sign/sign_test.go b/internal/pipe/sign/sign_test.go index 49047da0e..63cdd4de8 100644 --- a/internal/pipe/sign/sign_test.go +++ b/internal/pipe/sign/sign_test.go @@ -165,7 +165,8 @@ func testSign(t *testing.T, ctx *context.Context, signaturePaths []string, signa // create some fake artifacts var artifacts = []string{"artifact1", "artifact2", "artifact3", "checksum"} - os.Mkdir(filepath.Join(tmpdir, "linux_amd64"), os.ModePerm) + err = os.Mkdir(filepath.Join(tmpdir, "linux_amd64"), os.ModePerm) + assert.NoError(t, err) for _, f := range artifacts { file := filepath.Join(tmpdir, f) assert.NoError(t, ioutil.WriteFile(file, []byte("foo"), 0644))