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 <hyeongju.lee@intel.com>
This commit is contained in:
Hyeongju Johannes Lee 2023-08-07 14:43:10 +03:00
parent 4c58a78a14
commit 00c666ac57
8 changed files with 60 additions and 60 deletions

View File

@ -45,9 +45,9 @@ func describe() {
f := framework.NewDefaultFramework("dlbplugin")
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
kustomizationPath, err := utils.LocateRepoFile(kustomizationYaml)
if err != nil {
framework.Failf("unable to locate %q: %v", kustomizationYaml, err)
kustomizationPath, errFailedToLocateRepoFile := utils.LocateRepoFile(kustomizationYaml)
if errFailedToLocateRepoFile != nil {
framework.Failf("unable to locate %q: %v", kustomizationYaml, errFailedToLocateRepoFile)
}
var dpPodName string
@ -108,9 +108,9 @@ func describe() {
}
func runDemoApp(ctx context.Context, function, yaml string, f *framework.Framework) {
demoPath, err := utils.LocateRepoFile(yaml)
if err != nil {
framework.Failf("unable to locate %q: %v", yaml, err)
demoPath, errFailedToLocateRepoFile := utils.LocateRepoFile(yaml)
if errFailedToLocateRepoFile != nil {
framework.Failf("unable to locate %q: %v", yaml, errFailedToLocateRepoFile)
}
podName := strings.TrimSuffix(filepath.Base(yaml), filepath.Ext(yaml))

View File

@ -46,19 +46,19 @@ func describe() {
f := framework.NewDefaultFramework("dsaplugin")
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
kustomizationPath, err := utils.LocateRepoFile(kustomizationYaml)
if err != nil {
framework.Failf("unable to locate %q: %v", kustomizationYaml, err)
kustomizationPath, errFailedToLocateRepoFile := utils.LocateRepoFile(kustomizationYaml)
if errFailedToLocateRepoFile != nil {
framework.Failf("unable to locate %q: %v", kustomizationYaml, errFailedToLocateRepoFile)
}
configmap, err := utils.LocateRepoFile(configmapYaml)
if err != nil {
framework.Failf("unable to locate %q: %v", configmapYaml, err)
configmap, errFailedToLocateRepoFile := utils.LocateRepoFile(configmapYaml)
if errFailedToLocateRepoFile != nil {
framework.Failf("unable to locate %q: %v", configmapYaml, errFailedToLocateRepoFile)
}
demoPath, err := utils.LocateRepoFile(demoYaml)
if err != nil {
framework.Failf("unable to locate %q: %v", demoYaml, err)
demoPath, errFailedToLocateRepoFile := utils.LocateRepoFile(demoYaml)
if errFailedToLocateRepoFile != nil {
framework.Failf("unable to locate %q: %v", demoYaml, errFailedToLocateRepoFile)
}
var dpPodName string

View File

@ -50,14 +50,14 @@ func init() {
}
func describe() {
pluginKustomizationPath, err := utils.LocateRepoFile(pluginKustomizationYaml)
if err != nil {
framework.Failf("unable to locate %q: %v", pluginKustomizationYaml, err)
pluginKustomizationPath, errFailedToLocateRepoFile := utils.LocateRepoFile(pluginKustomizationYaml)
if errFailedToLocateRepoFile != nil {
framework.Failf("unable to locate %q: %v", pluginKustomizationYaml, errFailedToLocateRepoFile)
}
mappingsCollectionPath, err := utils.LocateRepoFile(mappingsCollectionYaml)
if err != nil {
framework.Failf("unable to locate %q: %v", mappingsCollectionYaml, err)
mappingsCollectionPath, errFailedToLocateRepoFile := utils.LocateRepoFile(mappingsCollectionYaml)
if errFailedToLocateRepoFile != nil {
framework.Failf("unable to locate %q: %v", mappingsCollectionYaml, errFailedToLocateRepoFile)
}
fmw := framework.NewDefaultFramework("fpgaplugin-e2e")

View File

@ -47,9 +47,9 @@ func describe() {
f := framework.NewDefaultFramework("gpuplugin")
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
kustomizationPath, err := utils.LocateRepoFile(kustomizationYaml)
if err != nil {
framework.Failf("unable to locate %q: %v", kustomizationYaml, err)
kustomizationPath, errFailedToLocateRepoFile := utils.LocateRepoFile(kustomizationYaml)
if errFailedToLocateRepoFile != nil {
framework.Failf("unable to locate %q: %v", kustomizationYaml, errFailedToLocateRepoFile)
}
ginkgo.It("checks availability of GPU resources", func(ctx context.Context) {

View File

@ -46,19 +46,19 @@ func describe() {
f := framework.NewDefaultFramework("iaaplugin")
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
kustomizationPath, err := utils.LocateRepoFile(kustomizationYaml)
if err != nil {
framework.Failf("unable to locate %q: %v", kustomizationYaml, err)
kustomizationPath, errFailedToLocateRepoFile := utils.LocateRepoFile(kustomizationYaml)
if errFailedToLocateRepoFile != nil {
framework.Failf("unable to locate %q: %v", kustomizationYaml, errFailedToLocateRepoFile)
}
configmap, err := utils.LocateRepoFile(configmapYaml)
if err != nil {
framework.Failf("unable to locate %q: %v", configmapYaml, err)
configmap, errFailedToLocateRepoFile := utils.LocateRepoFile(configmapYaml)
if errFailedToLocateRepoFile != nil {
framework.Failf("unable to locate %q: %v", configmapYaml, errFailedToLocateRepoFile)
}
demoPath, err := utils.LocateRepoFile(demoYaml)
if err != nil {
framework.Failf("unable to locate %q: %v", demoYaml, err)
demoPath, errFailedToLocateRepoFile := utils.LocateRepoFile(demoYaml)
if errFailedToLocateRepoFile != nil {
framework.Failf("unable to locate %q: %v", demoYaml, errFailedToLocateRepoFile)
}
var dpPodName string

View File

@ -59,24 +59,24 @@ func describeQatDpdkPlugin() {
f := framework.NewDefaultFramework("qatplugindpdk")
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
kustomizationPath, err := utils.LocateRepoFile(qatPluginKustomizationYaml)
if err != nil {
framework.Failf("unable to locate %q: %v", qatPluginKustomizationYaml, err)
kustomizationPath, errFailedToLocateRepoFile := utils.LocateRepoFile(qatPluginKustomizationYaml)
if errFailedToLocateRepoFile != nil {
framework.Failf("unable to locate %q: %v", qatPluginKustomizationYaml, errFailedToLocateRepoFile)
}
compressTestYamlPath, err := utils.LocateRepoFile(compressTestYaml)
if err != nil {
framework.Failf("unable to locate %q: %v", compressTestYaml, err)
compressTestYamlPath, errFailedToLocateRepoFile := utils.LocateRepoFile(compressTestYaml)
if errFailedToLocateRepoFile != nil {
framework.Failf("unable to locate %q: %v", compressTestYaml, errFailedToLocateRepoFile)
}
cryptoTestYamlPath, err := utils.LocateRepoFile(cryptoTestYaml)
if err != nil {
framework.Failf("unable to locate %q: %v", cryptoTestYaml, err)
cryptoTestYamlPath, errFailedToLocateRepoFile := utils.LocateRepoFile(cryptoTestYaml)
if errFailedToLocateRepoFile != nil {
framework.Failf("unable to locate %q: %v", cryptoTestYaml, errFailedToLocateRepoFile)
}
cryptoTestGen4YamlPath, err := utils.LocateRepoFile(cryptoTestGen4Yaml)
if err != nil {
framework.Failf("unable to locate %q: %v", cryptoTestGen4Yaml, err)
cryptoTestGen4YamlPath, errFailedToLocateRepoFile := utils.LocateRepoFile(cryptoTestGen4Yaml)
if errFailedToLocateRepoFile != nil {
framework.Failf("unable to locate %q: %v", cryptoTestGen4Yaml, errFailedToLocateRepoFile)
}
var dpPodName string

View File

@ -44,9 +44,9 @@ func describeQatKernelPlugin() {
f := framework.NewDefaultFramework("qatpluginkernel")
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
yamlPath, err := utils.LocateRepoFile(qatPluginKernelYaml)
if err != nil {
framework.Failf("unable to locate %q: %v", qatPluginKernelYaml, err)
yamlPath, errFailedToLocateRepoFile := utils.LocateRepoFile(qatPluginKernelYaml)
if errFailedToLocateRepoFile != nil {
framework.Failf("unable to locate %q: %v", qatPluginKernelYaml, errFailedToLocateRepoFile)
}
var dpPodName string

View File

@ -47,14 +47,14 @@ func describe() {
f := framework.NewDefaultFramework("sgxplugin")
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
deploymentWebhookPath, err := utils.LocateRepoFile(kustomizationWebhook)
if err != nil {
framework.Failf("unable to locate %q: %v", kustomizationWebhook, err)
deploymentWebhookPath, errFailedToLocateRepoFile := utils.LocateRepoFile(kustomizationWebhook)
if errFailedToLocateRepoFile != nil {
framework.Failf("unable to locate %q: %v", kustomizationWebhook, errFailedToLocateRepoFile)
}
deploymentPluginPath, err := utils.LocateRepoFile(kustomizationPlugin)
if err != nil {
framework.Failf("unable to locate %q: %v", kustomizationPlugin, err)
deploymentPluginPath, errFailedToLocateRepoFile := utils.LocateRepoFile(kustomizationPlugin)
if errFailedToLocateRepoFile != nil {
framework.Failf("unable to locate %q: %v", kustomizationPlugin, errFailedToLocateRepoFile)
}
ginkgo.BeforeEach(func(ctx context.Context) {
@ -64,12 +64,12 @@ func describe() {
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(deploymentPluginPath))
ginkgo.By("waiting for SGX plugin's availability")
podList, errPodNotRunning := e2epod.WaitForPodsWithLabelRunningReady(ctx, f.ClientSet, f.Namespace.Name,
podList, err := e2epod.WaitForPodsWithLabelRunningReady(ctx, f.ClientSet, f.Namespace.Name,
labels.Set{"app": "intel-sgx-plugin"}.AsSelector(), 1 /* one replica */, 100*time.Second)
if errPodNotRunning != nil {
if err != nil {
e2edebug.DumpAllNamespaceInfo(ctx, f.ClientSet, f.Namespace.Name)
e2ekubectl.LogFailedContainers(ctx, f.ClientSet, f.Namespace.Name, framework.Logf)
framework.Failf("unable to wait for all pods to be running and ready: %v", errPodNotRunning)
framework.Failf("unable to wait for all pods to be running and ready: %v", err)
}
ginkgo.By("checking SGX plugin's securityContext")
@ -81,13 +81,13 @@ func describe() {
ginkgo.Context("When SGX resources are available", func() {
ginkgo.BeforeEach(func(ctx context.Context) {
ginkgo.By("checking if the resource is allocatable")
if err = utils.WaitForNodesWithResource(ctx, f.ClientSet, "sgx.intel.com/epc", 150*time.Second); err != nil {
if err := utils.WaitForNodesWithResource(ctx, f.ClientSet, "sgx.intel.com/epc", 150*time.Second); err != nil {
framework.Failf("unable to wait for nodes to have positive allocatable epc resource: %v", err)
}
if err = utils.WaitForNodesWithResource(ctx, f.ClientSet, "sgx.intel.com/enclave", 30*time.Second); err != nil {
if err := utils.WaitForNodesWithResource(ctx, f.ClientSet, "sgx.intel.com/enclave", 30*time.Second); err != nil {
framework.Failf("unable to wait for nodes to have positive allocatable enclave resource: %v", err)
}
if err = utils.WaitForNodesWithResource(ctx, f.ClientSet, "sgx.intel.com/provision", 30*time.Second); err != nil {
if err := utils.WaitForNodesWithResource(ctx, f.ClientSet, "sgx.intel.com/provision", 30*time.Second); err != nil {
framework.Failf("unable to wait for nodes to have positive allocatable provision resource: %v", err)
}
})