Improve configuration change detection (#2656)
* Use information about the configuration configmap to determine changes * Add hashstructure dependency * Rename queue functions * Add test for configmap checksum
This commit is contained in:
parent
a6978a873b
commit
aec40c171f
15 changed files with 564 additions and 42 deletions
|
|
@ -71,7 +71,7 @@ func TestEnqueueSuccess(t *testing.T) {
|
|||
k: "testKey",
|
||||
v: "testValue",
|
||||
}
|
||||
q.Enqueue(mo)
|
||||
q.EnqueueSkippableTask(mo)
|
||||
// wait for 'mockSynFn'
|
||||
time.Sleep(time.Millisecond * 10)
|
||||
if atomic.LoadUint32(&sr) != 1 {
|
||||
|
|
@ -99,7 +99,7 @@ func TestEnqueueFailed(t *testing.T) {
|
|||
q.Shutdown()
|
||||
// wait for shutdown
|
||||
time.Sleep(time.Millisecond * 10)
|
||||
q.Enqueue(mo)
|
||||
q.EnqueueSkippableTask(mo)
|
||||
// wait for 'mockSynFn'
|
||||
time.Sleep(time.Millisecond * 10)
|
||||
// queue is shutdown, so mockSynFn should not be executed, so the result should be 0
|
||||
|
|
@ -121,7 +121,7 @@ func TestEnqueueKeyError(t *testing.T) {
|
|||
v: "testValue",
|
||||
}
|
||||
|
||||
q.Enqueue(mo)
|
||||
q.EnqueueSkippableTask(mo)
|
||||
// wait for 'mockSynFn'
|
||||
time.Sleep(time.Millisecond * 10)
|
||||
// key error, so the result should be 0
|
||||
|
|
@ -142,16 +142,16 @@ func TestSkipEnqueue(t *testing.T) {
|
|||
k: "testKey",
|
||||
v: "testValue",
|
||||
}
|
||||
q.Enqueue(mo)
|
||||
q.Enqueue(mo)
|
||||
q.Enqueue(mo)
|
||||
q.Enqueue(mo)
|
||||
q.EnqueueSkippableTask(mo)
|
||||
q.EnqueueSkippableTask(mo)
|
||||
q.EnqueueTask(mo)
|
||||
q.EnqueueSkippableTask(mo)
|
||||
// run queue
|
||||
go q.Run(time.Second, stopCh)
|
||||
// wait for 'mockSynFn'
|
||||
time.Sleep(time.Millisecond * 10)
|
||||
if atomic.LoadUint32(&sr) != 1 {
|
||||
t.Errorf("sr should be 1, but is %d", sr)
|
||||
if atomic.LoadUint32(&sr) != 2 {
|
||||
t.Errorf("sr should be 2, but is %d", sr)
|
||||
}
|
||||
|
||||
// shutdown queue before exit
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue