Unverified Commit 362e6293 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #56190 from edisonxiang/fixcontrolplaneunittests

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. fix controlplane unit tests What this PR does / why we need it: when the flexvolumeDirVolumePath is truely existent in the host, ```cmd/kubeadm/app/phases/controlplane``` unit tests will be failed. Fixes #56189 Release note: ```release-note NONE ```
parents 53776b5b 29d42afe
...@@ -513,6 +513,15 @@ func TestGetHostPathVolumesForTheControlPlane(t *testing.T) { ...@@ -513,6 +513,15 @@ func TestGetHostPathVolumesForTheControlPlane(t *testing.T) {
for _, rt := range tests { for _, rt := range tests {
mounts := getHostPathVolumesForTheControlPlane(rt.cfg) mounts := getHostPathVolumesForTheControlPlane(rt.cfg)
// Avoid unit test errors when the flexvolume is mounted
if _, ok := mounts.volumes[kubeadmconstants.KubeControllerManager][flexvolumeDirVolumeName]; ok {
delete(mounts.volumes[kubeadmconstants.KubeControllerManager], flexvolumeDirVolumeName)
}
if _, ok := mounts.volumeMounts[kubeadmconstants.KubeControllerManager][flexvolumeDirVolumeName]; ok {
delete(mounts.volumeMounts[kubeadmconstants.KubeControllerManager], flexvolumeDirVolumeName)
}
if !reflect.DeepEqual(mounts.volumes, rt.vol) { if !reflect.DeepEqual(mounts.volumes, rt.vol) {
t.Errorf( t.Errorf(
"failed getHostPathVolumesForTheControlPlane:\n\texpected: %v\n\t actual: %v", "failed getHostPathVolumesForTheControlPlane:\n\texpected: %v\n\t actual: %v",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment