1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-04-23 12:18:50 +02:00

test: added more tests

This commit is contained in:
Carlos Alexandro Becker 2018-10-20 17:02:38 -03:00 committed by Carlos Alexandro Becker
parent a9bae8d5d3
commit 32d9440dff

View File

@ -53,12 +53,14 @@ func TestRunPipe(t *testing.T) {
NameTemplate: "foo_{{.Arch}}",
Summary: "test summary",
Description: "test description",
Publish: true,
},
})
ctx.Git.CurrentTag = "v1.2.3"
ctx.Version = "v1.2.3"
addBinaries(t, ctx, "mybin", dist)
assert.NoError(t, Pipe{}.Run(ctx))
assert.Len(t, ctx.Artifacts.Filter(artifact.ByType(artifact.PublishableSnapcraft)).List(), 2)
}
func TestRunPipeInvalidNameTemplate(t *testing.T) {
@ -172,6 +174,19 @@ func TestDefault(t *testing.T) {
assert.Equal(t, defaultNameTemplate, ctx.Config.Snapcraft.NameTemplate)
}
func TestPublish(t *testing.T) {
var ctx = context.New(config.Project{})
ctx.Artifacts.Add(artifact.Artifact{
Name: "mybin",
Path: "nope.snap",
Goarch: "amd64",
Goos: "linux",
Type: artifact.PublishableSnapcraft,
})
err := Pipe{}.Publish(ctx)
assert.Contains(t, err.Error(), "failed to push nope.snap package")
}
func TestDefaultSet(t *testing.T) {
var ctx = context.New(config.Project{
Snapcraft: config.Snapcraft{