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

test: fixed release pipe tests

This commit is contained in:
Carlos Alexandro Becker 2017-12-17 21:26:03 -02:00
parent 8828be1f8b
commit 826dd45fa8
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
3 changed files with 25 additions and 6 deletions

3
pipeline/release/doc.go Normal file
View File

@ -0,0 +1,3 @@
// Package release implements Pipe and manages github releases and its
// artifacts.
package release

View File

@ -1,5 +1,3 @@
// Package release implements Pipe and manages github releases and its
// artifacts.
package release
import (
@ -69,6 +67,7 @@ func doRun(ctx *context.Context, c client.Client) error {
artifact.ByType(artifact.UploadableBinary),
artifact.ByType(artifact.Checksum),
artifact.ByType(artifact.Signature),
artifact.ByType(artifact.LinuxPackage),
),
).List() {
sem <- true

View File

@ -10,6 +10,7 @@ import (
"github.com/goreleaser/goreleaser/config"
"github.com/goreleaser/goreleaser/context"
"github.com/goreleaser/goreleaser/internal/artifact"
"github.com/goreleaser/goreleaser/internal/testlib"
"github.com/stretchr/testify/assert"
)
@ -37,8 +38,16 @@ func TestRunPipe(t *testing.T) {
var ctx = context.New(config)
ctx.Git = context.GitInfo{CurrentTag: "v1.0.0"}
ctx.Publish = true
ctx.AddArtifact(tarfile.Name())
ctx.AddArtifact(debfile.Name())
ctx.Artifacts.Add(artifact.Artifact{
Type: artifact.UploadableArchive,
Name: "bin.tar.gz",
Path: tarfile.Name(),
})
ctx.Artifacts.Add(artifact.Artifact{
Type: artifact.LinuxPackage,
Name: "bin.deb",
Path: debfile.Name(),
})
client := &DummyClient{}
assert.NoError(t, doRun(ctx, client))
assert.True(t, client.CreatedRelease)
@ -79,7 +88,11 @@ func TestRunPipeWithFileThatDontExist(t *testing.T) {
var ctx = context.New(config)
ctx.Git = context.GitInfo{CurrentTag: "v1.0.0"}
ctx.Publish = true
ctx.AddArtifact("this-file-wont-exist-hopefully")
ctx.Artifacts.Add(artifact.Artifact{
Type: artifact.UploadableArchive,
Name: "bin.tar.gz",
Path: "/nope/nope/nope",
})
client := &DummyClient{}
assert.Error(t, doRun(ctx, client))
assert.True(t, client.CreatedRelease)
@ -102,7 +115,11 @@ func TestRunPipeUploadFailure(t *testing.T) {
var ctx = context.New(config)
ctx.Git = context.GitInfo{CurrentTag: "v1.0.0"}
ctx.Publish = true
ctx.AddArtifact(tarfile.Name())
ctx.Artifacts.Add(artifact.Artifact{
Type: artifact.UploadableArchive,
Name: "bin.tar.gz",
Path: tarfile.Name(),
})
client := &DummyClient{
FailToUpload: true,
}