Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: try to clean up and simplify the file adding interface #255

Merged
merged 3 commits into from
Dec 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
vendor
*.rpm
*.deb
!dummy.deb
*.apk
coverage.txt
dist
nfpm.yaml
Expand All @@ -8,3 +11,5 @@ bin
coverage.out
/nfpm
www/site
.idea/
testdata/acceptance/tmp/
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ linters:
- gci
- exhaustivestruct
- wrapcheck
- godot
linters-settings:
maligned:
# print struct with more effective memory layout or not, false by default
Expand Down Expand Up @@ -40,6 +41,8 @@ linters-settings:
- style
- performance
issues:
exclude:
- composites
exclude-rules:
- text: "G104" # gosec G104 is caught by errcheck
linters:
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ SOURCE_FILES?=./...
TEST_PATTERN?=.
TEST_OPTIONS?=
TEST_TIMEOUT?=15m
TEST_PARALLEL?=2

export PATH := ./bin:$(PATH)
export GO111MODULE := on
Expand All @@ -24,7 +25,7 @@ acceptance: pull_test_imgs
.PHONY: acceptance

test:
go test $(TEST_OPTIONS) -v -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt $(SOURCE_FILES) -run $(TEST_PATTERN) -timeout=$(TEST_TIMEOUT)
go test $(TEST_OPTIONS) -p $(TEST_PARALLEL) -v -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt $(SOURCE_FILES) -run $(TEST_PATTERN) -timeout=$(TEST_TIMEOUT)
.PHONY: test

cover: test
Expand Down
5 changes: 0 additions & 5 deletions acceptance/placeholder.go

This file was deleted.

33 changes: 0 additions & 33 deletions acceptance/testdata/complex.386.yaml

This file was deleted.

34 changes: 0 additions & 34 deletions acceptance/testdata/complex.yaml

This file was deleted.

32 changes: 0 additions & 32 deletions acceptance/testdata/env-var-version.yaml

This file was deleted.

37 changes: 0 additions & 37 deletions acceptance/testdata/overrides.yaml

This file was deleted.

19 changes: 9 additions & 10 deletions acceptance/acceptance_test.go → acceptance_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//+build acceptance
// +build acceptance

package acceptance
package nfpm_test

import (
"fmt"
Expand All @@ -12,7 +12,6 @@ import (
"github.com/stretchr/testify/require"

"github.com/goreleaser/nfpm"
// shut up
_ "github.com/goreleaser/nfpm/apk"
_ "github.com/goreleaser/nfpm/deb"
_ "github.com/goreleaser/nfpm/rpm"
Expand Down Expand Up @@ -83,10 +82,10 @@ func TestComplex(t *testing.T) {
}

func TestConfigNoReplace(t *testing.T) {
var target = "./testdata/tmp/noreplace_old_rpm.rpm"
require.NoError(t, os.MkdirAll("./testdata/tmp", 0700))
var target = "./testdata/acceptance/tmp/noreplace_old_rpm.rpm"
require.NoError(t, os.MkdirAll("./testdata/acceptance/tmp", 0700))

config, err := nfpm.ParseFile("./testdata/config-noreplace-old.yaml")
config, err := nfpm.ParseFile("./testdata/acceptance/config-noreplace-old.yaml")
require.NoError(t, err)

info, err := config.Get("rpm")
Expand Down Expand Up @@ -277,13 +276,13 @@ type testWriter struct {
}

func (t testWriter) Write(p []byte) (n int, err error) {
t.t.Logf(string(p))
t.t.Log(string(p))
return len(p), nil
}

func accept(t *testing.T, params acceptParms) {
var configFile = filepath.Join("./testdata", params.Conf)
tmp, err := filepath.Abs("./testdata/tmp")
var configFile = filepath.Join("./testdata/acceptance/", params.Conf)
tmp, err := filepath.Abs("./testdata/acceptance/tmp")
require.NoError(t, err)
var packageName = params.Name + "." + params.Format
var target = filepath.Join(tmp, packageName)
Expand Down Expand Up @@ -312,7 +311,7 @@ func accept(t *testing.T, params acceptParms) {
"--build-arg", "package="+filepath.Join("tmp", packageName),
".",
)
cmd.Dir = "./testdata"
cmd.Dir = "./testdata/acceptance"
cmd.Stderr = testWriter{t}
cmd.Stdout = cmd.Stderr

Expand Down
Loading