summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-04-22 15:10:13 +0200
committerPaul Holzinger <pholzing@redhat.com>2022-04-25 13:23:20 +0200
commitc7b16645aff27fff0b87bb2a98298693bbf20894 (patch)
treed93f86c9e13f0f87f09eb048929add31e13f8f93 /test
parentad3da638ce17439a7adbf2aa7e1b4017d583f660 (diff)
downloadpodman-c7b16645aff27fff0b87bb2a98298693bbf20894.tar.gz
podman-c7b16645aff27fff0b87bb2a98298693bbf20894.tar.bz2
podman-c7b16645aff27fff0b87bb2a98298693bbf20894.zip
enable unparam linter
The unparam linter is useful to detect unused function parameters and return values. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/e2e/common_test.go6
-rw-r--r--test/e2e/play_kube_test.go4
-rw-r--r--test/e2e/run_aardvark_test.go30
-rw-r--r--test/testvol/main.go9
4 files changed, 23 insertions, 26 deletions
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index f808eb2b6..c5cdd2c1d 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -1047,7 +1047,7 @@ var IPRegex = `(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01
// digShort execs into the given container and does a dig lookup with a timeout
// backoff. If it gets a response, it ensures that the output is in the correct
// format and iterates a string array for match
-func digShort(container, lookupName string, matchNames []string, p *PodmanTestIntegration) string {
+func digShort(container, lookupName string, matchNames []string, p *PodmanTestIntegration) {
digInterval := time.Millisecond * 250
for i := 0; i < 6; i++ {
time.Sleep(digInterval * time.Duration(i))
@@ -1059,9 +1059,9 @@ func digShort(container, lookupName string, matchNames []string, p *PodmanTestIn
for _, name := range matchNames {
Expect(output).To(Equal(name))
}
- return output
+ // success
+ return
}
}
Fail("dns is not responding")
- return ""
}
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index f16180854..4dd05c755 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -680,7 +680,7 @@ func generateMultiDocKubeYaml(kubeObjects []string, pathname string) error {
return writeYaml(multiKube, pathname)
}
-func createSecret(podmanTest *PodmanTestIntegration, name string, value []byte) {
+func createSecret(podmanTest *PodmanTestIntegration, name string, value []byte) { //nolint:unparam
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
err := ioutil.WriteFile(secretFilePath, value, 0755)
Expect(err).To(BeNil())
@@ -1078,7 +1078,7 @@ func withVolumeMount(mountPath string, readonly bool) ctrOption {
}
}
-func withEnv(name, value, valueFrom, refName, refKey string, optional bool) ctrOption {
+func withEnv(name, value, valueFrom, refName, refKey string, optional bool) ctrOption { //nolint:unparam
return func(c *Ctr) {
e := Env{
Name: name,
diff --git a/test/e2e/run_aardvark_test.go b/test/e2e/run_aardvark_test.go
index c82f614a6..7b4598423 100644
--- a/test/e2e/run_aardvark_test.go
+++ b/test/e2e/run_aardvark_test.go
@@ -54,7 +54,7 @@ var _ = Describe("Podman run networking", func() {
cip := ctrIP.OutputToString()
Expect(cip).To(MatchRegexp(IPRegex))
- _ = digShort(cid, "aone", []string{cip}, podmanTest)
+ digShort(cid, "aone", []string{cip}, podmanTest)
reverseLookup := podmanTest.Podman([]string{"exec", cid, "dig", "+short", "-x", cip})
reverseLookup.WaitWithDefaultTimeout()
@@ -95,9 +95,9 @@ var _ = Describe("Podman run networking", func() {
cip2 := ctrIP2.OutputToString()
Expect(cip2).To(MatchRegexp(IPRegex))
- _ = digShort("aone", "atwo", []string{cip2}, podmanTest)
+ digShort("aone", "atwo", []string{cip2}, podmanTest)
- _ = digShort("atwo", "aone", []string{cip1}, podmanTest)
+ digShort("atwo", "aone", []string{cip1}, podmanTest)
reverseLookup12 := podmanTest.Podman([]string{"exec", cid1, "dig", "+short", "-x", cip2})
reverseLookup12.WaitWithDefaultTimeout()
@@ -144,17 +144,17 @@ var _ = Describe("Podman run networking", func() {
cip2 := ctrIP2.OutputToString()
Expect(cip2).To(MatchRegexp(IPRegex))
- _ = digShort("aone", "atwo", []string{cip2}, podmanTest)
+ digShort("aone", "atwo", []string{cip2}, podmanTest)
- _ = digShort("aone", "alias_a2", []string{cip2}, podmanTest)
+ digShort("aone", "alias_a2", []string{cip2}, podmanTest)
- _ = digShort("aone", "alias_2a", []string{cip2}, podmanTest)
+ digShort("aone", "alias_2a", []string{cip2}, podmanTest)
- _ = digShort("atwo", "aone", []string{cip1}, podmanTest)
+ digShort("atwo", "aone", []string{cip1}, podmanTest)
- _ = digShort("atwo", "alias_a1", []string{cip1}, podmanTest)
+ digShort("atwo", "alias_a1", []string{cip1}, podmanTest)
- _ = digShort("atwo", "alias_1a", []string{cip1}, podmanTest)
+ digShort("atwo", "alias_1a", []string{cip1}, podmanTest)
})
@@ -251,13 +251,13 @@ var _ = Describe("Podman run networking", func() {
cipA2B22 := ctrIPA2B22.OutputToString()
Expect(cipA2B22).To(MatchRegexp(IPRegex))
- _ = digShort("aone", "atwobtwo", []string{cipA2B21}, podmanTest)
+ digShort("aone", "atwobtwo", []string{cipA2B21}, podmanTest)
- _ = digShort("bone", "atwobtwo", []string{cipA2B22}, podmanTest)
+ digShort("bone", "atwobtwo", []string{cipA2B22}, podmanTest)
- _ = digShort("atwobtwo", "aone", []string{cipA1}, podmanTest)
+ digShort("atwobtwo", "aone", []string{cipA1}, podmanTest)
- _ = digShort("atwobtwo", "bone", []string{cipB1}, podmanTest)
+ digShort("atwobtwo", "bone", []string{cipB1}, podmanTest)
})
It("Aardvark Test 6: Three subnets, first container on 1/2 and second on 2/3, w/ network aliases", func() {
@@ -305,9 +305,9 @@ var _ = Describe("Podman run networking", func() {
Expect(ctrIPCB2).Should(Exit(0))
cipCB2 := ctrIPCB2.OutputToString()
- _ = digShort("aone", "testB2_nw", []string{cipCB2}, podmanTest)
+ digShort("aone", "testB2_nw", []string{cipCB2}, podmanTest)
- _ = digShort("cone", "testB1_nw", []string{cipAB1}, podmanTest)
+ digShort("cone", "testB1_nw", []string{cipAB1}, podmanTest)
})
diff --git a/test/testvol/main.go b/test/testvol/main.go
index d15bf00cd..00b462eb2 100644
--- a/test/testvol/main.go
+++ b/test/testvol/main.go
@@ -86,10 +86,7 @@ func startServer(socketPath string) error {
}
}
- handle, err := makeDirDriver(config.path)
- if err != nil {
- return errors.Wrapf(err, "error making volume driver")
- }
+ handle := makeDirDriver(config.path)
logrus.Infof("Using %s for volume path", config.path)
server := volume.NewHandler(handle)
@@ -116,12 +113,12 @@ type dirVol struct {
}
// Make a new DirDriver.
-func makeDirDriver(path string) (volume.Driver, error) {
+func makeDirDriver(path string) volume.Driver {
drv := new(DirDriver)
drv.volumesPath = path
drv.volumes = make(map[string]*dirVol)
- return drv, nil
+ return drv
}
// Capabilities returns the capabilities of the driver.