mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-07 03:03:59 +00:00
in pkg/kubelet/config/commont_test.go, remove check for v1beta1, add test cases for all registered version
This commit is contained in:
parent
b61658d064
commit
97b29c7fe6
@ -21,6 +21,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/registered"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/testapi"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/securitycontext"
|
||||
|
||||
@ -56,11 +57,6 @@ func TestDecodeSinglePod(t *testing.T) {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
parsed, podOut, err := tryDecodeSinglePod(json, noDefault)
|
||||
if testapi.Version() == "v1beta1" {
|
||||
// v1beta1 conversion leaves empty lists that should be nil
|
||||
podOut.Spec.Containers[0].Resources.Limits = nil
|
||||
podOut.Spec.Containers[0].Resources.Requests = nil
|
||||
}
|
||||
if !parsed {
|
||||
t.Errorf("expected to have parsed file: (%s)", string(json))
|
||||
}
|
||||
@ -71,7 +67,8 @@ func TestDecodeSinglePod(t *testing.T) {
|
||||
t.Errorf("expected:\n%#v\ngot:\n%#v\n%s", pod, podOut, string(json))
|
||||
}
|
||||
|
||||
externalPod, err := testapi.Converter().ConvertToVersion(pod, "v1beta3")
|
||||
for _, version := range registered.RegisteredVersions {
|
||||
externalPod, err := testapi.Converter().ConvertToVersion(pod, version)
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
@ -91,6 +88,7 @@ func TestDecodeSinglePod(t *testing.T) {
|
||||
t.Errorf("expected:\n%#v\ngot:\n%#v\n%s", pod, podOut, string(yaml))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecodePodList(t *testing.T) {
|
||||
pod := &api.Pod{
|
||||
@ -137,7 +135,8 @@ func TestDecodePodList(t *testing.T) {
|
||||
t.Errorf("expected:\n%#v\ngot:\n%#v\n%s", podList, &podListOut, string(json))
|
||||
}
|
||||
|
||||
externalPodList, err := testapi.Converter().ConvertToVersion(podList, "v1beta3")
|
||||
for _, version := range registered.RegisteredVersions {
|
||||
externalPodList, err := testapi.Converter().ConvertToVersion(podList, version)
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
@ -157,3 +156,4 @@ func TestDecodePodList(t *testing.T) {
|
||||
t.Errorf("expected:\n%#v\ngot:\n%#v\n%s", pod, &podListOut, string(yaml))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user