Merge pull request #108001 from denkensk/check-activeq-len

check activeQ.Len() before Pop()
This commit is contained in:
Kubernetes Prow Robot 2022-02-08 16:06:28 -08:00 committed by GitHub
commit 97e20b4ecb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1521,7 +1521,12 @@ func TestPodTimestamp(t *testing.T) {
op(queue, test.operands[i])
}
for i := 0; i < len(test.expected); i++ {
expectedLen := len(test.expected)
if queue.activeQ.Len() != expectedLen {
t.Fatalf("Expected %v items to be in activeQ, but got: %v", expectedLen, queue.activeQ.Len())
}
for i := 0; i < expectedLen; i++ {
if pInfo, err := queue.activeQ.Pop(); err != nil {
t.Errorf("Error while popping the head of the queue: %v", err)
} else {