@@ -583,7 +583,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
583
583
584
584
ginkgo .Context ("CSI NodeStage error cases [Slow]" , func () {
585
585
// Global variable in all scripts (called before each test)
586
- globalScript := `counter=0;`
586
+ globalScript := `counter=0; console.log("globals loaded", OK, INVALIDARGUMENT) `
587
587
trackedCalls := []string {
588
588
"NodeStageVolume" ,
589
589
"NodeUnstageVolume" ,
@@ -604,7 +604,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
604
604
{expectedMethod : "NodeStageVolume" , expectedError : codes .OK , deletePod : true },
605
605
{expectedMethod : "NodeUnstageVolume" , expectedError : codes .OK },
606
606
},
607
- nodeStageScript : `__grpcCode. OK;` ,
607
+ nodeStageScript : `OK;` ,
608
608
},
609
609
{
610
610
// Kubelet should repeat NodeStage as long as the pod exists
@@ -617,7 +617,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
617
617
{expectedMethod : "NodeUnstageVolume" , expectedError : codes .OK },
618
618
},
619
619
// Fail first 3 NodeStage requests, 4th succeeds
620
- nodeStageScript : `console.log("Counter:", ++counter); if (counter < 4) { __grpcCode. INVALIDARGUMENT; } else { __grpcCode. OK; }` ,
620
+ nodeStageScript : `console.log("Counter:", ++counter); if (counter < 4) { INVALIDARGUMENT; } else { OK; }` ,
621
621
},
622
622
{
623
623
// Kubelet should repeat NodeStage as long as the pod exists
@@ -630,7 +630,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
630
630
{expectedMethod : "NodeUnstageVolume" , expectedError : codes .OK },
631
631
},
632
632
// Fail first 3 NodeStage requests, 4th succeeds
633
- nodeStageScript : `console.log("Counter:", ++counter); if (counter < 4) { __grpcCode. DEADLINEEXCEEDED; } else { __grpcCode. OK; }` ,
633
+ nodeStageScript : `console.log("Counter:", ++counter); if (counter < 4) { DEADLINEEXCEEDED; } else { OK; }` ,
634
634
},
635
635
{
636
636
// After NodeUnstage with ephemeral error, the driver may continue staging the volume.
@@ -644,7 +644,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
644
644
{expectedMethod : "NodeStageVolume" , expectedError : codes .DeadlineExceeded , deletePod : true },
645
645
{expectedMethod : "NodeUnstageVolume" , expectedError : codes .OK },
646
646
},
647
- nodeStageScript : `__grpcCode. DEADLINEEXCEEDED;` ,
647
+ nodeStageScript : `DEADLINEEXCEEDED;` ,
648
648
},
649
649
{
650
650
// After NodeUnstage with final error, kubelet can be sure the volume is not staged.
@@ -656,16 +656,16 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
656
656
// This matches all repeated NodeStage calls with InvalidArgument error (due to exp. backoff).
657
657
{expectedMethod : "NodeStageVolume" , expectedError : codes .InvalidArgument , deletePod : true },
658
658
},
659
- nodeStageScript : `__grpcCode. INVALIDARGUMENT;` ,
659
+ nodeStageScript : `INVALIDARGUMENT;` ,
660
660
},
661
661
}
662
662
for _ , t := range tests {
663
663
test := t
664
664
ginkgo .It (test .name , func () {
665
665
scripts := map [string ]string {
666
- "Globals " : globalScript ,
667
- "NodeStageVolumeStart " : test .nodeStageScript ,
668
- "NodeUnstageVolumeStart " : test .nodeUnstageScript ,
666
+ "globals " : globalScript ,
667
+ "nodeStageVolumeStart " : test .nodeStageScript ,
668
+ "nodeUnstageVolumeStart " : test .nodeUnstageScript ,
669
669
}
670
670
init (testParameters {
671
671
disableAttach : true ,
@@ -706,7 +706,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
706
706
}
707
707
708
708
ginkgo .By ("Deleting the previously created pod" )
709
- err : = e2epod .DeletePodWithWait (m .cs , pod )
709
+ err = e2epod .DeletePodWithWait (m .cs , pod )
710
710
framework .ExpectNoError (err , "while deleting" )
711
711
712
712
ginkgo .By ("Waiting for all remaining expected CSI calls" )
@@ -865,7 +865,7 @@ type mockCSICall struct {
865
865
Request struct {
866
866
VolumeContext map [string ]string `json:"volume_context"`
867
867
}
868
- Error struct {
868
+ FullError struct {
869
869
Code codes.Code `json:"code"`
870
870
Message string `json:"message"`
871
871
}
@@ -988,7 +988,7 @@ func compareCSICalls(trackedCalls []string, expectedCallSequence []csiCall, cs c
988
988
if ! tracked .Has (c .Method ) {
989
989
continue
990
990
}
991
- if c .Method != last .Method || c .Error .Code != last .Error .Code {
991
+ if c .Method != last .Method || c .FullError .Code != last .FullError .Code {
992
992
last = c
993
993
calls = append (calls , c )
994
994
}
@@ -998,14 +998,14 @@ func compareCSICalls(trackedCalls []string, expectedCallSequence []csiCall, cs c
998
998
for i , c := range calls {
999
999
if i >= len (expectedCallSequence ) {
1000
1000
// Log all unexpected calls first, return error below outside the loop.
1001
- framework .Logf ("Unexpected CSI driver call: %s (%d)" , c .Method , c .Error )
1001
+ framework .Logf ("Unexpected CSI driver call: %s (%d)" , c .Method , c .FullError )
1002
1002
continue
1003
1003
}
1004
1004
1005
1005
// Compare current call with expected call
1006
1006
expectedCall := expectedCallSequence [i ]
1007
- if c .Method != expectedCall .expectedMethod || c .Error .Code != expectedCall .expectedError {
1008
- return i , fmt .Errorf ("Unexpected CSI call %d: expected %s (%d), got %s (%d)" , i , expectedCall .expectedMethod , expectedCall .expectedError , c .Method , c .Error .Code )
1007
+ if c .Method != expectedCall .expectedMethod || c .FullError .Code != expectedCall .expectedError {
1008
+ return i , fmt .Errorf ("Unexpected CSI call %d: expected %s (%d), got %s (%d)" , i , expectedCall .expectedMethod , expectedCall .expectedError , c .Method , c .FullError .Code )
1009
1009
}
1010
1010
}
1011
1011
if len (calls ) > len (expectedCallSequence ) {
0 commit comments