mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #108986 from gnufied/use-temp-dir-shutdown-tests
Use tempdir for shutdown tests
This commit is contained in:
commit
e7845861a5
@ -22,6 +22,7 @@ package nodeshutdown
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
@ -251,6 +252,7 @@ func TestManager(t *testing.T) {
|
|||||||
ShutdownGracePeriodRequested: tc.shutdownGracePeriodRequested,
|
ShutdownGracePeriodRequested: tc.shutdownGracePeriodRequested,
|
||||||
ShutdownGracePeriodCriticalPods: tc.shutdownGracePeriodCriticalPods,
|
ShutdownGracePeriodCriticalPods: tc.shutdownGracePeriodCriticalPods,
|
||||||
Clock: testingclock.NewFakeClock(time.Now()),
|
Clock: testingclock.NewFakeClock(time.Now()),
|
||||||
|
StateDirectory: os.TempDir(),
|
||||||
})
|
})
|
||||||
|
|
||||||
err := manager.Start()
|
err := manager.Start()
|
||||||
@ -345,8 +347,8 @@ func TestFeatureEnabled(t *testing.T) {
|
|||||||
SyncNodeStatusFunc: func() {},
|
SyncNodeStatusFunc: func() {},
|
||||||
ShutdownGracePeriodRequested: tc.shutdownGracePeriodRequested,
|
ShutdownGracePeriodRequested: tc.shutdownGracePeriodRequested,
|
||||||
ShutdownGracePeriodCriticalPods: 0,
|
ShutdownGracePeriodCriticalPods: 0,
|
||||||
|
StateDirectory: os.TempDir(),
|
||||||
})
|
})
|
||||||
|
|
||||||
assert.Equal(t, tc.expectEnabled, manager != managerStub{})
|
assert.Equal(t, tc.expectEnabled, manager != managerStub{})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -399,6 +401,7 @@ func TestRestart(t *testing.T) {
|
|||||||
SyncNodeStatusFunc: syncNodeStatus,
|
SyncNodeStatusFunc: syncNodeStatus,
|
||||||
ShutdownGracePeriodRequested: shutdownGracePeriodRequested,
|
ShutdownGracePeriodRequested: shutdownGracePeriodRequested,
|
||||||
ShutdownGracePeriodCriticalPods: shutdownGracePeriodCriticalPods,
|
ShutdownGracePeriodCriticalPods: shutdownGracePeriodCriticalPods,
|
||||||
|
StateDirectory: os.TempDir(),
|
||||||
})
|
})
|
||||||
|
|
||||||
err := manager.Start()
|
err := manager.Start()
|
||||||
|
Loading…
Reference in New Issue
Block a user