Skip to content

Commit 53946b6

Browse files
committed
fix ginkgolinter findins
1 parent 770ff04 commit 53946b6

File tree

16 files changed

+26
-26
lines changed

16 files changed

+26
-26
lines changed

internal/framework/controller/register_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func TestRegister(t *testing.T) {
150150
} else {
151151
err := register()
152152
if test.expectedErr == nil {
153-
g.Expect(err).To(BeNil())
153+
g.Expect(err).ToNot(HaveOccurred())
154154
} else {
155155
g.Expect(err).To(MatchError(test.expectedErr))
156156
}

internal/framework/events/events_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ func TestEventLoop_SwapBatches(t *testing.T) {
2828

2929
eventLoop.swapBatches()
3030

31-
g.Expect(len(eventLoop.currentBatch)).To(Equal(len(nextBatch)))
31+
g.Expect(eventLoop.currentBatch).To(HaveLen(len(nextBatch)))
3232
g.Expect(eventLoop.currentBatch).To(Equal(nextBatch))
33-
g.Expect(len(eventLoop.nextBatch)).To(Equal(0))
33+
g.Expect(eventLoop.nextBatch).To(BeEmpty())
3434
g.Expect(cap(eventLoop.nextBatch)).To(Equal(3))
3535
}

internal/framework/events/first_eventbatch_preparer_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ var _ = Describe("FirstEventBatchPreparer", func() {
5858
batch, err := preparer.Prepare(context.Background())
5959

6060
Expect(batch).Should(BeEmpty())
61-
Expect(err).Should(BeNil())
61+
Expect(err).ShouldNot(HaveOccurred())
6262
})
6363

6464
It("should prepare one event for each resource type", func() {
@@ -97,7 +97,7 @@ var _ = Describe("FirstEventBatchPreparer", func() {
9797
batch, err := preparer.Prepare(context.Background())
9898

9999
Expect(batch).Should(Equal(expectedBatch))
100-
Expect(err).Should(BeNil())
100+
Expect(err).ShouldNot(HaveOccurred())
101101
})
102102
})
103103

internal/framework/events/loop_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ var _ = Describe("EventLoop", func() {
5959

6060
var err error
6161
Eventually(errorCh).Should(Receive(&err))
62-
Expect(err).To(BeNil())
62+
Expect(err).ToNot(HaveOccurred())
6363
})
6464

6565
// Because BeforeEach() creates the first batch and waits for it to be handled, in the tests below
@@ -138,7 +138,7 @@ var _ = Describe("EventLoop", func() {
138138
cancel()
139139
err := eventLoop.Start(ctx)
140140

141-
Expect(err).Should(BeNil())
141+
Expect(err).ShouldNot(HaveOccurred())
142142
})
143143
})
144144
})

internal/framework/runnables/runnables_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func TestEnableAfterBecameLeader(t *testing.T) {
3232
g.Expect(enabled).To(BeFalse())
3333

3434
err := enableAfterBecameLeader.Start(context.Background())
35-
g.Expect(err).To(BeNil())
35+
g.Expect(err).ToNot(HaveOccurred())
3636

3737
g.Expect(enabled).To(BeTrue())
3838
}

internal/mode/provisioner/handler_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ var _ = Describe("handler", func() {
342342
err := k8sclient.List(context.Background(), deps)
343343

344344
Expect(err).ToNot(HaveOccurred())
345-
Expect(deps.Items).To(HaveLen(0))
345+
Expect(deps.Items).To(BeEmpty())
346346
})
347347
})
348348

@@ -370,7 +370,7 @@ var _ = Describe("handler", func() {
370370
err := k8sclient.List(context.Background(), deps)
371371

372372
Expect(err).ToNot(HaveOccurred())
373-
Expect(deps.Items).To(HaveLen(0))
373+
Expect(deps.Items).To(BeEmpty())
374374
})
375375
})
376376

internal/mode/static/handler_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ var _ = Describe("eventHandler", func() {
229229
"Failed to update control plane configuration: logging.level: Unsupported value: " +
230230
"\"invalid\": supported values: \"info\", \"debug\", \"error\"")
231231
Expect(statuses).To(Equal(expStatuses(cond)))
232-
Expect(len(fakeEventRecorder.Events)).To(Equal(1))
232+
Expect(fakeEventRecorder.Events).To(HaveLen(1))
233233
event := <-fakeEventRecorder.Events
234234
Expect(event).To(Equal(
235235
"Warning UpdateFailed Failed to update control plane configuration: logging.level: Unsupported value: " +
@@ -252,7 +252,7 @@ var _ = Describe("eventHandler", func() {
252252

253253
Expect(handler.GetLatestConfiguration()).To(BeNil())
254254

255-
Expect(len(fakeEventRecorder.Events)).To(Equal(1))
255+
Expect(fakeEventRecorder.Events).To(HaveLen(1))
256256
event := <-fakeEventRecorder.Events
257257
Expect(event).To(Equal("Warning ResourceDeleted NginxGateway configuration was deleted; using defaults"))
258258
Expect(zapLogLevelSetter.Enabled(zap.InfoLevel)).To(BeTrue())

internal/mode/static/sort/sort_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func TestLessObjectMeta(t *testing.T) {
8585
invertedResult := LessObjectMeta(test.meta2, test.meta1)
8686

8787
g.Expect(result).To(Equal(test.expected))
88-
g.Expect(invertedResult).To(Equal(false))
88+
g.Expect(invertedResult).To(BeFalse())
8989
})
9090
}
9191
}

internal/mode/static/state/graph/backend_tls_policy_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ func TestValidateBackendTLSPolicy(t *testing.T) {
405405
if !test.isValid && !test.ignored {
406406
g.Expect(conds).To(HaveLen(1))
407407
} else {
408-
g.Expect(conds).To(HaveLen(0))
408+
g.Expect(conds).To(BeEmpty())
409409
}
410410
})
411411
}

internal/mode/static/state/graph/httproute_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ func TestBuildSectionNameRefs(t *testing.T) {
250250
if test.expectedError != nil {
251251
g.Expect(err).To(Equal(test.expectedError))
252252
} else {
253-
g.Expect(err).To(BeNil())
253+
g.Expect(err).ToNot(HaveOccurred())
254254
}
255255
})
256256
}

0 commit comments

Comments
 (0)