1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-11-27 22:49:07 +02:00

removing all assert.New because vet shadow complains about this now

aaaaaaaaaaarhhhhhhhhgttt
This commit is contained in:
Carlos Alexandro Becker
2017-09-26 19:24:49 -03:00
parent f1f04d809d
commit d85a9001ec
28 changed files with 349 additions and 472 deletions

View File

@@ -15,15 +15,14 @@ import (
)
func TestRunPipe(t *testing.T) {
var assert = assert.New(t)
folder, err := ioutil.TempDir("", "archivetest")
assert.NoError(err)
assert.NoError(t, err)
var dist = filepath.Join(folder, "dist")
assert.NoError(os.Mkdir(dist, 0755))
assert.NoError(os.Mkdir(filepath.Join(dist, "mybin"), 0755))
assert.NoError(t, os.Mkdir(dist, 0755))
assert.NoError(t, os.Mkdir(filepath.Join(dist, "mybin"), 0755))
var binPath = filepath.Join(dist, "mybin", "mybin")
_, err = os.Create(binPath)
assert.NoError(err)
assert.NoError(t, err)
var images = []string{
"goreleaser/test_run_pipe:1.0.0",
"goreleaser/test_run_pipe:latest",
@@ -60,34 +59,31 @@ func TestRunPipe(t *testing.T) {
for _, plat := range []string{"linuxamd64", "linux386", "darwinamd64"} {
ctx.AddBinary(plat, "mybin", "mybin", binPath)
}
assert.NoError(Pipe{}.Run(ctx))
assert.NoError(t, Pipe{}.Run(ctx))
// this might should not fail as the image should have been created when
// the step ran
for _, img := range images {
assert.NoError(exec.Command("docker", "rmi", img).Run())
assert.NoError(t, exec.Command("docker", "rmi", img).Run())
}
// the test_run_pipe_nope image should not have been created, so deleting
// it should fail
assert.Error(
assert.Error(t,
exec.Command("docker", "rmi", "goreleaser/test_run_pipe_nope:1.0.0").Run(),
)
}
func TestDescription(t *testing.T) {
var assert = assert.New(t)
assert.NotEmpty(Pipe{}.Description())
assert.NotEmpty(t, Pipe{}.Description())
}
func TestNoDockers(t *testing.T) {
var assert = assert.New(t)
assert.True(pipeline.IsSkip(Pipe{}.Run(context.New(config.Project{}))))
assert.True(t, pipeline.IsSkip(Pipe{}.Run(context.New(config.Project{}))))
}
func TestNoDockerWithoutImageName(t *testing.T) {
var assert = assert.New(t)
assert.True(pipeline.IsSkip(Pipe{}.Run(context.New(config.Project{
assert.True(t, pipeline.IsSkip(Pipe{}.Run(context.New(config.Project{
Dockers: []config.Docker{
{
Goos: "linux",
@@ -97,12 +93,11 @@ func TestNoDockerWithoutImageName(t *testing.T) {
}
func TestDockerNotInPath(t *testing.T) {
var assert = assert.New(t)
var path = os.Getenv("PATH")
defer func() {
assert.NoError(os.Setenv("PATH", path))
assert.NoError(t, os.Setenv("PATH", path))
}()
assert.NoError(os.Setenv("PATH", ""))
assert.NoError(t, os.Setenv("PATH", ""))
var ctx = &context.Context{
Version: "1.0.0",
Config: config.Project{
@@ -113,5 +108,5 @@ func TestDockerNotInPath(t *testing.T) {
},
},
}
assert.EqualError(Pipe{}.Run(ctx), ErrNoDocker.Error())
assert.EqualError(t, Pipe{}.Run(ctx), ErrNoDocker.Error())
}