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

test: Fix unit test TestArtifactoriesWithInvalidMode

The unit test TestArtifactoriesWithInvalidMode was not testing
what it should be. The publish parameter was not set and we
were testing for skipping instead of error
This commit is contained in:
Andy Grunwald 2017-12-09 22:53:44 +01:00
parent 3fa0fe5708
commit eacabadc40

@ -649,16 +649,24 @@ func TestArtifactoriesWithoutSecret(t *testing.T) {
}
func TestArtifactoriesWithInvalidMode(t *testing.T) {
assert.True(t, pipeline.IsSkip(Pipe{}.Run(context.New(config.Project{
Artifactories: []config.Artifactory{
{
Name: "production",
Mode: "does-not-exists",
Target: "http://artifacts.company.com/example-repo-local/{{ .ProjectName }}/{{ .Os }}/{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}",
Username: "deployuser",
// Set secrets for artifactory instances
os.Setenv("ARTIFACTORY_PRODUCTION_SECRET", "deployuser-secret")
defer os.Unsetenv("ARTIFACTORY_PRODUCTION_SECRET")
var ctx = &context.Context{
Publish: true,
Config: config.Project{
Artifactories: []config.Artifactory{
{
Name: "production",
Mode: "does-not-exists",
Target: "http://artifacts.company.com/example-repo-local/{{ .ProjectName }}/{{ .Os }}/{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}",
Username: "deployuser",
},
},
},
}))))
}
assert.Error(t, Pipe{}.Run(ctx))
}
func TestDefault(t *testing.T) {