summaryrefslogtreecommitdiff
path: root/pkg/hooks
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-06-15 09:19:40 -0400
committerGitHub <noreply@github.com>2020-06-15 09:19:40 -0400
commitf4c3b718eb22a161a897a6ed55d10f3a07e31aa8 (patch)
treebb453d40a50f8cef1ebfedc73e43e2c7fe7d3456 /pkg/hooks
parente94e3fd2e829fd2cd38428aa9d9bf68b37bb8407 (diff)
parent200cfa41a434b7143620c2c252b3eb7ab3ef92f9 (diff)
downloadpodman-f4c3b718eb22a161a897a6ed55d10f3a07e31aa8.tar.gz
podman-f4c3b718eb22a161a897a6ed55d10f3a07e31aa8.tar.bz2
podman-f4c3b718eb22a161a897a6ed55d10f3a07e31aa8.zip
Merge pull request #6557 from rhatdan/lint
Turn on More linters
Diffstat (limited to 'pkg/hooks')
-rw-r--r--pkg/hooks/exec/runtimeconfigfilter_test.go54
1 files changed, 22 insertions, 32 deletions
diff --git a/pkg/hooks/exec/runtimeconfigfilter_test.go b/pkg/hooks/exec/runtimeconfigfilter_test.go
index 48dd2f998..f4b6cf86a 100644
--- a/pkg/hooks/exec/runtimeconfigfilter_test.go
+++ b/pkg/hooks/exec/runtimeconfigfilter_test.go
@@ -12,21 +12,11 @@ import (
"github.com/stretchr/testify/assert"
)
-func pointerInt(value int) *int {
- return &value
-}
-
-func pointerUInt32(value uint32) *uint32 {
- return &value
-}
-
-func pointerFileMode(value os.FileMode) *os.FileMode {
- return &value
-}
-
func TestRuntimeConfigFilter(t *testing.T) {
unexpectedEndOfJSONInput := json.Unmarshal([]byte("{\n"), nil) //nolint
-
+ fileMode := os.FileMode(0600)
+ rootUint32 := uint32(0)
+ binUser := int(1)
for _, tt := range []struct {
name string
contextTimeout time.Duration
@@ -77,9 +67,9 @@ func TestRuntimeConfigFilter(t *testing.T) {
Type: "c",
Major: 10,
Minor: 229,
- FileMode: pointerFileMode(0600),
- UID: pointerUInt32(0),
- GID: pointerUInt32(0),
+ FileMode: &fileMode,
+ UID: &rootUint32,
+ GID: &rootUint32,
},
},
},
@@ -96,18 +86,18 @@ func TestRuntimeConfigFilter(t *testing.T) {
Type: "c",
Major: 10,
Minor: 229,
- FileMode: pointerFileMode(0600),
- UID: pointerUInt32(0),
- GID: pointerUInt32(0),
+ FileMode: &fileMode,
+ UID: &rootUint32,
+ GID: &rootUint32,
},
{
Path: "/dev/sda",
Type: "b",
Major: 8,
Minor: 0,
- FileMode: pointerFileMode(0600),
- UID: pointerUInt32(0),
- GID: pointerUInt32(0),
+ FileMode: &fileMode,
+ UID: &rootUint32,
+ GID: &rootUint32,
},
},
},
@@ -137,9 +127,9 @@ func TestRuntimeConfigFilter(t *testing.T) {
Type: "c",
Major: 10,
Minor: 229,
- FileMode: pointerFileMode(0600),
- UID: pointerUInt32(0),
- GID: pointerUInt32(0),
+ FileMode: &fileMode,
+ UID: &rootUint32,
+ GID: &rootUint32,
},
},
},
@@ -156,18 +146,18 @@ func TestRuntimeConfigFilter(t *testing.T) {
Type: "c",
Major: 10,
Minor: 229,
- FileMode: pointerFileMode(0600),
- UID: pointerUInt32(0),
- GID: pointerUInt32(0),
+ FileMode: &fileMode,
+ UID: &rootUint32,
+ GID: &rootUint32,
},
{
Path: "/dev/sdb",
Type: "b",
Major: 8,
Minor: 0,
- FileMode: pointerFileMode(0600),
- UID: pointerUInt32(0),
- GID: pointerUInt32(0),
+ FileMode: &fileMode,
+ UID: &rootUint32,
+ GID: &rootUint32,
},
},
},
@@ -203,7 +193,7 @@ func TestRuntimeConfigFilter(t *testing.T) {
{
Path: path,
Args: []string{"sh", "-c", "sleep 2"},
- Timeout: pointerInt(1),
+ Timeout: &binUser,
},
},
input: &spec.Spec{