mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
TestSchedulingQueue_Close: Remove struct tests and the corresponding for loop
Signed-off-by: Gaurav Singh <gaurav1086@gmail.com> TestSchedulingQueue_Close: Remove for loop Signed-off-by: Gaurav Singh <gaurav1086@gmail.com> remove the tests slice Signed-off-by: Gaurav Singh <gaurav1086@gmail.com> Remove struct Signed-off-by: Gaurav Singh <gaurav1086@gmail.com> Remove t.Run() Signed-off-by: Gaurav Singh <gaurav1086@gmail.com> Add function name Signed-off-by: Gaurav Singh <gaurav1086@gmail.com> Remove nested function Signed-off-by: Gaurav Singh <gaurav1086@gmail.com> Replace expectedErr with wantErr Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
This commit is contained in:
parent
22de8fc321
commit
00f28747b3
@ -710,35 +710,22 @@ func TestUnschedulablePodsMap(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSchedulingQueue_Close(t *testing.T) {
|
func TestSchedulingQueue_Close(t *testing.T) {
|
||||||
tests := []struct {
|
q := NewPriorityQueue(newDefaultQueueSort())
|
||||||
name string
|
wantErr := fmt.Errorf(queueClosed)
|
||||||
q SchedulingQueue
|
wg := sync.WaitGroup{}
|
||||||
expectedErr error
|
wg.Add(1)
|
||||||
}{
|
go func() {
|
||||||
{
|
defer wg.Done()
|
||||||
name: "PriorityQueue close",
|
pod, err := q.Pop()
|
||||||
q: NewPriorityQueue(newDefaultQueueSort()),
|
if err.Error() != wantErr.Error() {
|
||||||
expectedErr: fmt.Errorf(queueClosed),
|
t.Errorf("Expected err %q from Pop() if queue is closed, but got %q", wantErr.Error(), err.Error())
|
||||||
},
|
}
|
||||||
}
|
if pod != nil {
|
||||||
for _, test := range tests {
|
t.Errorf("Expected pod nil from Pop() if queue is closed, but got: %v", pod)
|
||||||
t.Run(test.name, func(t *testing.T) {
|
}
|
||||||
wg := sync.WaitGroup{}
|
}()
|
||||||
wg.Add(1)
|
q.Close()
|
||||||
go func() {
|
wg.Wait()
|
||||||
defer wg.Done()
|
|
||||||
pod, err := test.q.Pop()
|
|
||||||
if err.Error() != test.expectedErr.Error() {
|
|
||||||
t.Errorf("Expected err %q from Pop() if queue is closed, but got %q", test.expectedErr.Error(), err.Error())
|
|
||||||
}
|
|
||||||
if pod != nil {
|
|
||||||
t.Errorf("Expected pod nil from Pop() if queue is closed, but got: %v", pod)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
test.q.Close()
|
|
||||||
wg.Wait()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestRecentlyTriedPodsGoBack tests that pods which are recently tried and are
|
// TestRecentlyTriedPodsGoBack tests that pods which are recently tried and are
|
||||||
|
Loading…
Reference in New Issue
Block a user