mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 09:52:49 +00:00
Merge pull request #110741 from zhoumingcheng/master-unit-v1
add unit test coverage for pkg/kubelet/util/queue
This commit is contained in:
commit
54ec651ab5
@ -20,8 +20,10 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
|
"k8s.io/utils/clock"
|
||||||
testingclock "k8s.io/utils/clock/testing"
|
testingclock "k8s.io/utils/clock/testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -63,3 +65,19 @@ func TestGetWork(t *testing.T) {
|
|||||||
compareResults(t, expected, q.GetWork())
|
compareResults(t, expected, q.GetWork())
|
||||||
compareResults(t, []types.UID{}, q.GetWork())
|
compareResults(t, []types.UID{}, q.GetWork())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNewBasicWorkQueue(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
clock clock.Clock
|
||||||
|
expectedWorkQueue WorkQueue
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
clock: clock.RealClock{},
|
||||||
|
expectedWorkQueue: &basicWorkQueue{queue: make(map[types.UID]time.Time), clock: clock.RealClock{}},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
for _, test := range tests {
|
||||||
|
workQueue := NewBasicWorkQueue(test.clock)
|
||||||
|
assert.Equal(t, test.expectedWorkQueue, workQueue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user