Merge pull request #116573 from claudiubelu/fix-kubeadm-unittests

unit tests: Fixes init and rejoin unit tests for Windows
This commit is contained in:
Kubernetes Prow Robot 2023-03-14 08:36:52 -07:00 committed by GitHub
commit fe9dc2ee11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 50 additions and 6 deletions

View File

@ -42,7 +42,7 @@ localAPIEndpoint:
bootstrapTokens:
- token: "abcdef.0123456789abcdef"
nodeRegistration:
criSocket: unix:///var/run/containerd/containerd.sock
criSocket: %s
name: someName
ignorePreflightErrors:
- c
@ -51,7 +51,7 @@ nodeRegistration:
apiVersion: %[1]s
kind: ClusterConfiguration
controlPlaneEndpoint: "3.4.5.6"
`, kubeadmapiv1.SchemeGroupVersion.String())
`, kubeadmapiv1.SchemeGroupVersion.String(), expectedCRISocket)
func TestNewInitData(t *testing.T) {
// create temp directory
@ -113,7 +113,7 @@ func TestNewInitData(t *testing.T) {
cfg: &kubeadmapi.InitConfiguration{
NodeRegistration: kubeadmapi.NodeRegistrationOptions{
Name: "somename",
CRISocket: "unix:///var/run/containerd/containerd.sock",
CRISocket: expectedCRISocket,
IgnorePreflightErrors: []string{"c", "d"},
ImagePullPolicy: "IfNotPresent",
},

View File

@ -48,12 +48,12 @@ discovery:
controlPlane:
certificateKey: c39a18bae4a72e71b178661f437363da218a3efb83ddb03f1cd91d9ae1da41bd
nodeRegistration:
criSocket: unix:///var/run/containerd/containerd.sock
criSocket: %s
name: someName
ignorePreflightErrors:
- c
- d
`, kubeadmapiv1.SchemeGroupVersion.String())
`, kubeadmapiv1.SchemeGroupVersion.String(), expectedCRISocket)
func TestNewJoinData(t *testing.T) {
// create temp directory
@ -218,7 +218,7 @@ func TestNewJoinData(t *testing.T) {
TypeMeta: metav1.TypeMeta{Kind: "", APIVersion: ""},
NodeRegistration: kubeadmapi.NodeRegistrationOptions{
Name: "somename",
CRISocket: "unix:///var/run/containerd/containerd.sock",
CRISocket: expectedCRISocket,
IgnorePreflightErrors: []string{"c", "d"},
ImagePullPolicy: "IfNotPresent",
Taints: []v1.Taint{{Key: "node-role.kubernetes.io/control-plane", Effect: "NoSchedule"}},

View File

@ -0,0 +1,22 @@
//go:build !windows
// +build !windows
/*
Copyright 2023 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd
const expectedCRISocket = "unix://var/run/containerd/containerd.sock"

View File

@ -0,0 +1,22 @@
//go:build windows
// +build windows
/*
Copyright 2023 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd
const expectedCRISocket = "npipe://./pipe/containerd-containerd"