cleanup podkiller close
This commit is contained in:
parent
1f81b44cc7
commit
224a4db269
@ -119,7 +119,9 @@ type TestKubelet struct {
|
|||||||
|
|
||||||
func (tk *TestKubelet) Cleanup() {
|
func (tk *TestKubelet) Cleanup() {
|
||||||
if tk.kubelet != nil {
|
if tk.kubelet != nil {
|
||||||
|
tk.kubelet.podKiller.Close()
|
||||||
os.RemoveAll(tk.kubelet.rootDirectory)
|
os.RemoveAll(tk.kubelet.rootDirectory)
|
||||||
|
tk.kubelet = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,6 +294,7 @@ func newTestKubeletWithImageList(
|
|||||||
kubelet.backOff = flowcontrol.NewBackOff(time.Second, time.Minute)
|
kubelet.backOff = flowcontrol.NewBackOff(time.Second, time.Minute)
|
||||||
kubelet.backOff.Clock = fakeClock
|
kubelet.backOff.Clock = fakeClock
|
||||||
kubelet.podKiller = NewPodKiller(kubelet)
|
kubelet.podKiller = NewPodKiller(kubelet)
|
||||||
|
go kubelet.podKiller.PerformPodKillingWork()
|
||||||
kubelet.resyncInterval = 10 * time.Second
|
kubelet.resyncInterval = 10 * time.Second
|
||||||
kubelet.workQueue = queue.NewBasicWorkQueue(fakeClock)
|
kubelet.workQueue = queue.NewBasicWorkQueue(fakeClock)
|
||||||
// Relist period does not affect the tests.
|
// Relist period does not affect the tests.
|
||||||
@ -420,9 +423,7 @@ func TestSyncPodsStartPod(t *testing.T) {
|
|||||||
|
|
||||||
func TestHandlePodCleanupsPerQOS(t *testing.T) {
|
func TestHandlePodCleanupsPerQOS(t *testing.T) {
|
||||||
testKubelet := newTestKubelet(t, false /* controllerAttachDetachEnabled */)
|
testKubelet := newTestKubelet(t, false /* controllerAttachDetachEnabled */)
|
||||||
go testKubelet.kubelet.podKiller.PerformPodKillingWork()
|
|
||||||
defer testKubelet.Cleanup()
|
defer testKubelet.Cleanup()
|
||||||
defer testKubelet.kubelet.podKiller.Close()
|
|
||||||
|
|
||||||
pod := &kubecontainer.Pod{
|
pod := &kubecontainer.Pod{
|
||||||
ID: "12345678",
|
ID: "12345678",
|
||||||
@ -612,9 +613,7 @@ func TestDispatchWorkOfActivePod(t *testing.T) {
|
|||||||
|
|
||||||
func TestHandlePodCleanups(t *testing.T) {
|
func TestHandlePodCleanups(t *testing.T) {
|
||||||
testKubelet := newTestKubelet(t, false /* controllerAttachDetachEnabled */)
|
testKubelet := newTestKubelet(t, false /* controllerAttachDetachEnabled */)
|
||||||
go testKubelet.kubelet.podKiller.PerformPodKillingWork()
|
|
||||||
defer testKubelet.Cleanup()
|
defer testKubelet.Cleanup()
|
||||||
defer testKubelet.kubelet.podKiller.Close()
|
|
||||||
|
|
||||||
pod := &kubecontainer.Pod{
|
pod := &kubecontainer.Pod{
|
||||||
ID: "12345678",
|
ID: "12345678",
|
||||||
@ -643,8 +642,6 @@ func TestHandlePodRemovesWhenSourcesAreReady(t *testing.T) {
|
|||||||
|
|
||||||
testKubelet := newTestKubelet(t, false /* controllerAttachDetachEnabled */)
|
testKubelet := newTestKubelet(t, false /* controllerAttachDetachEnabled */)
|
||||||
defer testKubelet.Cleanup()
|
defer testKubelet.Cleanup()
|
||||||
go testKubelet.kubelet.podKiller.PerformPodKillingWork()
|
|
||||||
defer testKubelet.kubelet.podKiller.Close()
|
|
||||||
|
|
||||||
fakePod := &kubecontainer.Pod{
|
fakePod := &kubecontainer.Pod{
|
||||||
ID: "1",
|
ID: "1",
|
||||||
@ -683,8 +680,6 @@ func TestHandlePodRemovesWhenSourcesAreReady(t *testing.T) {
|
|||||||
func TestKillPodFollwedByIsPodPendingTermination(t *testing.T) {
|
func TestKillPodFollwedByIsPodPendingTermination(t *testing.T) {
|
||||||
testKubelet := newTestKubelet(t, false /* controllerAttachDetachEnabled */)
|
testKubelet := newTestKubelet(t, false /* controllerAttachDetachEnabled */)
|
||||||
defer testKubelet.Cleanup()
|
defer testKubelet.Cleanup()
|
||||||
defer testKubelet.kubelet.podKiller.Close()
|
|
||||||
go testKubelet.kubelet.podKiller.PerformPodKillingWork()
|
|
||||||
|
|
||||||
pod := &kubecontainer.Pod{
|
pod := &kubecontainer.Pod{
|
||||||
ID: "12345678",
|
ID: "12345678",
|
||||||
|
Loading…
Reference in New Issue
Block a user