1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-17 20:47:50 +02:00

test: ECONNREFUSED (#4118)

improved test check

extracted from #3795
This commit is contained in:
Carlos Alexandro Becker 2023-06-15 23:42:55 -03:00 committed by GitHub
parent 3eecfddfc5
commit e5a0f662fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 7 deletions

View File

@ -7,6 +7,7 @@ import (
"os"
"path/filepath"
"sync"
"syscall"
"testing"
"github.com/goreleaser/goreleaser/internal/artifact"
@ -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) {

View File

@ -7,6 +7,7 @@ import (
"os"
"path/filepath"
"sync"
"syscall"
"testing"
"github.com/goreleaser/goreleaser/internal/artifact"
@ -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)
@ -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) {