Skip to content

Commit

Permalink
test: ECONNREFUSED (#4118)
Browse files Browse the repository at this point in the history
improved test check

extracted from #3795
  • Loading branch information
caarlos0 committed Jun 16, 2023
1 parent 3eecfdd commit e5a0f66
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 2 additions & 3 deletions internal/pipe/artifactory/artifactory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"path/filepath"
"sync"
"syscall"
"testing"

"github.com/goreleaser/goreleaser/internal/artifact"
Expand Down Expand Up @@ -330,9 +331,7 @@ func TestRunPipe_ArtifactoryDown(t *testing.T) {
})

require.NoError(t, Pipe{}.Default(ctx))
err = Pipe{}.Publish(ctx)
require.Error(t, err)
require.Contains(t, err.Error(), "connection refused")
require.ErrorIs(t, Pipe{}.Publish(ctx), syscall.ECONNREFUSED)
}

func TestRunPipe_TargetTemplateError(t *testing.T) {
Expand Down
7 changes: 3 additions & 4 deletions internal/pipe/upload/upload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"path/filepath"
"sync"
"syscall"
"testing"

"github.com/goreleaser/goreleaser/internal/artifact"
Expand Down Expand Up @@ -336,7 +337,7 @@ func TestRunPipe_ModeArchive_CustomArtifactName(t *testing.T) {
require.True(t, ok, "deb file was not uploaded")
}

func TestRunPipe_ArtifactoryDown(t *testing.T) {
func TestRunPipe_ServerDown(t *testing.T) {
folder := t.TempDir()
tarfile, err := os.Create(filepath.Join(folder, "bin.tar.gz"))
require.NoError(t, err)
Expand All @@ -361,9 +362,7 @@ func TestRunPipe_ArtifactoryDown(t *testing.T) {
Name: "bin.tar.gz",
Path: tarfile.Name(),
})
err = Pipe{}.Publish(ctx)
require.Error(t, err)
require.Contains(t, err.Error(), "connection refused")
require.ErrorIs(t, Pipe{}.Publish(ctx), syscall.ECONNREFUSED)
}

func TestRunPipe_TargetTemplateError(t *testing.T) {
Expand Down

0 comments on commit e5a0f66

Please sign in to comment.