MCPcopy
hub / github.com/kubernetes/client-go / TestReinsert

Function TestReinsert

util/workqueue/queue_test.go:133–161  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

131}
132
133func TestReinsert(t *testing.T) {
134 q := workqueue.New()
135 q.Add("foo")
136
137 // Start processing
138 i, _ := q.Get()
139 if i != "foo" {
140 t.Errorf("Expected %v, got %v", "foo", i)
141 }
142
143 // Add it back while processing
144 q.Add(i)
145
146 // Finish it up
147 q.Done(i)
148
149 // It should be back on the queue
150 i, _ = q.Get()
151 if i != "foo" {
152 t.Errorf("Expected %v, got %v", "foo", i)
153 }
154
155 // Finish that one up
156 q.Done(i)
157
158 if a := q.Len(); a != 0 {
159 t.Errorf("Expected queue to be empty. Has %v items", a)
160 }
161}

Callers

nothing calls this directly

Calls 6

NewFunction · 0.92
AddMethod · 0.65
GetMethod · 0.65
ErrorfMethod · 0.65
DoneMethod · 0.65
LenMethod · 0.65

Tested by

no test coverage detected