Add integration tests for desire state of world populator

This adds tests for code introduced here :
https://github.com/kubernetes/kubernetes/issues/26994

Via integration test we can now verify that if pod delete
event is somehow missed by AttachDetach controller - it still
get cleaned up by Desired State of World populator.
This commit is contained in:
Hemant Kumar
2016-11-16 23:30:19 -05:00
parent cdb8c79415
commit fcf5d79be7
3 changed files with 210 additions and 2 deletions

View File

@@ -67,6 +67,7 @@ const (
// AttachDetachController defines the operations supported by this controller.
type AttachDetachController interface {
Run(stopCh <-chan struct{})
GetDesiredStateOfWorld() cache.DesiredStateOfWorld
}
// NewAttachDetachController returns a new instance of AttachDetachController.
@@ -220,7 +221,6 @@ func (adc *attachDetachController) podAdd(obj interface{}) {
if pod == nil || !ok {
return
}
if pod.Spec.NodeName == "" {
// Ignore pods without NodeName, indicating they are not scheduled.
return
@@ -229,6 +229,11 @@ func (adc *attachDetachController) podAdd(obj interface{}) {
adc.processPodVolumes(pod, true /* addVolumes */)
}
// GetDesiredStateOfWorld returns desired state of world associated with controller
func (adc *attachDetachController) GetDesiredStateOfWorld() cache.DesiredStateOfWorld {
return adc.desiredStateOfWorld
}
func (adc *attachDetachController) podUpdate(oldObj, newObj interface{}) {
// The flow for update is the same as add.
adc.podAdd(newObj)