Skip to content

Commit

Permalink
test: syscall.EACCES and os.ErrNoExist (#4120)
Browse files Browse the repository at this point in the history
extracted from #3795

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
  • Loading branch information
caarlos0 committed Jun 16, 2023
1 parent bad7984 commit 2ad313a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions internal/pipe/checksums/checksums_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"os"
"path/filepath"
"strings"
"syscall"
"testing"

"github.com/goreleaser/goreleaser/internal/artifact"
Expand Down Expand Up @@ -148,8 +149,7 @@ func TestPipeFileNotExist(t *testing.T) {
Path: "/nope",
Type: artifact.UploadableBinary,
})
err := Pipe{}.Run(ctx)
require.ErrorIs(t, err, os.ErrNotExist)
require.ErrorIs(t, Pipe{}.Run(ctx), os.ErrNotExist)
}

func TestPipeInvalidNameTemplate(t *testing.T) {
Expand Down Expand Up @@ -215,7 +215,7 @@ func TestPipeCouldNotOpenChecksumsTxt(t *testing.T) {
})
err = Pipe{}.Run(ctx)
require.Error(t, err)
require.Contains(t, err.Error(), "/checksums.txt: permission denied")
require.ErrorIs(t, Pipe{}.Run(ctx), syscall.EACCES)
}

func TestPipeWhenNoArtifacts(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion internal/pipe/gomod/gomod_proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"
"path/filepath"
"runtime"
"syscall"
"testing"

"github.com/goreleaser/goreleaser/internal/testctx"
Expand Down Expand Up @@ -127,7 +128,7 @@ func TestGoModProxy(t *testing.T) {

// change perms of a file and run again, which should now fail on that file.
require.NoError(t, os.Chmod(filepath.Join(dist, "proxy", "foo", file), mode))
require.ErrorAs(t, ProxyPipe{}.Run(ctx), &ErrProxy{})
require.ErrorIs(t, ProxyPipe{}.Run(ctx), syscall.EACCES)
})
}
})
Expand Down

0 comments on commit 2ad313a

Please sign in to comment.