diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2020-01-14 09:53:02 +0100 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2020-01-14 10:51:59 +0100 |
commit | cf1f3191d2be691b482ac86f9476c180f608ddbe (patch) | |
tree | 16b5c74883be69aef8e567bc089b3656b6fb14fa /pkg/hooks/exec/exec_test.go | |
parent | a1028697465029f3e7b100de843eb7e5e2948246 (diff) | |
download | podman-cf1f3191d2be691b482ac86f9476c180f608ddbe.tar.gz podman-cf1f3191d2be691b482ac86f9476c180f608ddbe.tar.bz2 podman-cf1f3191d2be691b482ac86f9476c180f608ddbe.zip |
make lint: include unit tests
Include the unit tests (i.e., _test.go files) for linting to make the
tests more robust and enforce the linters' coding styles etc.
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'pkg/hooks/exec/exec_test.go')
-rw-r--r-- | pkg/hooks/exec/exec_test.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pkg/hooks/exec/exec_test.go b/pkg/hooks/exec/exec_test.go index 7aac315cb..1e105373d 100644 --- a/pkg/hooks/exec/exec_test.go +++ b/pkg/hooks/exec/exec_test.go @@ -94,7 +94,7 @@ func TestRunEnvironment(t *testing.T) { Path: path, Args: []string{"sh", "-c", "env"}, } - for _, test := range []struct { + for _, tt := range []struct { name string env []string expected map[string]string @@ -120,6 +120,7 @@ func TestRunEnvironment(t *testing.T) { }, }, } { + test := tt t.Run(test.name, func(t *testing.T) { var stderr, stdout bytes.Buffer hook.Env = test.env @@ -147,7 +148,7 @@ func TestRunCancel(t *testing.T) { Args: []string{"sh", "-c", "echo waiting; sleep 2; echo done"}, } one := 1 - for _, test := range []struct { + for _, tt := range []struct { name string contextTimeout time.Duration hookTimeout *int @@ -174,6 +175,7 @@ func TestRunCancel(t *testing.T) { expectedRunError: context.DeadlineExceeded, }, } { + test := tt t.Run(test.name, func(t *testing.T) { ctx := context.Background() var stderr, stdout bytes.Buffer |