Skip to content

Commit 95dd90b

Browse files
committed
[golangci-lint] govet: shadow declaration
1 parent 1e29b7e commit 95dd90b

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

internal/controller/eviction_controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ var _ = Describe("Eviction Controller", func() {
9797
fakeServer testhelper.FakeServer
9898
)
9999

100-
ctx := context.Background()
100+
ctx := context.Background() // nolint:govet
101101

102102
BeforeEach(func() {
103103
By("Setting up the OpenStack http mock server")

internal/controller/node_certificate_controller_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import (
3232

3333
var _ = Describe("Node Certificate Controller", func() {
3434
var nodeCertificateController *NodeCertificateController
35-
var k8sClient client.Client
35+
var fakeClient client.Client
3636
const (
3737
nodeName = "random-node"
3838
issuerName = "test-issuer"
@@ -50,17 +50,17 @@ var _ = Describe("Node Certificate Controller", func() {
5050
// We need to use the fake client because the envtest environment does include
5151
// cert-manager CRDs out of the box.
5252
By("Creating the fake client")
53-
k8sClient = fake.NewClientBuilder().WithScheme(scheme).Build()
53+
fakeClient = fake.NewClientBuilder().WithScheme(scheme).Build()
5454
nodeCertificateController = &NodeCertificateController{
55-
Client: k8sClient,
56-
Scheme: k8sClient.Scheme(),
55+
Client: fakeClient,
56+
Scheme: fakeClient.Scheme(),
5757
issuerName: issuerName,
5858
namespace: namespace,
5959
}
6060

6161
By("creating the namespace for the reconciler")
6262
ns := &corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: namespace}}
63-
Expect(client.IgnoreAlreadyExists(k8sClient.Create(ctx, ns))).To(Succeed())
63+
Expect(client.IgnoreAlreadyExists(fakeClient.Create(ctx, ns))).To(Succeed())
6464

6565
By("creating the core resource for the Kind Node")
6666
resource := &corev1.Node{
@@ -69,13 +69,13 @@ var _ = Describe("Node Certificate Controller", func() {
6969
Labels: map[string]string{labelHypervisor: "test"}, //nolint:goconst
7070
},
7171
}
72-
Expect(k8sClient.Create(ctx, resource)).To(Succeed())
72+
Expect(fakeClient.Create(ctx, resource)).To(Succeed())
7373
})
7474

7575
AfterEach(func() {
7676
node := &corev1.Node{ObjectMeta: metav1.ObjectMeta{Name: nodeName}}
7777
By("Cleanup the specific node")
78-
Expect(client.IgnoreAlreadyExists(k8sClient.Delete(ctx, node))).To(Succeed())
78+
Expect(client.IgnoreAlreadyExists(fakeClient.Delete(ctx, node))).To(Succeed())
7979

8080
By("Cleaning up the test environment")
8181
})
@@ -94,7 +94,7 @@ var _ = Describe("Node Certificate Controller", func() {
9494
By("Checking if the certificate was created")
9595
_, certName := getSecretAndCertName(nodeName)
9696
certificate := &cmapi.Certificate{}
97-
err = k8sClient.Get(ctx, types.NamespacedName{Name: certName, Namespace: namespace}, certificate)
97+
err = fakeClient.Get(ctx, types.NamespacedName{Name: certName, Namespace: namespace}, certificate)
9898
Expect(err).NotTo(HaveOccurred())
9999
Expect(certificate.Spec.IssuerRef.Name).To(Equal(issuerName))
100100
Expect(certificate.Spec.DNSNames).To(ContainElement(nodeName))

internal/controller/node_eviction_label_controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ var _ = Describe("Node Eviction Label Controller", func() {
4949
)
5050

5151
Context("When reconciling a node", func() {
52-
ctx := context.Background()
52+
ctx := context.Background() // nolint:govet
5353

5454
reconcileNodeLoop := func(steps int) (res ctrl.Result, err error) {
5555
for range steps {

internal/controller/onboarding_controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ var _ = Describe("Onboarding Controller", func() {
3838
Context("When reconciling a hypervisor", func() {
3939
const hypervisorName = "some-test"
4040

41-
ctx := context.Background()
41+
ctx := context.Background() // nolint:govet
4242

4343
reconcileLoop := func(steps int) (res ctrl.Result, err error) {
4444
req := ctrl.Request{

0 commit comments

Comments
 (0)