kubernetes: [Failing test] UT TestWriteKubeletConfigFiles of cmd/kubeadm/app/phases/upgrade fails when run as root user
Which jobs are failing?
k8s UT TestWriteKubeletConfigFiles at https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/phases/upgrade/postupgrade_test.go#L116 fails when run as root user.
Which tests are failing?
TestWriteKubeletConfigFiles
[root@raji-x86-workspace1 kubernetes]# make test WHAT=./cmd/kubeadm/app/phases/upgrade
+++ [1112 04:14:13] Set GOMAXPROCS automatically to 16
+++ [1112 04:14:13] Normalizing Go targets
+++ [1112 04:14:13] Running tests without code coverage and with -race
FAIL
FAIL k8s.io/kubernetes/cmd/kubeadm/app/phases/upgrade 6.593s
=== Failed
=== FAIL: cmd/kubeadm/app/phases/upgrade TestWriteKubeletConfigFiles (0.00s)
W1112 04:14:21.309454 577063 postupgrade.go:112] Using temporary directory /etc/kubernetes/tmp/kubeadm-kubelet-config2862491829 for kubelet config. To override it set the environment variable KUBEADM_UPGRADE_DRYRUN_DIR
[dryrun] Would back up kubelet config file to /etc/kubernetes/tmp/kubeadm-kubelet-config2862491829/config.yaml
[kubelet-start] Writing kubelet configuration to file "/etc/kubernetes/tmp/kubeadm-upgrade-dryrun3857010355/config.yaml"
[dryrun] Would write file "/var/lib/kubelet/config.yaml" with content:
W1112 04:14:21.309747 577063 postupgrade.go:112] Using temporary directory /etc/kubernetes/tmp/kubeadm-kubelet-config278798797 for kubelet config. To override it set the environment variable KUBEADM_UPGRADE_DRYRUN_DIR
[dryrun] Would back up kubelet config file to /etc/kubernetes/tmp/kubeadm-kubelet-config278798797/config.yaml
postupgrade_test.go:169: Expected error contains "no kubelet component config found.*no such file or directory", got error writing kubelet configuration to file: no kubelet component config found
DONE 114 tests, 1 failure in 14.460s
make: *** [Makefile:192: test] Error 1
[root@raji-x86-workspace1 kubernetes]#
Since when has it been failing?
After the commit https://github.com/kubernetes/kubernetes/pull/128031/commits/c47eaa88b1d96ae8e7d0ed08cc7a3781bf883ffb#diff-7bb5f1d4cb628a78[…]ed12478eb74d356f8809bf
Relevant SIG(s)
/sig testing
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 17 (17 by maintainers)
There are still a couple other preexisting unit tests in kubeadm that check privileged and skips if not, that should be cleaned up in a follow up:
https://grep.app/search?q=isPrivileged.Check
Sure, I have assigned.
We don’t run unit tests as root by design because we had many tests depending on being root which doesn’t work for local development and highly suggests an os level integration test rather than a unit test.
We should be overriding the base path so we can test in a tempdir and not try to write to the actual global path.