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

fix: added more tests to artifactory

This commit is contained in:
Carlos Alexandro Becker 2017-12-17 22:54:24 -02:00
parent 9ac3b8cf79
commit 97ac740233
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940

View File

@ -298,6 +298,38 @@ func TestRunPipe_ModeArchive(t *testing.T) {
assert.NoError(t, Pipe{}.Run(ctx))
}
func TestRunPipe_ArtifactoryDown(t *testing.T) {
folder, err := ioutil.TempDir("", "goreleasertest")
assert.NoError(t, err)
tarfile, err := os.Create(filepath.Join(folder, "bin.tar.gz"))
assert.NoError(t, err)
var ctx = context.New(config.Project{
ProjectName: "goreleaser",
Dist: folder,
Artifactories: []config.Artifactory{
{
Name: "production",
Mode: "archive",
Target: "http://localhost:1234/example-repo-local/{{ .ProjectName }}/{{ .Version }}/",
Username: "deployuser",
},
},
})
ctx.Version = "2.0.0"
ctx.Env = map[string]string{
"ARTIFACTORY_PRODUCTION_SECRET": "deployuser-secret",
}
ctx.Publish = true
ctx.Artifacts.Add(artifact.Artifact{
Type: artifact.UploadableArchive,
Name: "bin.tar.gz",
Path: tarfile.Name(),
})
assert.EqualError(t, Pipe{}.Run(ctx), `artifactory: upload failed: Put http://localhost:1234/example-repo-local/goreleaser/2.0.0/bin.tar.gz: dial tcp 127.0.0.1:1234: getsockopt: connection refused`)
}
func TestRunPipe_TargetTemplateError(t *testing.T) {
folder, err := ioutil.TempDir("", "archivetest")
assert.NoError(t, err)