mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Merge pull request #116573 from claudiubelu/fix-kubeadm-unittests
unit tests: Fixes init and rejoin unit tests for Windows
This commit is contained in:
commit
fe9dc2ee11
@ -42,7 +42,7 @@ localAPIEndpoint:
|
|||||||
bootstrapTokens:
|
bootstrapTokens:
|
||||||
- token: "abcdef.0123456789abcdef"
|
- token: "abcdef.0123456789abcdef"
|
||||||
nodeRegistration:
|
nodeRegistration:
|
||||||
criSocket: unix:///var/run/containerd/containerd.sock
|
criSocket: %s
|
||||||
name: someName
|
name: someName
|
||||||
ignorePreflightErrors:
|
ignorePreflightErrors:
|
||||||
- c
|
- c
|
||||||
@ -51,7 +51,7 @@ nodeRegistration:
|
|||||||
apiVersion: %[1]s
|
apiVersion: %[1]s
|
||||||
kind: ClusterConfiguration
|
kind: ClusterConfiguration
|
||||||
controlPlaneEndpoint: "3.4.5.6"
|
controlPlaneEndpoint: "3.4.5.6"
|
||||||
`, kubeadmapiv1.SchemeGroupVersion.String())
|
`, kubeadmapiv1.SchemeGroupVersion.String(), expectedCRISocket)
|
||||||
|
|
||||||
func TestNewInitData(t *testing.T) {
|
func TestNewInitData(t *testing.T) {
|
||||||
// create temp directory
|
// create temp directory
|
||||||
@ -113,7 +113,7 @@ func TestNewInitData(t *testing.T) {
|
|||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
NodeRegistration: kubeadmapi.NodeRegistrationOptions{
|
NodeRegistration: kubeadmapi.NodeRegistrationOptions{
|
||||||
Name: "somename",
|
Name: "somename",
|
||||||
CRISocket: "unix:///var/run/containerd/containerd.sock",
|
CRISocket: expectedCRISocket,
|
||||||
IgnorePreflightErrors: []string{"c", "d"},
|
IgnorePreflightErrors: []string{"c", "d"},
|
||||||
ImagePullPolicy: "IfNotPresent",
|
ImagePullPolicy: "IfNotPresent",
|
||||||
},
|
},
|
||||||
|
@ -48,12 +48,12 @@ discovery:
|
|||||||
controlPlane:
|
controlPlane:
|
||||||
certificateKey: c39a18bae4a72e71b178661f437363da218a3efb83ddb03f1cd91d9ae1da41bd
|
certificateKey: c39a18bae4a72e71b178661f437363da218a3efb83ddb03f1cd91d9ae1da41bd
|
||||||
nodeRegistration:
|
nodeRegistration:
|
||||||
criSocket: unix:///var/run/containerd/containerd.sock
|
criSocket: %s
|
||||||
name: someName
|
name: someName
|
||||||
ignorePreflightErrors:
|
ignorePreflightErrors:
|
||||||
- c
|
- c
|
||||||
- d
|
- d
|
||||||
`, kubeadmapiv1.SchemeGroupVersion.String())
|
`, kubeadmapiv1.SchemeGroupVersion.String(), expectedCRISocket)
|
||||||
|
|
||||||
func TestNewJoinData(t *testing.T) {
|
func TestNewJoinData(t *testing.T) {
|
||||||
// create temp directory
|
// create temp directory
|
||||||
@ -218,7 +218,7 @@ func TestNewJoinData(t *testing.T) {
|
|||||||
TypeMeta: metav1.TypeMeta{Kind: "", APIVersion: ""},
|
TypeMeta: metav1.TypeMeta{Kind: "", APIVersion: ""},
|
||||||
NodeRegistration: kubeadmapi.NodeRegistrationOptions{
|
NodeRegistration: kubeadmapi.NodeRegistrationOptions{
|
||||||
Name: "somename",
|
Name: "somename",
|
||||||
CRISocket: "unix:///var/run/containerd/containerd.sock",
|
CRISocket: expectedCRISocket,
|
||||||
IgnorePreflightErrors: []string{"c", "d"},
|
IgnorePreflightErrors: []string{"c", "d"},
|
||||||
ImagePullPolicy: "IfNotPresent",
|
ImagePullPolicy: "IfNotPresent",
|
||||||
Taints: []v1.Taint{{Key: "node-role.kubernetes.io/control-plane", Effect: "NoSchedule"}},
|
Taints: []v1.Taint{{Key: "node-role.kubernetes.io/control-plane", Effect: "NoSchedule"}},
|
||||||
|
22
cmd/kubeadm/app/cmd/util_other_test.go
Normal file
22
cmd/kubeadm/app/cmd/util_other_test.go
Normal 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"
|
22
cmd/kubeadm/app/cmd/util_windows_test.go
Normal file
22
cmd/kubeadm/app/cmd/util_windows_test.go
Normal 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"
|
Loading…
Reference in New Issue
Block a user