mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 18:00:08 +00:00
Stop round trip testing in latest
This commit is contained in:
parent
3d52aac13c
commit
bf4ab78ce9
@ -18,57 +18,13 @@ package latest
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"math/rand"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
internal "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
internal "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||||
apitesting "github.com/GoogleCloudPlatform/kubernetes/pkg/api/testing"
|
|
||||||
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta1"
|
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta1"
|
||||||
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta2"
|
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta2"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestInternalRoundTrip(t *testing.T) {
|
|
||||||
latest := "v1beta2"
|
|
||||||
|
|
||||||
seed := rand.Int63()
|
|
||||||
apiObjectFuzzer := apitesting.FuzzerFor(t, "", rand.NewSource(seed))
|
|
||||||
for k := range internal.Scheme.KnownTypes("") {
|
|
||||||
obj, err := internal.Scheme.New("", k)
|
|
||||||
if err != nil {
|
|
||||||
t.Errorf("%s: unexpected error: %v", k, err)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
apiObjectFuzzer.Fuzz(obj)
|
|
||||||
|
|
||||||
newer, err := internal.Scheme.New(latest, k)
|
|
||||||
if err != nil {
|
|
||||||
t.Errorf("%s: unexpected error: %v", k, err)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := internal.Scheme.Convert(obj, newer); err != nil {
|
|
||||||
t.Errorf("unable to convert %#v to %#v: %v", obj, newer, err)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
actual, err := internal.Scheme.New("", k)
|
|
||||||
if err != nil {
|
|
||||||
t.Errorf("%s: unexpected error: %v", k, err)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := internal.Scheme.Convert(newer, actual); err != nil {
|
|
||||||
t.Errorf("unable to convert %#v to %#v: %v", newer, actual, err)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if !internal.Semantic.DeepEqual(obj, actual) {
|
|
||||||
t.Errorf("%s: diff %s", k, util.ObjectDiff(obj, actual))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestResourceVersioner(t *testing.T) {
|
func TestResourceVersioner(t *testing.T) {
|
||||||
pod := internal.Pod{ObjectMeta: internal.ObjectMeta{ResourceVersion: "10"}}
|
pod := internal.Pod{ObjectMeta: internal.ObjectMeta{ResourceVersion: "10"}}
|
||||||
version, err := ResourceVersioner.ResourceVersion(&pod)
|
version, err := ResourceVersioner.ResourceVersion(&pod)
|
||||||
|
Loading…
Reference in New Issue
Block a user