mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +00:00
[kubeadm] Update test-case, fix nil-pointer bug, and improve error message
This commit is contained in:
parent
99a1143676
commit
4a37e05665
@ -313,7 +313,7 @@ func EtcdSupportedVersion(versionString string) (*version.Version, error) {
|
||||
}
|
||||
return etcdVersion, nil
|
||||
}
|
||||
return nil, fmt.Errorf("Unsupported or unknown kubernetes version")
|
||||
return nil, fmt.Errorf("Unsupported or unknown kubernetes version(%v)", kubernetesVersion)
|
||||
}
|
||||
|
||||
// GetStaticPodDirectory returns the location on the disk where the Static Pod should be present
|
||||
|
@ -124,7 +124,7 @@ func TestEtcdSupportedVersion(t *testing.T) {
|
||||
{
|
||||
kubernetesVersion: "1.99.0",
|
||||
expectedVersion: nil,
|
||||
expectedError: fmt.Errorf("Unsupported or unknown kubernetes version"),
|
||||
expectedError: fmt.Errorf("Unsupported or unknown kubernetes version(1.99.0)"),
|
||||
},
|
||||
{
|
||||
kubernetesVersion: "1.9.0",
|
||||
|
@ -222,11 +222,11 @@ func performEtcdStaticPodUpgrade(waiter apiclient.Waiter, pathMgr StaticPodPathM
|
||||
// Need to check currently used version and version from constants, if differs then upgrade
|
||||
desiredEtcdVersion, err := constants.EtcdSupportedVersion(cfg.KubernetesVersion)
|
||||
if err != nil {
|
||||
return true, fmt.Errorf("failed to parse the desired etcd version(%s): %v", desiredEtcdVersion.String(), err)
|
||||
return true, fmt.Errorf("failed to retrieve an etcd version for the target kubernetes version: %v", err)
|
||||
}
|
||||
currentEtcdVersion, err := version.ParseSemantic(etcdStatus.Version)
|
||||
if err != nil {
|
||||
return true, fmt.Errorf("failed to parse the current etcd version(%s): %v", currentEtcdVersion.String(), err)
|
||||
return true, fmt.Errorf("failed to parse the current etcd version(%s): %v", etcdStatus.Version, err)
|
||||
}
|
||||
|
||||
// Comparing current etcd version with desired to catch the same version or downgrade condition and fail on them.
|
||||
|
@ -368,7 +368,7 @@ func TestStaticPodControlPlane(t *testing.T) {
|
||||
}
|
||||
defer os.RemoveAll(tmpEtcdDataDir)
|
||||
|
||||
oldcfg, err := getConfig("v1.7.0", tempCertsDir)
|
||||
oldcfg, err := getConfig("v1.9.0", tempCertsDir, tmpEtcdDataDir)
|
||||
if err != nil {
|
||||
t.Fatalf("couldn't create config: %v", err)
|
||||
}
|
||||
@ -410,7 +410,7 @@ func TestStaticPodControlPlane(t *testing.T) {
|
||||
t.Fatalf("couldn't read temp file: %v", err)
|
||||
}
|
||||
|
||||
newcfg, err := getConfig("v1.8.0", tempCertsDir)
|
||||
newcfg, err := getConfig("v1.10.0", tempCertsDir, tmpEtcdDataDir)
|
||||
if err != nil {
|
||||
t.Fatalf("couldn't create config: %v", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user