@@ -462,15 +462,15 @@ func TestWaitUntilFreshAndList(t *testing.T) {
462
462
}()
463
463
464
464
// list by empty MatchValues.
465
- list , resourceVersion , indexUsed , err := store .WaitUntilFreshAndList (ctx , 5 , "prefix/" , nil )
465
+ resp , indexUsed , err := store .WaitUntilFreshAndList (ctx , 5 , "prefix/" , nil )
466
466
if err != nil {
467
467
t .Fatalf ("unexpected error: %v" , err )
468
468
}
469
- if resourceVersion != 5 {
470
- t .Errorf ("unexpected resourceVersion: %v, expected: 5" , resourceVersion )
469
+ if resp . ResourceVersion != 5 {
470
+ t .Errorf ("unexpected resourceVersion: %v, expected: 5" , resp . ResourceVersion )
471
471
}
472
- if len (list ) != 3 {
473
- t .Errorf ("unexpected list returned: %#v" , list )
472
+ if len (resp . Items ) != 3 {
473
+ t .Errorf ("unexpected list returned: %#v" , resp )
474
474
}
475
475
if indexUsed != "" {
476
476
t .Errorf ("Used index %q but expected none to be used" , indexUsed )
@@ -481,15 +481,15 @@ func TestWaitUntilFreshAndList(t *testing.T) {
481
481
{IndexName : "l:label" , Value : "value1" },
482
482
{IndexName : "f:spec.nodeName" , Value : "node2" },
483
483
}
484
- list , resourceVersion , indexUsed , err = store .WaitUntilFreshAndList (ctx , 5 , "prefix/" , matchValues )
484
+ resp , indexUsed , err = store .WaitUntilFreshAndList (ctx , 5 , "prefix/" , matchValues )
485
485
if err != nil {
486
486
t .Fatalf ("unexpected error: %v" , err )
487
487
}
488
- if resourceVersion != 5 {
489
- t .Errorf ("unexpected resourceVersion: %v, expected: 5" , resourceVersion )
488
+ if resp . ResourceVersion != 5 {
489
+ t .Errorf ("unexpected resourceVersion: %v, expected: 5" , resp . ResourceVersion )
490
490
}
491
- if len (list ) != 2 {
492
- t .Errorf ("unexpected list returned: %#v" , list )
491
+ if len (resp . Items ) != 2 {
492
+ t .Errorf ("unexpected list returned: %#v" , resp )
493
493
}
494
494
if indexUsed != "l:label" {
495
495
t .Errorf ("Used index %q but expected %q" , indexUsed , "l:label" )
@@ -500,15 +500,15 @@ func TestWaitUntilFreshAndList(t *testing.T) {
500
500
{IndexName : "l:not-exist-label" , Value : "whatever" },
501
501
{IndexName : "f:spec.nodeName" , Value : "node2" },
502
502
}
503
- list , resourceVersion , indexUsed , err = store .WaitUntilFreshAndList (ctx , 5 , "prefix/" , matchValues )
503
+ resp , indexUsed , err = store .WaitUntilFreshAndList (ctx , 5 , "prefix/" , matchValues )
504
504
if err != nil {
505
505
t .Fatalf ("unexpected error: %v" , err )
506
506
}
507
- if resourceVersion != 5 {
508
- t .Errorf ("unexpected resourceVersion: %v, expected: 5" , resourceVersion )
507
+ if resp . ResourceVersion != 5 {
508
+ t .Errorf ("unexpected resourceVersion: %v, expected: 5" , resp . ResourceVersion )
509
509
}
510
- if len (list ) != 1 {
511
- t .Errorf ("unexpected list returned: %#v" , list )
510
+ if len (resp . Items ) != 1 {
511
+ t .Errorf ("unexpected list returned: %#v" , resp )
512
512
}
513
513
if indexUsed != "f:spec.nodeName" {
514
514
t .Errorf ("Used index %q but expected %q" , indexUsed , "f:spec.nodeName" )
@@ -518,15 +518,15 @@ func TestWaitUntilFreshAndList(t *testing.T) {
518
518
matchValues = []storage.MatchValue {
519
519
{IndexName : "l:not-exist-label" , Value : "whatever" },
520
520
}
521
- list , resourceVersion , indexUsed , err = store .WaitUntilFreshAndList (ctx , 5 , "prefix/" , matchValues )
521
+ resp , indexUsed , err = store .WaitUntilFreshAndList (ctx , 5 , "prefix/" , matchValues )
522
522
if err != nil {
523
523
t .Fatalf ("unexpected error: %v" , err )
524
524
}
525
- if resourceVersion != 5 {
526
- t .Errorf ("unexpected resourceVersion: %v, expected: 5" , resourceVersion )
525
+ if resp . ResourceVersion != 5 {
526
+ t .Errorf ("unexpected resourceVersion: %v, expected: 5" , resp . ResourceVersion )
527
527
}
528
- if len (list ) != 3 {
529
- t .Errorf ("unexpected list returned: %#v" , list )
528
+ if len (resp . Items ) != 3 {
529
+ t .Errorf ("unexpected list returned: %#v" , resp )
530
530
}
531
531
if indexUsed != "" {
532
532
t .Errorf ("Used index %q but expected none to be used" , indexUsed )
@@ -546,15 +546,15 @@ func TestWaitUntilFreshAndListFromCache(t *testing.T) {
546
546
}()
547
547
548
548
// list from future revision. Requires watch cache to request bookmark to get it.
549
- list , resourceVersion , indexUsed , err := store .WaitUntilFreshAndList (ctx , 3 , "prefix/" , nil )
549
+ resp , indexUsed , err := store .WaitUntilFreshAndList (ctx , 3 , "prefix/" , nil )
550
550
if err != nil {
551
551
t .Fatalf ("unexpected error: %v" , err )
552
552
}
553
- if resourceVersion != 3 {
554
- t .Errorf ("unexpected resourceVersion: %v, expected: 6" , resourceVersion )
553
+ if resp . ResourceVersion != 3 {
554
+ t .Errorf ("unexpected resourceVersion: %v, expected: 6" , resp . ResourceVersion )
555
555
}
556
- if len (list ) != 1 {
557
- t .Errorf ("unexpected list returned: %#v" , list )
556
+ if len (resp . Items ) != 1 {
557
+ t .Errorf ("unexpected list returned: %#v" , resp )
558
558
}
559
559
if indexUsed != "" {
560
560
t .Errorf ("Used index %q but expected none to be used" , indexUsed )
@@ -626,7 +626,7 @@ func TestWaitUntilFreshAndListTimeout(t *testing.T) {
626
626
store .Add (makeTestPod ("bar" , 4 ))
627
627
}()
628
628
629
- _ , _ , _ , err := store .WaitUntilFreshAndList (ctx , 4 , "" , nil )
629
+ _ , _ , err := store .WaitUntilFreshAndList (ctx , 4 , "" , nil )
630
630
if ! errors .IsTimeout (err ) {
631
631
t .Errorf ("expected timeout error but got: %v" , err )
632
632
}
@@ -655,12 +655,12 @@ func TestReflectorForWatchCache(t *testing.T) {
655
655
defer store .Stop ()
656
656
657
657
{
658
- _ , version , _ , err := store .WaitUntilFreshAndList (ctx , 0 , "" , nil )
658
+ resp , _ , err := store .WaitUntilFreshAndList (ctx , 0 , "" , nil )
659
659
if err != nil {
660
660
t .Fatalf ("unexpected error: %v" , err )
661
661
}
662
- if version != 0 {
663
- t .Errorf ("unexpected resource version: %d" , version )
662
+ if resp . ResourceVersion != 0 {
663
+ t .Errorf ("unexpected resource version: %d" , resp . ResourceVersion )
664
664
}
665
665
}
666
666
@@ -678,12 +678,12 @@ func TestReflectorForWatchCache(t *testing.T) {
678
678
r .ListAndWatch (wait .NeverStop )
679
679
680
680
{
681
- _ , version , _ , err := store .WaitUntilFreshAndList (ctx , 10 , "" , nil )
681
+ resp , _ , err := store .WaitUntilFreshAndList (ctx , 10 , "" , nil )
682
682
if err != nil {
683
683
t .Fatalf ("unexpected error: %v" , err )
684
684
}
685
- if version != 10 {
686
- t .Errorf ("unexpected resource version: %d" , version )
685
+ if resp . ResourceVersion != 10 {
686
+ t .Errorf ("unexpected resource version: %d" , resp . ResourceVersion )
687
687
}
688
688
}
689
689
}
0 commit comments