File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -185,14 +185,18 @@ func TestFailsIfNotReadyToRequest_ContinueOnNotReadyDisabled(t *testing.T) {
185
185
t .Errorf ("Expected timeout to be returned from NodePublishVolume but got: %v" , err )
186
186
}
187
187
188
- files , err := store .ReadFiles ("test-vol" )
189
- if err != nil {
190
- t .Errorf ("failed to read files: %v" , err )
191
- }
192
- if len (files ["ca" ]) > 0 {
193
- t .Errorf ("unexpected CA data: %v" , files ["ca" ])
194
- }
195
- if len (files ["cert" ]) > 0 {
196
- t .Errorf ("unexpected certificate data: %v" , files ["cert" ])
188
+ // allow 1s for the cleanup functions in NodePublishVolume to be run
189
+ // without this pause, the test can flake due to the storage backend not
190
+ // being cleaned up of the persisted metadata file.
191
+ ctx , cancel2 := context .WithTimeout (context .Background (), time .Second )
192
+ defer cancel2 ()
193
+ if wait .PollUntil (time .Millisecond * 100 , func () (bool , error ) {
194
+ _ , err := store .ReadFiles ("test-vol" )
195
+ if err != storage .ErrNotFound {
196
+ return false , nil
197
+ }
198
+ return true , nil
199
+ }, ctx .Done ()); err != nil {
200
+ t .Errorf ("failed to wait for storage backend to return NotFound: %v" , err )
197
201
}
198
202
}
You can’t perform that action at this time.
0 commit comments