Skip to content

Commit 00c666a

Browse files
e2e: rename err to errFailedToLocateRepoFile to prevent linter error
when err is declared and any parts below that declare again, linter complains as follows: shadow: declaration of err shadows declaration at line 51 so, we name the first declaration as errFailedToLocateRepoFile so that other 'err's do not need to be named all in different names or can be declared as 'err' without linter error. Signed-off-by: Hyeongju Johannes Lee <[email protected]>
1 parent 4c58a78 commit 00c666a

File tree

8 files changed

+60
-60
lines changed

8 files changed

+60
-60
lines changed

test/e2e/dlb/dlb.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ func describe() {
4545
f := framework.NewDefaultFramework("dlbplugin")
4646
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
4747

48-
kustomizationPath, err := utils.LocateRepoFile(kustomizationYaml)
49-
if err != nil {
50-
framework.Failf("unable to locate %q: %v", kustomizationYaml, err)
48+
kustomizationPath, errFailedToLocateRepoFile := utils.LocateRepoFile(kustomizationYaml)
49+
if errFailedToLocateRepoFile != nil {
50+
framework.Failf("unable to locate %q: %v", kustomizationYaml, errFailedToLocateRepoFile)
5151
}
5252

5353
var dpPodName string
@@ -108,9 +108,9 @@ func describe() {
108108
}
109109

110110
func runDemoApp(ctx context.Context, function, yaml string, f *framework.Framework) {
111-
demoPath, err := utils.LocateRepoFile(yaml)
112-
if err != nil {
113-
framework.Failf("unable to locate %q: %v", yaml, err)
111+
demoPath, errFailedToLocateRepoFile := utils.LocateRepoFile(yaml)
112+
if errFailedToLocateRepoFile != nil {
113+
framework.Failf("unable to locate %q: %v", yaml, errFailedToLocateRepoFile)
114114
}
115115

116116
podName := strings.TrimSuffix(filepath.Base(yaml), filepath.Ext(yaml))

test/e2e/dsa/dsa.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,19 @@ func describe() {
4646
f := framework.NewDefaultFramework("dsaplugin")
4747
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
4848

49-
kustomizationPath, err := utils.LocateRepoFile(kustomizationYaml)
50-
if err != nil {
51-
framework.Failf("unable to locate %q: %v", kustomizationYaml, err)
49+
kustomizationPath, errFailedToLocateRepoFile := utils.LocateRepoFile(kustomizationYaml)
50+
if errFailedToLocateRepoFile != nil {
51+
framework.Failf("unable to locate %q: %v", kustomizationYaml, errFailedToLocateRepoFile)
5252
}
5353

54-
configmap, err := utils.LocateRepoFile(configmapYaml)
55-
if err != nil {
56-
framework.Failf("unable to locate %q: %v", configmapYaml, err)
54+
configmap, errFailedToLocateRepoFile := utils.LocateRepoFile(configmapYaml)
55+
if errFailedToLocateRepoFile != nil {
56+
framework.Failf("unable to locate %q: %v", configmapYaml, errFailedToLocateRepoFile)
5757
}
5858

59-
demoPath, err := utils.LocateRepoFile(demoYaml)
60-
if err != nil {
61-
framework.Failf("unable to locate %q: %v", demoYaml, err)
59+
demoPath, errFailedToLocateRepoFile := utils.LocateRepoFile(demoYaml)
60+
if errFailedToLocateRepoFile != nil {
61+
framework.Failf("unable to locate %q: %v", demoYaml, errFailedToLocateRepoFile)
6262
}
6363

6464
var dpPodName string

test/e2e/fpga/fpga.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ func init() {
5050
}
5151

5252
func describe() {
53-
pluginKustomizationPath, err := utils.LocateRepoFile(pluginKustomizationYaml)
54-
if err != nil {
55-
framework.Failf("unable to locate %q: %v", pluginKustomizationYaml, err)
53+
pluginKustomizationPath, errFailedToLocateRepoFile := utils.LocateRepoFile(pluginKustomizationYaml)
54+
if errFailedToLocateRepoFile != nil {
55+
framework.Failf("unable to locate %q: %v", pluginKustomizationYaml, errFailedToLocateRepoFile)
5656
}
5757

58-
mappingsCollectionPath, err := utils.LocateRepoFile(mappingsCollectionYaml)
59-
if err != nil {
60-
framework.Failf("unable to locate %q: %v", mappingsCollectionYaml, err)
58+
mappingsCollectionPath, errFailedToLocateRepoFile := utils.LocateRepoFile(mappingsCollectionYaml)
59+
if errFailedToLocateRepoFile != nil {
60+
framework.Failf("unable to locate %q: %v", mappingsCollectionYaml, errFailedToLocateRepoFile)
6161
}
6262

6363
fmw := framework.NewDefaultFramework("fpgaplugin-e2e")

test/e2e/gpu/gpu.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ func describe() {
4747
f := framework.NewDefaultFramework("gpuplugin")
4848
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
4949

50-
kustomizationPath, err := utils.LocateRepoFile(kustomizationYaml)
51-
if err != nil {
52-
framework.Failf("unable to locate %q: %v", kustomizationYaml, err)
50+
kustomizationPath, errFailedToLocateRepoFile := utils.LocateRepoFile(kustomizationYaml)
51+
if errFailedToLocateRepoFile != nil {
52+
framework.Failf("unable to locate %q: %v", kustomizationYaml, errFailedToLocateRepoFile)
5353
}
5454

5555
ginkgo.It("checks availability of GPU resources", func(ctx context.Context) {

test/e2e/iaa/iaa.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,19 @@ func describe() {
4646
f := framework.NewDefaultFramework("iaaplugin")
4747
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
4848

49-
kustomizationPath, err := utils.LocateRepoFile(kustomizationYaml)
50-
if err != nil {
51-
framework.Failf("unable to locate %q: %v", kustomizationYaml, err)
49+
kustomizationPath, errFailedToLocateRepoFile := utils.LocateRepoFile(kustomizationYaml)
50+
if errFailedToLocateRepoFile != nil {
51+
framework.Failf("unable to locate %q: %v", kustomizationYaml, errFailedToLocateRepoFile)
5252
}
5353

54-
configmap, err := utils.LocateRepoFile(configmapYaml)
55-
if err != nil {
56-
framework.Failf("unable to locate %q: %v", configmapYaml, err)
54+
configmap, errFailedToLocateRepoFile := utils.LocateRepoFile(configmapYaml)
55+
if errFailedToLocateRepoFile != nil {
56+
framework.Failf("unable to locate %q: %v", configmapYaml, errFailedToLocateRepoFile)
5757
}
5858

59-
demoPath, err := utils.LocateRepoFile(demoYaml)
60-
if err != nil {
61-
framework.Failf("unable to locate %q: %v", demoYaml, err)
59+
demoPath, errFailedToLocateRepoFile := utils.LocateRepoFile(demoYaml)
60+
if errFailedToLocateRepoFile != nil {
61+
framework.Failf("unable to locate %q: %v", demoYaml, errFailedToLocateRepoFile)
6262
}
6363

6464
var dpPodName string

test/e2e/qat/qatplugin_dpdk.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,24 +59,24 @@ func describeQatDpdkPlugin() {
5959
f := framework.NewDefaultFramework("qatplugindpdk")
6060
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
6161

62-
kustomizationPath, err := utils.LocateRepoFile(qatPluginKustomizationYaml)
63-
if err != nil {
64-
framework.Failf("unable to locate %q: %v", qatPluginKustomizationYaml, err)
62+
kustomizationPath, errFailedToLocateRepoFile := utils.LocateRepoFile(qatPluginKustomizationYaml)
63+
if errFailedToLocateRepoFile != nil {
64+
framework.Failf("unable to locate %q: %v", qatPluginKustomizationYaml, errFailedToLocateRepoFile)
6565
}
6666

67-
compressTestYamlPath, err := utils.LocateRepoFile(compressTestYaml)
68-
if err != nil {
69-
framework.Failf("unable to locate %q: %v", compressTestYaml, err)
67+
compressTestYamlPath, errFailedToLocateRepoFile := utils.LocateRepoFile(compressTestYaml)
68+
if errFailedToLocateRepoFile != nil {
69+
framework.Failf("unable to locate %q: %v", compressTestYaml, errFailedToLocateRepoFile)
7070
}
7171

72-
cryptoTestYamlPath, err := utils.LocateRepoFile(cryptoTestYaml)
73-
if err != nil {
74-
framework.Failf("unable to locate %q: %v", cryptoTestYaml, err)
72+
cryptoTestYamlPath, errFailedToLocateRepoFile := utils.LocateRepoFile(cryptoTestYaml)
73+
if errFailedToLocateRepoFile != nil {
74+
framework.Failf("unable to locate %q: %v", cryptoTestYaml, errFailedToLocateRepoFile)
7575
}
7676

77-
cryptoTestGen4YamlPath, err := utils.LocateRepoFile(cryptoTestGen4Yaml)
78-
if err != nil {
79-
framework.Failf("unable to locate %q: %v", cryptoTestGen4Yaml, err)
77+
cryptoTestGen4YamlPath, errFailedToLocateRepoFile := utils.LocateRepoFile(cryptoTestGen4Yaml)
78+
if errFailedToLocateRepoFile != nil {
79+
framework.Failf("unable to locate %q: %v", cryptoTestGen4Yaml, errFailedToLocateRepoFile)
8080
}
8181

8282
var dpPodName string

test/e2e/qat/qatplugin_kernel.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ func describeQatKernelPlugin() {
4444
f := framework.NewDefaultFramework("qatpluginkernel")
4545
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
4646

47-
yamlPath, err := utils.LocateRepoFile(qatPluginKernelYaml)
48-
if err != nil {
49-
framework.Failf("unable to locate %q: %v", qatPluginKernelYaml, err)
47+
yamlPath, errFailedToLocateRepoFile := utils.LocateRepoFile(qatPluginKernelYaml)
48+
if errFailedToLocateRepoFile != nil {
49+
framework.Failf("unable to locate %q: %v", qatPluginKernelYaml, errFailedToLocateRepoFile)
5050
}
5151

5252
var dpPodName string

test/e2e/sgx/sgx.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ func describe() {
4747
f := framework.NewDefaultFramework("sgxplugin")
4848
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
4949

50-
deploymentWebhookPath, err := utils.LocateRepoFile(kustomizationWebhook)
51-
if err != nil {
52-
framework.Failf("unable to locate %q: %v", kustomizationWebhook, err)
50+
deploymentWebhookPath, errFailedToLocateRepoFile := utils.LocateRepoFile(kustomizationWebhook)
51+
if errFailedToLocateRepoFile != nil {
52+
framework.Failf("unable to locate %q: %v", kustomizationWebhook, errFailedToLocateRepoFile)
5353
}
5454

55-
deploymentPluginPath, err := utils.LocateRepoFile(kustomizationPlugin)
56-
if err != nil {
57-
framework.Failf("unable to locate %q: %v", kustomizationPlugin, err)
55+
deploymentPluginPath, errFailedToLocateRepoFile := utils.LocateRepoFile(kustomizationPlugin)
56+
if errFailedToLocateRepoFile != nil {
57+
framework.Failf("unable to locate %q: %v", kustomizationPlugin, errFailedToLocateRepoFile)
5858
}
5959

6060
ginkgo.BeforeEach(func(ctx context.Context) {
@@ -64,12 +64,12 @@ func describe() {
6464
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(deploymentPluginPath))
6565

6666
ginkgo.By("waiting for SGX plugin's availability")
67-
podList, errPodNotRunning := e2epod.WaitForPodsWithLabelRunningReady(ctx, f.ClientSet, f.Namespace.Name,
67+
podList, err := e2epod.WaitForPodsWithLabelRunningReady(ctx, f.ClientSet, f.Namespace.Name,
6868
labels.Set{"app": "intel-sgx-plugin"}.AsSelector(), 1 /* one replica */, 100*time.Second)
69-
if errPodNotRunning != nil {
69+
if err != nil {
7070
e2edebug.DumpAllNamespaceInfo(ctx, f.ClientSet, f.Namespace.Name)
7171
e2ekubectl.LogFailedContainers(ctx, f.ClientSet, f.Namespace.Name, framework.Logf)
72-
framework.Failf("unable to wait for all pods to be running and ready: %v", errPodNotRunning)
72+
framework.Failf("unable to wait for all pods to be running and ready: %v", err)
7373
}
7474

7575
ginkgo.By("checking SGX plugin's securityContext")
@@ -81,13 +81,13 @@ func describe() {
8181
ginkgo.Context("When SGX resources are available", func() {
8282
ginkgo.BeforeEach(func(ctx context.Context) {
8383
ginkgo.By("checking if the resource is allocatable")
84-
if err = utils.WaitForNodesWithResource(ctx, f.ClientSet, "sgx.intel.com/epc", 150*time.Second); err != nil {
84+
if err := utils.WaitForNodesWithResource(ctx, f.ClientSet, "sgx.intel.com/epc", 150*time.Second); err != nil {
8585
framework.Failf("unable to wait for nodes to have positive allocatable epc resource: %v", err)
8686
}
87-
if err = utils.WaitForNodesWithResource(ctx, f.ClientSet, "sgx.intel.com/enclave", 30*time.Second); err != nil {
87+
if err := utils.WaitForNodesWithResource(ctx, f.ClientSet, "sgx.intel.com/enclave", 30*time.Second); err != nil {
8888
framework.Failf("unable to wait for nodes to have positive allocatable enclave resource: %v", err)
8989
}
90-
if err = utils.WaitForNodesWithResource(ctx, f.ClientSet, "sgx.intel.com/provision", 30*time.Second); err != nil {
90+
if err := utils.WaitForNodesWithResource(ctx, f.ClientSet, "sgx.intel.com/provision", 30*time.Second); err != nil {
9191
framework.Failf("unable to wait for nodes to have positive allocatable provision resource: %v", err)
9292
}
9393
})

0 commit comments

Comments
 (0)