diff --git a/acceptance/acceptance_test.go b/acceptance/acceptance_test.go index 250b89c..0ced881 100644 --- a/acceptance/acceptance_test.go +++ b/acceptance/acceptance_test.go @@ -1,6 +1,7 @@ package acceptance import ( + "fmt" "os" "os/exec" "path/filepath" @@ -14,6 +15,52 @@ import ( _ "github.com/goreleaser/nfpm/rpm" ) +var formats = []string{"deb", "rpm"} + +func TestSimple(t *testing.T) { + for _, format := range formats { + t.Run("amd64", func(t *testing.T) { + t.Parallel() + accept(t, fmt.Sprintf("simple_%s", format), "simple.yaml", format, fmt.Sprintf("%s.dockerfile", format)) + }) + t.Run("i386", func(t *testing.T) { + t.Parallel() + accept(t, fmt.Sprintf("simple_%s_386", format), "simple.386.yaml", format, fmt.Sprintf("%s.386.dockerfile", format)) + }) + } +} + +func TestComplex(t *testing.T) { + for _, format := range formats { + t.Run("amd64", func(t *testing.T) { + t.Parallel() + accept(t, fmt.Sprintf("complex_%s", format), "complex.yaml", format, fmt.Sprintf("%s.complex.dockerfile", format)) + }) + t.Run("i386", func(t *testing.T) { + t.Parallel() + accept(t, fmt.Sprintf("complex_%s_386", format), "complex.386.yaml", format, fmt.Sprintf("%s.386.complex.dockerfile", format)) + }) + } +} + +func TestComplexOverridesDeb(t *testing.T) { + for _, format := range formats { + t.Run("amd64", func(t *testing.T) { + t.Parallel() + accept(t, fmt.Sprintf("overrides_%s", format), "overrides.yaml", format, fmt.Sprintf("%s.overrides.dockerfile", format)) + }) + } +} + +func TestMinDeb(t *testing.T) { + for _, format := range formats { + t.Run("amd64", func(t *testing.T) { + t.Parallel() + accept(t, fmt.Sprintf("min_%s", format), "min.yaml", format, fmt.Sprintf("%s.min.dockerfile", format)) + }) + } +} + func accept(t *testing.T, name, conf, format, dockerfile string) { var configFile = filepath.Join("./testdata", conf) tmp, err := filepath.Abs("./testdata/tmp") diff --git a/acceptance/deb_acceptance_test.go b/acceptance/deb_acceptance_test.go deleted file mode 100644 index 4a9fbbc..0000000 --- a/acceptance/deb_acceptance_test.go +++ /dev/null @@ -1,39 +0,0 @@ -package acceptance - -import "testing" - -func TestSimpleDeb(t *testing.T) { - t.Run("amd64", func(t *testing.T) { - t.Parallel() - accept(t, "simple_deb", "simple.yaml", "deb", "deb.dockerfile") - }) - t.Run("i386", func(t *testing.T) { - t.Parallel() - accept(t, "simple_deb_386", "simple.386.yaml", "deb", "deb.386.dockerfile") - }) -} - -func TestComplexDeb(t *testing.T) { - t.Run("amd64", func(t *testing.T) { - t.Parallel() - accept(t, "complex_deb", "complex.yaml", "deb", "deb.complex.dockerfile") - }) - t.Run("i386", func(t *testing.T) { - t.Parallel() - accept(t, "complex_deb_386", "complex.386.yaml", "deb", "deb.386.complex.dockerfile") - }) -} - -func TestComplexOverridesDeb(t *testing.T) { - t.Run("amd64", func(t *testing.T) { - t.Parallel() - accept(t, "overrides_deb", "overrides.yaml", "deb", "deb.overrides.dockerfile") - }) -} - -func TestMinDeb(t *testing.T) { - t.Run("amd64", func(t *testing.T) { - t.Parallel() - accept(t, "min_deb", "min.yaml", "deb", "deb.min.dockerfile") - }) -} diff --git a/acceptance/rpm_acceptance_test.go b/acceptance/rpm_acceptance_test.go deleted file mode 100644 index a2669a3..0000000 --- a/acceptance/rpm_acceptance_test.go +++ /dev/null @@ -1,39 +0,0 @@ -package acceptance - -import "testing" - -func TestSimpleRPM(t *testing.T) { - t.Run("amd64", func(t *testing.T) { - t.Parallel() - accept(t, "simple_rpm", "simple.yaml", "rpm", "rpm.dockerfile") - }) - t.Run("i386", func(t *testing.T) { - t.Parallel() - accept(t, "simple_rpm_386", "simple.386.yaml", "rpm", "rpm.386.dockerfile") - }) -} - -func TestComplexRPM(t *testing.T) { - t.Run("amd64", func(t *testing.T) { - t.Parallel() - accept(t, "complex_rpm", "complex.yaml", "rpm", "rpm.complex.dockerfile") - }) - t.Run("i386", func(t *testing.T) { - t.Parallel() - accept(t, "complex_rpm_386", "complex.386.yaml", "rpm", "rpm.386.complex.dockerfile") - }) -} - -func TestComplexOverridesRPM(t *testing.T) { - t.Run("amd64", func(t *testing.T) { - t.Parallel() - accept(t, "overrides_rpm", "overrides.yaml", "rpm", "rpm.overrides.dockerfile") - }) -} - -func TestMinRPM(t *testing.T) { - t.Run("amd64", func(t *testing.T) { - t.Parallel() - accept(t, "min_rpm", "min.yaml", "rpm", "rpm.min.dockerfile") - }) -} diff --git a/deb/deb_test.go b/deb/deb_test.go index 23a4149..1d9a476 100644 --- a/deb/deb_test.go +++ b/deb/deb_test.go @@ -86,7 +86,7 @@ func TestControl(t *testing.T) { })) var golden = "testdata/control.golden" if *update { - ioutil.WriteFile(golden, w.Bytes(), 0655) + ioutil.WriteFile(golden, w.Bytes(), 0655) //nolint:errcheck } bts, err := ioutil.ReadFile(golden) assert.NoError(t, err) @@ -141,7 +141,7 @@ func TestNoJoinsControl(t *testing.T) { })) var golden = "testdata/control2.golden" if *update { - ioutil.WriteFile(golden, w.Bytes(), 0655) + ioutil.WriteFile(golden, w.Bytes(), 0655) //nolint:errcheck } bts, err := ioutil.ReadFile(golden) assert.NoError(t, err) diff --git a/rpm/rpm_test.go b/rpm/rpm_test.go index 2013081..42386f3 100644 --- a/rpm/rpm_test.go +++ b/rpm/rpm_test.go @@ -75,7 +75,7 @@ func TestSpec(t *testing.T) { var w bytes.Buffer assert.NoError(tt, writeSpec(&w, exampleInfo(), vs)) if *update { - ioutil.WriteFile(golden, w.Bytes(), 0655) + ioutil.WriteFile(golden, w.Bytes(), 0655) //nolint:errcheck } bts, err := ioutil.ReadFile(golden) assert.NoError(tt, err)