mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #102477 from yuzhiquan/master
FIx failing tests: [sig-storage] Test_ADC_VolumeAttachmentRecovery/Deleted_Pod_with_migrated_PV
This commit is contained in:
commit
adf8df7b73
@ -173,29 +173,38 @@ func CreateTestClient() *fake.Clientset {
|
||||
obj.Items = append(obj.Items, nodes.Items...)
|
||||
return true, obj, nil
|
||||
})
|
||||
var mu sync.Mutex
|
||||
volumeAttachments = &storagev1.VolumeAttachmentList{}
|
||||
fakeClient.AddReactor("list", "volumeattachments", func(action core.Action) (handled bool, ret runtime.Object, err error) {
|
||||
obj := &storagev1.VolumeAttachmentList{}
|
||||
mu.Lock()
|
||||
obj.Items = append(obj.Items, volumeAttachments.Items...)
|
||||
mu.Unlock()
|
||||
return true, obj, nil
|
||||
})
|
||||
fakeClient.AddReactor("create", "volumeattachments", func(action core.Action) (handled bool, ret runtime.Object, err error) {
|
||||
createAction := action.(core.CreateAction)
|
||||
va := createAction.GetObject().(*storagev1.VolumeAttachment)
|
||||
mu.Lock()
|
||||
volumeAttachments.Items = append(volumeAttachments.Items, *va)
|
||||
mu.Unlock()
|
||||
return true, createAction.GetObject(), nil
|
||||
})
|
||||
|
||||
pvs = &v1.PersistentVolumeList{}
|
||||
fakeClient.AddReactor("list", "persistentvolumes", func(action core.Action) (handled bool, ret runtime.Object, err error) {
|
||||
obj := &v1.PersistentVolumeList{}
|
||||
mu.Lock()
|
||||
obj.Items = append(obj.Items, pvs.Items...)
|
||||
mu.Unlock()
|
||||
return true, obj, nil
|
||||
})
|
||||
fakeClient.AddReactor("create", "persistentvolumes", func(action core.Action) (handled bool, ret runtime.Object, err error) {
|
||||
createAction := action.(core.CreateAction)
|
||||
pv := createAction.GetObject().(*v1.PersistentVolume)
|
||||
mu.Lock()
|
||||
pvs.Items = append(pvs.Items, *pv)
|
||||
mu.Unlock()
|
||||
return true, createAction.GetObject(), nil
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user