unittests: Fixes unit tests for Windows

Currently, there are some unit tests that are failing on Windows due to
various reasons:

- config options not supported on Windows.
- files not closed, which means that they cannot be removed / renamed.
- paths not properly joined (filepath.Join should be used).
- time.Now() is not as precise on Windows, which means that 2
  consecutive calls may return the same timestamp.
- different error messages on Windows.
- files have \r\n line endings on Windows.
- /tmp directory being used, which might not exist on Windows. Instead,
  the OS-specific Temp directory should be used.
- the default value for Kubelet's EvictionHard field was containing
  OS-specific fields. This is now moved, the field is now set during
  Kubelet's initialization, after the config file is read.
This commit is contained in:
Claudiu Belu
2022-05-23 16:53:00 +03:00
parent 127f33f63d
commit 6f2eeed2e8
25 changed files with 175 additions and 46 deletions

View File

@@ -34,8 +34,8 @@ import (
var (
successConfig = kubeletconfig.KubeletConfiguration{
CgroupsPerQOS: true,
EnforceNodeAllocatable: []string{"pods", "system-reserved", "kube-reserved"},
CgroupsPerQOS: cgroupsPerQOS,
EnforceNodeAllocatable: enforceNodeAllocatable,
SystemReservedCgroup: "/system.slice",
KubeReservedCgroup: "/kubelet.service",
SystemCgroups: "",