Skip to content

Commit f45d2d6

Browse files
committed
Remove unnecessary return and correct placement of creation of resources functions
1 parent bd940f1 commit f45d2d6

File tree

1 file changed

+15
-22
lines changed

1 file changed

+15
-22
lines changed

tests/suite/reconfig_test.go

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,13 @@ import (
2525

2626
// Cluster node size must be greater than or equal to 4 for test to perform correctly.
2727
var _ = Describe("Reconfiguration Performance Testing", Ordered, Label("reconfiguration", "nfr"), func() {
28-
// used for cleaning up resources
29-
const maxResourceCount = 150
30-
const metricExistTimeout = 2 * time.Minute
31-
const metricExistPolling = 1 * time.Second
28+
const (
29+
// used for cleaning up resources
30+
maxResourceCount = 150
31+
32+
metricExistTimeout = 2 * time.Minute
33+
metricExistPolling = 1 * time.Second
34+
)
3235

3336
var (
3437
scrapeInterval = 15 * time.Second
@@ -101,7 +104,7 @@ var _ = Describe("Reconfiguration Performance Testing", Ordered, Label("reconfig
101104
return nil
102105
}
103106

104-
createResourcesGWLast := func(resourceCount int) error {
107+
createResourcesGWLast := func(resourceCount int) {
105108
ctx, cancel := context.WithTimeout(context.Background(), timeoutConfig.CreateTimeout)
106109
defer cancel()
107110

@@ -136,11 +139,9 @@ var _ = Describe("Reconfiguration Performance Testing", Ordered, Label("reconfig
136139
}
137140

138141
Expect(resourceManager.ApplyFromFiles([]string{"reconfig/gateway.yaml"}, reconfigNamespace.Name)).To(Succeed())
139-
140-
return nil
141142
}
142143

143-
createResourcesRoutesLast := func(resourceCount int) error {
144+
createResourcesRoutesLast := func(resourceCount int) {
144145
ctx, cancel := context.WithTimeout(context.Background(), timeoutConfig.CreateTimeout)
145146
defer cancel()
146147

@@ -174,8 +175,6 @@ var _ = Describe("Reconfiguration Performance Testing", Ordered, Label("reconfig
174175
reconfigNamespace.Name)).To(Succeed())
175176

176177
Expect(createUniqueResources(resourceCount, "manifests/reconfig/cafe-routes.yaml")).To(Succeed())
177-
178-
return nil
179178
}
180179

181180
checkResourceCreation := func(resourceCount int) error {
@@ -453,9 +452,8 @@ var _ = Describe("Reconfiguration Performance Testing", Ordered, Label("reconfig
453452
It("gathers metrics after creating 30 resources", func() {
454453
resourceCount := 30
455454
timeToReadyStartingLogSubstring := "Starting NGINX Gateway Fabric"
456-
test := createResourcesGWLast(resourceCount)
457455

458-
Expect(test).To(Succeed())
456+
createResourcesGWLast(resourceCount)
459457
Expect(checkResourceCreation(resourceCount)).To(Succeed())
460458

461459
ngfPodName, startTime := deployNGFReturnsNGFPodNameAndStartTime()
@@ -472,9 +470,8 @@ var _ = Describe("Reconfiguration Performance Testing", Ordered, Label("reconfig
472470
It("gathers metrics after creating 150 resources", func() {
473471
resourceCount := 150
474472
timeToReadyStartingLogSubstring := "Starting NGINX Gateway Fabric"
475-
test := createResourcesGWLast(resourceCount)
476473

477-
Expect(test).To(Succeed())
474+
createResourcesGWLast(resourceCount)
478475
Expect(checkResourceCreation(resourceCount)).To(Succeed())
479476

480477
ngfPodName, startTime := deployNGFReturnsNGFPodNameAndStartTime()
@@ -495,11 +492,10 @@ var _ = Describe("Reconfiguration Performance Testing", Ordered, Label("reconfig
495492
It("gathers metrics after creating 30 resources", func() {
496493
resourceCount := 30
497494
timeToReadyStartingLogSubstring := "Reconciling the resource\",\"controller\":\"httproute\""
498-
test := createResourcesRoutesLast(resourceCount)
499495

500496
ngfPodName, startTime := deployNGFReturnsNGFPodNameAndStartTime()
501497

502-
Expect(test).To(Succeed())
498+
createResourcesRoutesLast(resourceCount)
503499
Expect(checkResourceCreation(resourceCount)).To(Succeed())
504500

505501
collectMetrics(
@@ -514,11 +510,10 @@ var _ = Describe("Reconfiguration Performance Testing", Ordered, Label("reconfig
514510
It("gathers metrics after creating 150 resources", func() {
515511
resourceCount := 150
516512
timeToReadyStartingLogSubstring := "Reconciling the resource\",\"controller\":\"httproute\""
517-
test := createResourcesRoutesLast(resourceCount)
518513

519514
ngfPodName, startTime := deployNGFReturnsNGFPodNameAndStartTime()
520515

521-
Expect(test).To(Succeed())
516+
createResourcesRoutesLast(resourceCount)
522517
Expect(checkResourceCreation(resourceCount)).To(Succeed())
523518

524519
collectMetrics(
@@ -537,11 +532,10 @@ var _ = Describe("Reconfiguration Performance Testing", Ordered, Label("reconfig
537532
It("gathers metrics after creating 30 resources", func() {
538533
resourceCount := 30
539534
timeToReadyStartingLogSubstring := "Reconciling the resource\",\"controller\":\"gateway\""
540-
test := createResourcesGWLast(resourceCount)
541535

542536
ngfPodName, startTime := deployNGFReturnsNGFPodNameAndStartTime()
543537

544-
Expect(test).To(Succeed())
538+
createResourcesGWLast(resourceCount)
545539
Expect(checkResourceCreation(resourceCount)).To(Succeed())
546540

547541
collectMetrics(
@@ -556,11 +550,10 @@ var _ = Describe("Reconfiguration Performance Testing", Ordered, Label("reconfig
556550
It("gathers metrics after creating 150 resources", func() {
557551
resourceCount := 150
558552
timeToReadyStartingLogSubstring := "Reconciling the resource\",\"controller\":\"gateway\""
559-
test := createResourcesGWLast(resourceCount)
560553

561554
ngfPodName, startTime := deployNGFReturnsNGFPodNameAndStartTime()
562555

563-
Expect(test).To(Succeed())
556+
createResourcesGWLast(resourceCount)
564557
Expect(checkResourceCreation(resourceCount)).To(Succeed())
565558

566559
collectMetrics(

0 commit comments

Comments
 (0)