Skip to content

Commit 685610e

Browse files
committed
Update
Signed-off-by: Rick Brouwer <[email protected]>
1 parent e13477e commit 685610e

File tree

2 files changed

+46
-46
lines changed

2 files changed

+46
-46
lines changed

apis/keda/v1alpha1/scaledobject_types_test.go

+45-45
Original file line numberDiff line numberDiff line change
@@ -272,15 +272,15 @@ func TestCheckFallbackValid(t *testing.T) {
272272
for _, test := range tests {
273273
t.Run(test.name, func(t *testing.T) {
274274
err := CheckFallbackValid(test.scaledObject)
275-
275+
276276
if test.expectedError && err == nil {
277277
t.Error("Expected error but got nil")
278278
}
279-
279+
280280
if !test.expectedError && err != nil {
281281
t.Errorf("Expected no error but got: %v", err)
282282
}
283-
283+
284284
if test.expectedError && err != nil && test.errorContains != "" {
285285
if !contains(err.Error(), test.errorContains) {
286286
t.Errorf("Error message does not contain expected text.\nExpected to contain: %s\nActual: %s",
@@ -381,52 +381,52 @@ func TestNeedToBePausedByAnnotation(t *testing.T) {
381381
pausedReplicaCount := int32(5)
382382

383383
tests := []struct {
384-
name string
385-
annotations map[string]string
384+
name string
385+
annotations map[string]string
386386
pausedReplicaCount *int32
387-
expectResult bool
387+
expectResult bool
388388
}{
389389
{
390-
name: "No annotations",
391-
annotations: nil,
390+
name: "No annotations",
391+
annotations: nil,
392392
pausedReplicaCount: nil,
393-
expectResult: false,
393+
expectResult: false,
394394
},
395395
{
396-
name: "PausedAnnotation with true value",
397-
annotations: map[string]string{PausedAnnotation: "true"},
396+
name: "PausedAnnotation with true value",
397+
annotations: map[string]string{PausedAnnotation: "true"},
398398
pausedReplicaCount: nil,
399-
expectResult: true,
399+
expectResult: true,
400400
},
401401
{
402-
name: "PausedAnnotation with false value",
403-
annotations: map[string]string{PausedAnnotation: "false"},
402+
name: "PausedAnnotation with false value",
403+
annotations: map[string]string{PausedAnnotation: "false"},
404404
pausedReplicaCount: nil,
405-
expectResult: false,
405+
expectResult: false,
406406
},
407407
{
408-
name: "PausedAnnotation with invalid value",
409-
annotations: map[string]string{PausedAnnotation: "invalid"},
408+
name: "PausedAnnotation with invalid value",
409+
annotations: map[string]string{PausedAnnotation: "invalid"},
410410
pausedReplicaCount: nil,
411-
expectResult: true, // Non-boolean values should default to true
411+
expectResult: true, // Non-boolean values should default to true
412412
},
413413
{
414-
name: "PausedReplicasAnnotation with value and status set",
415-
annotations: map[string]string{PausedReplicasAnnotation: "5"},
414+
name: "PausedReplicasAnnotation with value and status set",
415+
annotations: map[string]string{PausedReplicasAnnotation: "5"},
416416
pausedReplicaCount: &pausedReplicaCount,
417-
expectResult: true,
417+
expectResult: true,
418418
},
419419
{
420-
name: "PausedReplicasAnnotation with value but no status set",
421-
annotations: map[string]string{PausedReplicasAnnotation: "5"},
420+
name: "PausedReplicasAnnotation with value but no status set",
421+
annotations: map[string]string{PausedReplicasAnnotation: "5"},
422422
pausedReplicaCount: nil,
423-
expectResult: false,
423+
expectResult: false,
424424
},
425425
{
426-
name: "Both annotations set",
427-
annotations: map[string]string{PausedAnnotation: "true", PausedReplicasAnnotation: "5"},
426+
name: "Both annotations set",
427+
annotations: map[string]string{PausedAnnotation: "true", PausedReplicasAnnotation: "5"},
428428
pausedReplicaCount: &pausedReplicaCount,
429-
expectResult: true, // PausedReplicasAnnotation has precedence
429+
expectResult: true, // PausedReplicasAnnotation has precedence
430430
},
431431
}
432432

@@ -519,7 +519,7 @@ func TestCheckReplicaCountBoundsAreValid(t *testing.T) {
519519
idle0 := int32(0)
520520
idle1 := int32(1)
521521
idle2 := int32(2)
522-
522+
523523
tests := []struct {
524524
name string
525525
scaledObject *ScaledObject
@@ -530,8 +530,8 @@ func TestCheckReplicaCountBoundsAreValid(t *testing.T) {
530530
name: "Valid: min 1, max 5, no idle",
531531
scaledObject: &ScaledObject{
532532
Spec: ScaledObjectSpec{
533-
MinReplicaCount: &min1,
534-
MaxReplicaCount: &max5,
533+
MinReplicaCount: &min1,
534+
MaxReplicaCount: &max5,
535535
IdleReplicaCount: nil,
536536
},
537537
},
@@ -541,8 +541,8 @@ func TestCheckReplicaCountBoundsAreValid(t *testing.T) {
541541
name: "Valid: min 1, max 5, idle 0",
542542
scaledObject: &ScaledObject{
543543
Spec: ScaledObjectSpec{
544-
MinReplicaCount: &min1,
545-
MaxReplicaCount: &max5,
544+
MinReplicaCount: &min1,
545+
MaxReplicaCount: &max5,
546546
IdleReplicaCount: &idle0,
547547
},
548548
},
@@ -563,8 +563,8 @@ func TestCheckReplicaCountBoundsAreValid(t *testing.T) {
563563
name: "Invalid: idle 1 == min 1",
564564
scaledObject: &ScaledObject{
565565
Spec: ScaledObjectSpec{
566-
MinReplicaCount: &min1,
567-
MaxReplicaCount: &max5,
566+
MinReplicaCount: &min1,
567+
MaxReplicaCount: &max5,
568568
IdleReplicaCount: &idle1,
569569
},
570570
},
@@ -575,8 +575,8 @@ func TestCheckReplicaCountBoundsAreValid(t *testing.T) {
575575
name: "Invalid: idle 2 > min 1",
576576
scaledObject: &ScaledObject{
577577
Spec: ScaledObjectSpec{
578-
MinReplicaCount: &min1,
579-
MaxReplicaCount: &max5,
578+
MinReplicaCount: &min1,
579+
MaxReplicaCount: &max5,
580580
IdleReplicaCount: &idle2,
581581
},
582582
},
@@ -588,18 +588,18 @@ func TestCheckReplicaCountBoundsAreValid(t *testing.T) {
588588
for _, test := range tests {
589589
t.Run(test.name, func(t *testing.T) {
590590
err := CheckReplicaCountBoundsAreValid(test.scaledObject)
591-
591+
592592
if test.expectedError && err == nil {
593593
t.Error("Expected error but got nil")
594594
}
595-
595+
596596
if !test.expectedError && err != nil {
597597
t.Errorf("Expected no error but got: %v", err)
598598
}
599-
599+
600600
if test.expectedError && err != nil && test.errorContains != "" {
601601
if !strings.Contains(err.Error(), test.errorContains) {
602-
t.Errorf("Error message does not contain expected text.\nExpected to contain: %s\nActual: %s",
602+
t.Errorf("Error message does not contain expected text.\nExpected to contain: %s\nActual: %s",
603603
test.errorContains, err.Error())
604604
}
605605
}
@@ -608,8 +608,8 @@ func TestCheckReplicaCountBoundsAreValid(t *testing.T) {
608608
}
609609

610610
func TestGetHPAReplicas(t *testing.T) {
611-
min0 := int32(0)
612-
min5 := int32(5)
611+
min0 := int32(0)
612+
min5 := int32(5)
613613
max10 := int32(10)
614614

615615
tests := []struct {
@@ -623,8 +623,8 @@ func TestGetHPAReplicas(t *testing.T) {
623623
name: "Default min and max",
624624
minReplicaCount: nil,
625625
maxReplicaCount: nil,
626-
expectedMin: 1, // default minimum
627-
expectedMax: 100, // default maximum
626+
expectedMin: 1, // default minimum
627+
expectedMax: 100, // default maximum
628628
},
629629
{
630630
name: "Custom min, default max",
@@ -651,7 +651,7 @@ func TestGetHPAReplicas(t *testing.T) {
651651
name: "Zero min, default max",
652652
minReplicaCount: &min0,
653653
maxReplicaCount: nil,
654-
expectedMin: 1, // should use default for 0 value
654+
expectedMin: 1, // should use default for 0 value
655655
expectedMax: 100,
656656
},
657657
}

tests/internals/fallback/fallback_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ spec:
195195
authenticationRef:
196196
name: {{.TriggerAuthName}}
197197
`
198-
198+
199199
scaledObjectTemplateWithoutMetricType = `
200200
apiVersion: keda.sh/v1alpha1
201201
kind: ScaledObject

0 commit comments

Comments
 (0)