kubelet/userns: Use t.TempDir()

These tests will create the userns record mapping file, so let's use a
temporal directory for that.

Without specifying one, by mistake we were using the
"/tmp/non-existant-dir.This-is-not-used-in-tests/" directory.

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
This commit is contained in:
Rodrigo Campos 2024-01-19 16:29:05 +01:00
parent 0f7b9cc4f5
commit a56d483df0

View File

@ -297,6 +297,7 @@ func TestCleanupOrphanedPodUsernsAllocations(t *testing.T) {
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
testUserNsPodsManager := &testUserNsPodsManager{
podDir: t.TempDir(),
podList: tc.listPods,
}
m, err := MakeUserNsManager(testUserNsPodsManager)