mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-04 03:11:55 +02:00
test: fixed tests
This commit is contained in:
parent
6b0e6686a5
commit
a751da5909
@ -24,6 +24,7 @@ func TestRelease(t *testing.T) {
|
||||
var flags = fakeFlags{
|
||||
t: t,
|
||||
flags: map[string]string{
|
||||
"timeout": "1m",
|
||||
"skip-publish": "true",
|
||||
"skip-validate": "true",
|
||||
"debug": "true",
|
||||
@ -39,6 +40,7 @@ func TestSnapshotRelease(t *testing.T) {
|
||||
var flags = fakeFlags{
|
||||
t: t,
|
||||
flags: map[string]string{
|
||||
"timeout": "1m",
|
||||
"snapshot": "true",
|
||||
"parallelism": "4",
|
||||
},
|
||||
@ -50,7 +52,8 @@ func TestConfigFileIsSetAndDontExist(t *testing.T) {
|
||||
var flags = fakeFlags{
|
||||
t: t,
|
||||
flags: map[string]string{
|
||||
"config": "/this/wont/exist",
|
||||
"timeout": "1m",
|
||||
"config": "/this/wont/exist",
|
||||
},
|
||||
}
|
||||
assert.Error(t, Release(flags))
|
||||
@ -74,8 +77,10 @@ func TestConfigFlagNotSetButExists(t *testing.T) {
|
||||
),
|
||||
)
|
||||
var flags = fakeFlags{
|
||||
t: t,
|
||||
flags: map[string]string{},
|
||||
t: t,
|
||||
flags: map[string]string{
|
||||
"timeout": "1m",
|
||||
},
|
||||
}
|
||||
assert.Equal(t, name, getConfigFile(flags))
|
||||
})
|
||||
@ -86,6 +91,7 @@ func TestReleaseNotesFileDontExist(t *testing.T) {
|
||||
var flags = fakeFlags{
|
||||
t: t,
|
||||
flags: map[string]string{
|
||||
"timeout": "1m",
|
||||
"release-notes": "/this/also/wont/exist",
|
||||
},
|
||||
}
|
||||
@ -100,6 +106,7 @@ func TestCustomReleaseNotesFile(t *testing.T) {
|
||||
var flags = fakeFlags{
|
||||
t: t,
|
||||
flags: map[string]string{
|
||||
"timeout": "1m",
|
||||
"release-notes": releaseNotes,
|
||||
"skip-publish": "true",
|
||||
"skip-validate": "true",
|
||||
@ -116,6 +123,7 @@ func TestBrokenPipe(t *testing.T) {
|
||||
var flags = fakeFlags{
|
||||
t: t,
|
||||
flags: map[string]string{
|
||||
"timeout": "1m",
|
||||
"skip-publish": "true",
|
||||
"skip-validate": "true",
|
||||
"parallelism": "4",
|
||||
|
@ -36,27 +36,22 @@ func TestRunPipe(t *testing.T) {
|
||||
var binPath = filepath.Join(dist, "mybin", "mybin")
|
||||
_, err = os.Create(binPath)
|
||||
assert.NoError(t, err)
|
||||
var ctx = &context.Context{
|
||||
Version: "1.0.0",
|
||||
Parallelism: runtime.NumCPU(),
|
||||
Debug: true,
|
||||
Artifacts: artifact.New(),
|
||||
Config: config.Project{
|
||||
ProjectName: "mybin",
|
||||
Dist: dist,
|
||||
FPM: config.FPM{
|
||||
NameTemplate: defaultNameTemplate,
|
||||
Formats: []string{"deb", "rpm"},
|
||||
Dependencies: []string{"make"},
|
||||
Conflicts: []string{"git"},
|
||||
Description: "Some description",
|
||||
License: "MIT",
|
||||
Maintainer: "me@me",
|
||||
Vendor: "asdf",
|
||||
Homepage: "https://goreleaser.github.io",
|
||||
},
|
||||
var ctx = context.New(config.Project{
|
||||
ProjectName: "mybin",
|
||||
Dist: dist,
|
||||
FPM: config.FPM{
|
||||
NameTemplate: defaultNameTemplate,
|
||||
Formats: []string{"deb", "rpm"},
|
||||
Dependencies: []string{"make"},
|
||||
Conflicts: []string{"git"},
|
||||
Description: "Some description",
|
||||
License: "MIT",
|
||||
Maintainer: "me@me",
|
||||
Vendor: "asdf",
|
||||
Homepage: "https://goreleaser.github.io",
|
||||
},
|
||||
}
|
||||
})
|
||||
ctx.Version = "1.0.0"
|
||||
for _, goos := range []string{"linux", "darwin"} {
|
||||
for _, goarch := range []string{"amd64", "386"} {
|
||||
ctx.Artifacts.Add(artifact.Artifact{
|
||||
@ -115,20 +110,16 @@ func TestCreateFileDoesntExist(t *testing.T) {
|
||||
var dist = filepath.Join(folder, "dist")
|
||||
assert.NoError(t, os.Mkdir(dist, 0755))
|
||||
assert.NoError(t, os.Mkdir(filepath.Join(dist, "mybin"), 0755))
|
||||
var ctx = &context.Context{
|
||||
Version: "1.0.0",
|
||||
Parallelism: runtime.NumCPU(),
|
||||
Artifacts: artifact.New(),
|
||||
Config: config.Project{
|
||||
Dist: dist,
|
||||
FPM: config.FPM{
|
||||
Formats: []string{"deb", "rpm"},
|
||||
Files: map[string]string{
|
||||
"testdata/testfile.txt": "/var/lib/test/testfile.txt",
|
||||
},
|
||||
var ctx = context.New(config.Project{
|
||||
Dist: dist,
|
||||
FPM: config.FPM{
|
||||
Formats: []string{"deb", "rpm"},
|
||||
Files: map[string]string{
|
||||
"testdata/testfile.txt": "/var/lib/test/testfile.txt",
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
ctx.Version = "1.0.0"
|
||||
ctx.Artifacts.Add(artifact.Artifact{
|
||||
Name: "mybin",
|
||||
Path: filepath.Join(dist, "mybin", "mybin"),
|
||||
|
Loading…
Reference in New Issue
Block a user