1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-08 03:31:59 +02:00

test: improve scoop tests (#2749)

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
This commit is contained in:
Carlos Alexandro Becker 2021-12-07 18:04:29 -03:00 committed by GitHub
parent 5025a363ff
commit 395266bb9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -85,7 +85,7 @@ func Test_doRun(t *testing.T) {
tests := []struct {
name string
args args
artifacts []*artifact.Artifact
artifacts []artifact.Artifact
assertRunError errChecker
assertPublishError errChecker
assert asserter
@ -99,7 +99,6 @@ func Test_doRun(t *testing.T) {
CurrentTag: "v1.0.1",
},
Version: "1.0.1",
Artifacts: artifact.New(),
Config: config.Project{
Builds: []config.Build{
{Binary: "test", Goarch: []string{"amd64"}, Goos: []string{"windows"}},
@ -128,7 +127,7 @@ func Test_doRun(t *testing.T) {
},
client.NewMock(),
},
[]*artifact.Artifact{
[]artifact.Artifact{
{Name: "foo_1.0.1_windows_amd64.tar.gz", Goos: "windows", Goarch: "amd64", Path: file},
{Name: "foo_1.0.1_windows_386.tar.gz", Goos: "windows", Goarch: "386", Path: file},
},
@ -148,7 +147,6 @@ func Test_doRun(t *testing.T) {
CurrentTag: "v1.0.1",
},
Version: "1.0.1",
Artifacts: artifact.New(),
Config: config.Project{
Builds: []config.Build{
{Binary: "test", Goarch: []string{"amd64"}, Goos: []string{"windows"}},
@ -176,7 +174,7 @@ func Test_doRun(t *testing.T) {
},
client.NewMock(),
},
[]*artifact.Artifact{
[]artifact.Artifact{
{
Name: "foo_1.0.1_windows_amd64.tar.gz",
Goos: "windows",
@ -209,7 +207,6 @@ func Test_doRun(t *testing.T) {
CurrentTag: "v1.0.1",
},
Version: "1.0.1",
Artifacts: artifact.New(),
Config: config.Project{
GitHubURLs: config.GitHubURLs{Download: "https://api.custom.github.enterprise.com"},
Builds: []config.Build{
@ -238,7 +235,7 @@ func Test_doRun(t *testing.T) {
},
client.NewMock(),
},
[]*artifact.Artifact{
[]artifact.Artifact{
{Name: "foo_1.0.1_windows_amd64.tar.gz", Goos: "windows", Goarch: "amd64", Path: file},
{Name: "foo_1.0.1_windows_386.tar.gz", Goos: "windows", Goarch: "386", Path: file},
},
@ -258,7 +255,6 @@ func Test_doRun(t *testing.T) {
CurrentTag: "v1.0.1",
},
Version: "1.0.1",
Artifacts: artifact.New(),
Config: config.Project{
Builds: []config.Build{
{Binary: "test", Goarch: []string{"amd64"}, Goos: []string{"windows"}},
@ -286,7 +282,7 @@ func Test_doRun(t *testing.T) {
},
client.NewMock(),
},
[]*artifact.Artifact{
[]artifact.Artifact{
{
Name: "foo_1.0.1_windows_amd64.tar.gz",
Goos: "windows",
@ -313,7 +309,6 @@ func Test_doRun(t *testing.T) {
CurrentTag: "v1.0.1",
},
Version: "1.0.1",
Artifacts: artifact.New(),
Config: config.Project{
GitHubURLs: config.GitHubURLs{Download: "https://api.custom.gitlab.enterprise.com"},
Builds: []config.Build{
@ -342,7 +337,7 @@ func Test_doRun(t *testing.T) {
},
client.NewMock(),
},
[]*artifact.Artifact{
[]artifact.Artifact{
{
Name: "foo_1.0.1_windows_amd64.tar.gz",
Goos: "windows",
@ -369,7 +364,6 @@ func Test_doRun(t *testing.T) {
CurrentTag: "v1.0.1",
},
Version: "1.0.1",
Artifacts: artifact.New(),
Config: config.Project{
Builds: []config.Build{
{Binary: "test"},
@ -397,7 +391,7 @@ func Test_doRun(t *testing.T) {
},
client.NewMock(),
},
[]*artifact.Artifact{
[]artifact.Artifact{
{Name: "foo_1.0.1_linux_amd64.tar.gz", Goos: "linux", Goarch: "amd64"},
{Name: "foo_1.0.1_linux_386.tar.gz", Goos: "linux", Goarch: "386"},
},
@ -414,7 +408,6 @@ func Test_doRun(t *testing.T) {
CurrentTag: "v1.0.1",
},
Version: "1.0.1",
Artifacts: artifact.New(),
Config: config.Project{
Builds: []config.Build{
{Binary: "test", Goarch: []string{"amd64"}, Goos: []string{"windows"}},
@ -439,7 +432,7 @@ func Test_doRun(t *testing.T) {
},
client.NewMock(),
},
[]*artifact.Artifact{
[]artifact.Artifact{
{Name: "foo_1.0.1_windows_amd64.tar.gz", Goos: "windows", Goarch: "amd64", Path: file},
{Name: "foo_1.0.1_windows_386.tar.gz", Goos: "windows", Goarch: "386", Path: file},
},
@ -462,7 +455,6 @@ func Test_doRun(t *testing.T) {
Prerelease: "-pre.1",
},
Version: "1.0.1-pre.1",
Artifacts: artifact.New(),
Config: config.Project{
Builds: []config.Build{
{Binary: "test", Goarch: []string{"amd64"}, Goos: []string{"windows"}},
@ -491,7 +483,7 @@ func Test_doRun(t *testing.T) {
},
client.NewMock(),
},
[]*artifact.Artifact{
[]artifact.Artifact{
{Name: "foo_1.0.1-pre.1_windows_amd64.tar.gz", Goos: "windows", Goarch: "amd64", Path: file},
{Name: "foo_1.0.1-pre.1_windows_386.tar.gz", Goos: "windows", Goarch: "386", Path: file},
},
@ -508,7 +500,6 @@ func Test_doRun(t *testing.T) {
CurrentTag: "v1.0.1",
},
Version: "1.0.1",
Artifacts: artifact.New(),
Config: config.Project{
Builds: []config.Build{
{Binary: "test", Goarch: []string{"amd64"}, Goos: []string{"windows"}},
@ -537,7 +528,7 @@ func Test_doRun(t *testing.T) {
},
client.NewMock(),
},
[]*artifact.Artifact{
[]artifact.Artifact{
{Name: "foo_1.0.1-pre.1_windows_amd64.tar.gz", Goos: "windows", Goarch: "amd64", Path: file},
{Name: "foo_1.0.1-pre.1_windows_386.tar.gz", Goos: "windows", Goarch: "386", Path: file},
},
@ -554,7 +545,6 @@ func Test_doRun(t *testing.T) {
CurrentTag: "v1.0.1",
},
Version: "1.0.1",
Artifacts: artifact.New(),
Config: config.Project{
Builds: []config.Build{
{Binary: "test", Goarch: []string{"amd64"}, Goos: []string{"windows"}},
@ -579,7 +569,7 @@ func Test_doRun(t *testing.T) {
},
client.NewMock(),
},
[]*artifact.Artifact{
[]artifact.Artifact{
{Name: "foo_1.0.1_windows_amd64.tar.gz", Goos: "windows", Goarch: "amd64", Path: file},
{Name: "foo_1.0.1_windows_386.tar.gz", Goos: "windows", Goarch: "386", Path: file},
},
@ -596,7 +586,6 @@ func Test_doRun(t *testing.T) {
CurrentTag: "v1.0.1",
},
Version: "1.0.1",
Artifacts: artifact.New(),
Config: config.Project{
Builds: []config.Build{
{Binary: "test", Goarch: []string{"amd64"}, Goos: []string{"windows"}},
@ -621,7 +610,7 @@ func Test_doRun(t *testing.T) {
},
client.NewMock(),
},
[]*artifact.Artifact{
[]artifact.Artifact{
{Name: "foo_1.0.1_windows_amd64.tar.gz", Goos: "windows", Goarch: "amd64", Path: file},
{Name: "foo_1.0.1_windows_386.tar.gz", Goos: "windows", Goarch: "386", Path: file},
},
@ -633,8 +622,9 @@ func Test_doRun(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ctx := tt.args.ctx
ctx.Artifacts = artifact.New()
for _, a := range tt.artifacts {
ctx.Artifacts.Add(a)
ctx.Artifacts.Add(&a)
}
require.NoError(t, Pipe{}.Default(ctx))