Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unit tests: Fixes init and rejoin unit tests for Windows #116573

Merged
merged 1 commit into from Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmd/kubeadm/app/cmd/init_test.go
Expand Up @@ -42,7 +42,7 @@ localAPIEndpoint:
bootstrapTokens:
- token: "abcdef.0123456789abcdef"
nodeRegistration:
criSocket: unix:///var/run/containerd/containerd.sock
criSocket: %s
name: someName
ignorePreflightErrors:
- c
Expand All @@ -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
Expand Down Expand Up @@ -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",
},
Expand Down
6 changes: 3 additions & 3 deletions cmd/kubeadm/app/cmd/join_test.go
Expand Up @@ -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
Expand Down Expand Up @@ -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"}},
Expand Down
22 changes: 22 additions & 0 deletions cmd/kubeadm/app/cmd/util_other_test.go
@@ -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"
22 changes: 22 additions & 0 deletions cmd/kubeadm/app/cmd/util_windows_test.go
@@ -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"