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:
parent
8828be1f8b
commit
826dd45fa8
3
pipeline/release/doc.go
Normal file
3
pipeline/release/doc.go
Normal file
@ -0,0 +1,3 @@
|
||||
// Package release implements Pipe and manages github releases and its
|
||||
// artifacts.
|
||||
package release
|
@ -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
|
||||
|
@ -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,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user