mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 18:24:07 +00:00
Remove k8s.io/apimachinery/pkg/runtime/serializer/testing directory
This commit is contained in:
parent
aff467bbb4
commit
8eb60c2474
@ -290,7 +290,6 @@ staging/src/k8s.io/apimachinery/pkg/runtime/serializer/json
|
|||||||
staging/src/k8s.io/apimachinery/pkg/runtime/serializer/protobuf
|
staging/src/k8s.io/apimachinery/pkg/runtime/serializer/protobuf
|
||||||
staging/src/k8s.io/apimachinery/pkg/runtime/serializer/recognizer
|
staging/src/k8s.io/apimachinery/pkg/runtime/serializer/recognizer
|
||||||
staging/src/k8s.io/apimachinery/pkg/runtime/serializer/streaming
|
staging/src/k8s.io/apimachinery/pkg/runtime/serializer/streaming
|
||||||
staging/src/k8s.io/apimachinery/pkg/runtime/serializer/testing
|
|
||||||
staging/src/k8s.io/apimachinery/pkg/runtime/testing
|
staging/src/k8s.io/apimachinery/pkg/runtime/testing
|
||||||
staging/src/k8s.io/apimachinery/pkg/selection
|
staging/src/k8s.io/apimachinery/pkg/selection
|
||||||
staging/src/k8s.io/apimachinery/pkg/test
|
staging/src/k8s.io/apimachinery/pkg/test
|
||||||
|
@ -19,7 +19,7 @@ go_test(
|
|||||||
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/serializer/testing:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime/testing:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/diff:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/diff:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
|
||||||
"//vendor/github.com/google/gofuzz:go_default_library",
|
"//vendor/github.com/google/gofuzz:go_default_library",
|
||||||
@ -61,7 +61,6 @@ filegroup(
|
|||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/serializer/protobuf:all-srcs",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime/serializer/protobuf:all-srcs",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/serializer/recognizer:all-srcs",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime/serializer/recognizer:all-srcs",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/serializer/streaming:all-srcs",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime/serializer/streaming:all-srcs",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/serializer/testing:all-srcs",
|
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/serializer/versioning:all-srcs",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime/serializer/versioning:all-srcs",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/serializer/yaml:all-srcs",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime/serializer/yaml:all-srcs",
|
||||||
],
|
],
|
||||||
|
@ -29,7 +29,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/conversion"
|
"k8s.io/apimachinery/pkg/conversion"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
serializertesting "k8s.io/apimachinery/pkg/runtime/serializer/testing"
|
runtimetesting "k8s.io/apimachinery/pkg/runtime/testing"
|
||||||
"k8s.io/apimachinery/pkg/util/diff"
|
"k8s.io/apimachinery/pkg/util/diff"
|
||||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ func (testMetaFactory) Interpret(data []byte) (*schema.GroupVersionKind, error)
|
|||||||
|
|
||||||
// TestObjectFuzzer can randomly populate all the above objects.
|
// TestObjectFuzzer can randomly populate all the above objects.
|
||||||
var TestObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 100).Funcs(
|
var TestObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 100).Funcs(
|
||||||
func(j *serializertesting.MyWeirdCustomEmbeddedVersionKindField, c fuzz.Continue) {
|
func(j *runtimetesting.MyWeirdCustomEmbeddedVersionKindField, c fuzz.Continue) {
|
||||||
c.FuzzNoCustom(j)
|
c.FuzzNoCustom(j)
|
||||||
j.APIVersion = ""
|
j.APIVersion = ""
|
||||||
j.ObjectKind = ""
|
j.ObjectKind = ""
|
||||||
@ -78,17 +78,17 @@ func GetTestScheme() (*runtime.Scheme, runtime.Codec) {
|
|||||||
// Ordinarily, we wouldn't add TestType2, but because this is a test and
|
// Ordinarily, we wouldn't add TestType2, but because this is a test and
|
||||||
// both types are from the same package, we need to get it into the system
|
// both types are from the same package, we need to get it into the system
|
||||||
// so that converter will match it with ExternalType2.
|
// so that converter will match it with ExternalType2.
|
||||||
s.AddKnownTypes(internalGV, &serializertesting.TestType1{}, &serializertesting.TestType2{}, &serializertesting.ExternalInternalSame{})
|
s.AddKnownTypes(internalGV, &runtimetesting.TestType1{}, &runtimetesting.TestType2{}, &runtimetesting.ExternalInternalSame{})
|
||||||
s.AddKnownTypes(externalGV, &serializertesting.ExternalInternalSame{})
|
s.AddKnownTypes(externalGV, &runtimetesting.ExternalInternalSame{})
|
||||||
s.AddKnownTypeWithName(externalGV.WithKind("TestType1"), &serializertesting.ExternalTestType1{})
|
s.AddKnownTypeWithName(externalGV.WithKind("TestType1"), &runtimetesting.ExternalTestType1{})
|
||||||
s.AddKnownTypeWithName(externalGV.WithKind("TestType2"), &serializertesting.ExternalTestType2{})
|
s.AddKnownTypeWithName(externalGV.WithKind("TestType2"), &runtimetesting.ExternalTestType2{})
|
||||||
s.AddKnownTypeWithName(internalGV.WithKind("TestType3"), &serializertesting.TestType1{})
|
s.AddKnownTypeWithName(internalGV.WithKind("TestType3"), &runtimetesting.TestType1{})
|
||||||
s.AddKnownTypeWithName(externalGV.WithKind("TestType3"), &serializertesting.ExternalTestType1{})
|
s.AddKnownTypeWithName(externalGV.WithKind("TestType3"), &runtimetesting.ExternalTestType1{})
|
||||||
s.AddKnownTypeWithName(externalGV2.WithKind("TestType1"), &serializertesting.ExternalTestType1{})
|
s.AddKnownTypeWithName(externalGV2.WithKind("TestType1"), &runtimetesting.ExternalTestType1{})
|
||||||
|
|
||||||
s.AddUnversionedTypes(externalGV, &metav1.Status{})
|
s.AddUnversionedTypes(externalGV, &metav1.Status{})
|
||||||
|
|
||||||
utilruntime.Must(serializertesting.RegisterConversions(s))
|
utilruntime.Must(runtimetesting.RegisterConversions(s))
|
||||||
|
|
||||||
cf := newCodecFactory(s, newSerializersForScheme(s, testMetaFactory{}, CodecFactoryOptions{Pretty: true, Strict: true}))
|
cf := newCodecFactory(s, newSerializersForScheme(s, testMetaFactory{}, CodecFactoryOptions{Pretty: true, Strict: true}))
|
||||||
codec := cf.LegacyCodec(schema.GroupVersion{Version: "v1"})
|
codec := cf.LegacyCodec(schema.GroupVersion{Version: "v1"})
|
||||||
@ -96,7 +96,7 @@ func GetTestScheme() (*runtime.Scheme, runtime.Codec) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var semantic = conversion.EqualitiesOrDie(
|
var semantic = conversion.EqualitiesOrDie(
|
||||||
func(a, b serializertesting.MyWeirdCustomEmbeddedVersionKindField) bool {
|
func(a, b runtimetesting.MyWeirdCustomEmbeddedVersionKindField) bool {
|
||||||
a.APIVersion, a.ObjectKind = "", ""
|
a.APIVersion, a.ObjectKind = "", ""
|
||||||
b.APIVersion, b.ObjectKind = "", ""
|
b.APIVersion, b.ObjectKind = "", ""
|
||||||
return a == b
|
return a == b
|
||||||
@ -135,8 +135,8 @@ func runTest(t *testing.T, source interface{}) {
|
|||||||
|
|
||||||
func TestTypes(t *testing.T) {
|
func TestTypes(t *testing.T) {
|
||||||
table := []interface{}{
|
table := []interface{}{
|
||||||
&serializertesting.TestType1{},
|
&runtimetesting.TestType1{},
|
||||||
&serializertesting.ExternalInternalSame{},
|
&runtimetesting.ExternalInternalSame{},
|
||||||
}
|
}
|
||||||
for _, item := range table {
|
for _, item := range table {
|
||||||
// Try a few times, since runTest uses random values.
|
// Try a few times, since runTest uses random values.
|
||||||
@ -153,7 +153,7 @@ func TestVersionedEncoding(t *testing.T) {
|
|||||||
encoder := info.Serializer
|
encoder := info.Serializer
|
||||||
|
|
||||||
codec := cf.EncoderForVersion(encoder, schema.GroupVersion{Version: "v2"})
|
codec := cf.EncoderForVersion(encoder, schema.GroupVersion{Version: "v2"})
|
||||||
out, err := runtime.Encode(codec, &serializertesting.TestType1{})
|
out, err := runtime.Encode(codec, &runtimetesting.TestType1{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -162,14 +162,14 @@ func TestVersionedEncoding(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
codec = cf.EncoderForVersion(encoder, schema.GroupVersion{Version: "v3"})
|
codec = cf.EncoderForVersion(encoder, schema.GroupVersion{Version: "v3"})
|
||||||
_, err = runtime.Encode(codec, &serializertesting.TestType1{})
|
_, err = runtime.Encode(codec, &runtimetesting.TestType1{})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// unversioned encode with no versions is written directly to wire
|
// unversioned encode with no versions is written directly to wire
|
||||||
codec = cf.EncoderForVersion(encoder, runtime.InternalGroupVersioner)
|
codec = cf.EncoderForVersion(encoder, runtime.InternalGroupVersioner)
|
||||||
out, err = runtime.Encode(codec, &serializertesting.TestType1{})
|
out, err = runtime.Encode(codec, &runtimetesting.TestType1{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -185,7 +185,7 @@ func TestMultipleNames(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
internal := obj.(*serializertesting.TestType1)
|
internal := obj.(*runtimetesting.TestType1)
|
||||||
if internal.A != "value" {
|
if internal.A != "value" {
|
||||||
t.Fatalf("unexpected decoded object: %#v", internal)
|
t.Fatalf("unexpected decoded object: %#v", internal)
|
||||||
}
|
}
|
||||||
@ -222,16 +222,16 @@ func TestConvertTypesWhenDefaultNamesMatch(t *testing.T) {
|
|||||||
|
|
||||||
s := runtime.NewScheme()
|
s := runtime.NewScheme()
|
||||||
// create two names internally, with TestType1 being preferred
|
// create two names internally, with TestType1 being preferred
|
||||||
s.AddKnownTypeWithName(internalGV.WithKind("TestType1"), &serializertesting.TestType1{})
|
s.AddKnownTypeWithName(internalGV.WithKind("TestType1"), &runtimetesting.TestType1{})
|
||||||
s.AddKnownTypeWithName(internalGV.WithKind("OtherType1"), &serializertesting.TestType1{})
|
s.AddKnownTypeWithName(internalGV.WithKind("OtherType1"), &runtimetesting.TestType1{})
|
||||||
// create two names externally, with TestType1 being preferred
|
// create two names externally, with TestType1 being preferred
|
||||||
s.AddKnownTypeWithName(externalGV.WithKind("TestType1"), &serializertesting.ExternalTestType1{})
|
s.AddKnownTypeWithName(externalGV.WithKind("TestType1"), &runtimetesting.ExternalTestType1{})
|
||||||
s.AddKnownTypeWithName(externalGV.WithKind("OtherType1"), &serializertesting.ExternalTestType1{})
|
s.AddKnownTypeWithName(externalGV.WithKind("OtherType1"), &runtimetesting.ExternalTestType1{})
|
||||||
if err := serializertesting.RegisterConversions(s); err != nil {
|
if err := runtimetesting.RegisterConversions(s); err != nil {
|
||||||
t.Fatalf("unexpected error; %v", err)
|
t.Fatalf("unexpected error; %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ext := &serializertesting.ExternalTestType1{}
|
ext := &runtimetesting.ExternalTestType1{}
|
||||||
ext.APIVersion = "v1"
|
ext.APIVersion = "v1"
|
||||||
ext.ObjectKind = "OtherType1"
|
ext.ObjectKind = "OtherType1"
|
||||||
ext.A = "test"
|
ext.A = "test"
|
||||||
@ -239,7 +239,7 @@ func TestConvertTypesWhenDefaultNamesMatch(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
expect := &serializertesting.TestType1{A: "test"}
|
expect := &runtimetesting.TestType1{A: "test"}
|
||||||
|
|
||||||
codec := newCodecFactory(
|
codec := newCodecFactory(
|
||||||
s, newSerializersForScheme(s, testMetaFactory{}, CodecFactoryOptions{Pretty: true, Strict: true}),
|
s, newSerializersForScheme(s, testMetaFactory{}, CodecFactoryOptions{Pretty: true, Strict: true}),
|
||||||
@ -253,7 +253,7 @@ func TestConvertTypesWhenDefaultNamesMatch(t *testing.T) {
|
|||||||
t.Errorf("unexpected object: %#v", obj)
|
t.Errorf("unexpected object: %#v", obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
into := &serializertesting.TestType1{}
|
into := &runtimetesting.TestType1{}
|
||||||
if err := runtime.DecodeInto(codec, data, into); err != nil {
|
if err := runtime.DecodeInto(codec, data, into); err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
@ -264,13 +264,13 @@ func TestConvertTypesWhenDefaultNamesMatch(t *testing.T) {
|
|||||||
|
|
||||||
func TestEncode_Ptr(t *testing.T) {
|
func TestEncode_Ptr(t *testing.T) {
|
||||||
_, codec := GetTestScheme()
|
_, codec := GetTestScheme()
|
||||||
tt := &serializertesting.TestType1{A: "I am a pointer object"}
|
tt := &runtimetesting.TestType1{A: "I am a pointer object"}
|
||||||
data, err := runtime.Encode(codec, tt)
|
data, err := runtime.Encode(codec, tt)
|
||||||
obj2, err2 := runtime.Decode(codec, data)
|
obj2, err2 := runtime.Decode(codec, data)
|
||||||
if err != nil || err2 != nil {
|
if err != nil || err2 != nil {
|
||||||
t.Fatalf("Failure: '%v' '%v'\n%s", err, err2, data)
|
t.Fatalf("Failure: '%v' '%v'\n%s", err, err2, data)
|
||||||
}
|
}
|
||||||
if _, ok := obj2.(*serializertesting.TestType1); !ok {
|
if _, ok := obj2.(*runtimetesting.TestType1); !ok {
|
||||||
t.Fatalf("Got wrong type")
|
t.Fatalf("Got wrong type")
|
||||||
}
|
}
|
||||||
if !semantic.DeepEqual(obj2, tt) {
|
if !semantic.DeepEqual(obj2, tt) {
|
||||||
@ -293,10 +293,10 @@ func TestBadJSONRejection(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
badJSONKindMismatch := []byte(`{"myVersionKey":"v1","myKindKey":"ExternalInternalSame"}`)
|
badJSONKindMismatch := []byte(`{"myVersionKey":"v1","myKindKey":"ExternalInternalSame"}`)
|
||||||
if err := runtime.DecodeInto(codec, badJSONKindMismatch, &serializertesting.TestType1{}); err == nil {
|
if err := runtime.DecodeInto(codec, badJSONKindMismatch, &runtimetesting.TestType1{}); err == nil {
|
||||||
t.Errorf("Kind is set but doesn't match the object type: %s", badJSONKindMismatch)
|
t.Errorf("Kind is set but doesn't match the object type: %s", badJSONKindMismatch)
|
||||||
}
|
}
|
||||||
if err := runtime.DecodeInto(codec, []byte(``), &serializertesting.TestType1{}); err != nil {
|
if err := runtime.DecodeInto(codec, []byte(``), &runtimetesting.TestType1{}); err != nil {
|
||||||
t.Errorf("Should allow empty decode: %v", err)
|
t.Errorf("Should allow empty decode: %v", err)
|
||||||
}
|
}
|
||||||
if _, _, err := codec.Decode([]byte(``), &schema.GroupVersionKind{Kind: "ExternalInternalSame"}, nil); err == nil {
|
if _, _, err := codec.Decode([]byte(``), &schema.GroupVersionKind{Kind: "ExternalInternalSame"}, nil); err == nil {
|
||||||
@ -325,12 +325,12 @@ func GetDirectCodecTestScheme() *runtime.Scheme {
|
|||||||
// Ordinarily, we wouldn't add TestType2, but because this is a test and
|
// Ordinarily, we wouldn't add TestType2, but because this is a test and
|
||||||
// both types are from the same package, we need to get it into the system
|
// both types are from the same package, we need to get it into the system
|
||||||
// so that converter will match it with ExternalType2.
|
// so that converter will match it with ExternalType2.
|
||||||
s.AddKnownTypes(internalGV, &serializertesting.TestType1{})
|
s.AddKnownTypes(internalGV, &runtimetesting.TestType1{})
|
||||||
s.AddKnownTypes(externalGV, &serializertesting.ExternalTestType1{})
|
s.AddKnownTypes(externalGV, &runtimetesting.ExternalTestType1{})
|
||||||
|
|
||||||
s.AddUnversionedTypes(externalGV, &metav1.Status{})
|
s.AddUnversionedTypes(externalGV, &metav1.Status{})
|
||||||
|
|
||||||
utilruntime.Must(serializertesting.RegisterConversions(s))
|
utilruntime.Must(runtimetesting.RegisterConversions(s))
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,7 +346,7 @@ func TestDirectCodec(t *testing.T) {
|
|||||||
}
|
}
|
||||||
directEncoder := df.EncoderForVersion(serializer, ignoredGV)
|
directEncoder := df.EncoderForVersion(serializer, ignoredGV)
|
||||||
directDecoder := df.DecoderToVersion(serializer, ignoredGV)
|
directDecoder := df.DecoderToVersion(serializer, ignoredGV)
|
||||||
out, err := runtime.Encode(directEncoder, &serializertesting.ExternalTestType1{})
|
out, err := runtime.Encode(directEncoder, &runtimetesting.ExternalTestType1{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -357,8 +357,8 @@ func TestDirectCodec(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("error on Decode: %v", err)
|
t.Fatalf("error on Decode: %v", err)
|
||||||
}
|
}
|
||||||
e := &serializertesting.ExternalTestType1{
|
e := &runtimetesting.ExternalTestType1{
|
||||||
MyWeirdCustomEmbeddedVersionKindField: serializertesting.MyWeirdCustomEmbeddedVersionKindField{
|
MyWeirdCustomEmbeddedVersionKindField: runtimetesting.MyWeirdCustomEmbeddedVersionKindField{
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
ObjectKind: "ExternalTestType1",
|
ObjectKind: "ExternalTestType1",
|
||||||
},
|
},
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
package(default_visibility = ["//visibility:public"])
|
|
||||||
|
|
||||||
load(
|
|
||||||
"@io_bazel_rules_go//go:def.bzl",
|
|
||||||
"go_library",
|
|
||||||
)
|
|
||||||
|
|
||||||
go_library(
|
|
||||||
name = "go_default_library",
|
|
||||||
srcs = [
|
|
||||||
"conversion.go",
|
|
||||||
"doc.go",
|
|
||||||
"types.go",
|
|
||||||
"zz_generated.deepcopy.go",
|
|
||||||
],
|
|
||||||
importmap = "k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/serializer/testing",
|
|
||||||
importpath = "k8s.io/apimachinery/pkg/runtime/serializer/testing",
|
|
||||||
deps = [
|
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
|
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
filegroup(
|
|
||||||
name = "package-srcs",
|
|
||||||
srcs = glob(["**"]),
|
|
||||||
tags = ["automanaged"],
|
|
||||||
visibility = ["//visibility:private"],
|
|
||||||
)
|
|
||||||
|
|
||||||
filegroup(
|
|
||||||
name = "all-srcs",
|
|
||||||
srcs = [":package-srcs"],
|
|
||||||
tags = ["automanaged"],
|
|
||||||
)
|
|
@ -1,19 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2014 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// +k8s:deepcopy-gen=package
|
|
||||||
|
|
||||||
package testing // import "k8s.io/apimachinery/pkg/runtime/serializer/testing"
|
|
@ -1,114 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2014 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 testing
|
|
||||||
|
|
||||||
import (
|
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Test a weird version/kind embedding format.
|
|
||||||
// +k8s:deepcopy-gen=false
|
|
||||||
type MyWeirdCustomEmbeddedVersionKindField struct {
|
|
||||||
ID string `json:"ID,omitempty"`
|
|
||||||
APIVersion string `json:"myVersionKey,omitempty"`
|
|
||||||
ObjectKind string `json:"myKindKey,omitempty"`
|
|
||||||
Z string `json:"Z,omitempty"`
|
|
||||||
Y uint64 `json:"Y,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
|
||||||
type TestType1 struct {
|
|
||||||
MyWeirdCustomEmbeddedVersionKindField `json:",inline"`
|
|
||||||
A string `json:"A,omitempty"`
|
|
||||||
B int `json:"B,omitempty"`
|
|
||||||
C int8 `json:"C,omitempty"`
|
|
||||||
D int16 `json:"D,omitempty"`
|
|
||||||
E int32 `json:"E,omitempty"`
|
|
||||||
F int64 `json:"F,omitempty"`
|
|
||||||
G uint `json:"G,omitempty"`
|
|
||||||
H uint8 `json:"H,omitempty"`
|
|
||||||
I uint16 `json:"I,omitempty"`
|
|
||||||
J uint32 `json:"J,omitempty"`
|
|
||||||
K uint64 `json:"K,omitempty"`
|
|
||||||
L bool `json:"L,omitempty"`
|
|
||||||
M map[string]int `json:"M,omitempty"`
|
|
||||||
N map[string]TestType2 `json:"N,omitempty"`
|
|
||||||
O *TestType2 `json:"O,omitempty"`
|
|
||||||
P []TestType2 `json:"Q,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
|
||||||
type TestType2 struct {
|
|
||||||
A string `json:"A,omitempty"`
|
|
||||||
B int `json:"B,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
|
||||||
type ExternalTestType2 struct {
|
|
||||||
A string `json:"A,omitempty"`
|
|
||||||
B int `json:"B,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
|
||||||
type ExternalTestType1 struct {
|
|
||||||
MyWeirdCustomEmbeddedVersionKindField `json:",inline"`
|
|
||||||
A string `json:"A,omitempty"`
|
|
||||||
B int `json:"B,omitempty"`
|
|
||||||
C int8 `json:"C,omitempty"`
|
|
||||||
D int16 `json:"D,omitempty"`
|
|
||||||
E int32 `json:"E,omitempty"`
|
|
||||||
F int64 `json:"F,omitempty"`
|
|
||||||
G uint `json:"G,omitempty"`
|
|
||||||
H uint8 `json:"H,omitempty"`
|
|
||||||
I uint16 `json:"I,omitempty"`
|
|
||||||
J uint32 `json:"J,omitempty"`
|
|
||||||
K uint64 `json:"K,omitempty"`
|
|
||||||
L bool `json:"L,omitempty"`
|
|
||||||
M map[string]int `json:"M,omitempty"`
|
|
||||||
N map[string]ExternalTestType2 `json:"N,omitempty"`
|
|
||||||
O *ExternalTestType2 `json:"O,omitempty"`
|
|
||||||
P []ExternalTestType2 `json:"Q,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
|
||||||
type ExternalInternalSame struct {
|
|
||||||
MyWeirdCustomEmbeddedVersionKindField `json:",inline"`
|
|
||||||
A TestType2 `json:"A,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (obj *MyWeirdCustomEmbeddedVersionKindField) GetObjectKind() schema.ObjectKind { return obj }
|
|
||||||
func (obj *MyWeirdCustomEmbeddedVersionKindField) SetGroupVersionKind(gvk schema.GroupVersionKind) {
|
|
||||||
obj.APIVersion, obj.ObjectKind = gvk.ToAPIVersionAndKind()
|
|
||||||
}
|
|
||||||
func (obj *MyWeirdCustomEmbeddedVersionKindField) GroupVersionKind() schema.GroupVersionKind {
|
|
||||||
return schema.FromAPIVersionAndKind(obj.APIVersion, obj.ObjectKind)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (obj *ExternalInternalSame) GetObjectKind() schema.ObjectKind {
|
|
||||||
return &obj.MyWeirdCustomEmbeddedVersionKindField
|
|
||||||
}
|
|
||||||
|
|
||||||
func (obj *TestType1) GetObjectKind() schema.ObjectKind {
|
|
||||||
return &obj.MyWeirdCustomEmbeddedVersionKindField
|
|
||||||
}
|
|
||||||
|
|
||||||
func (obj *ExternalTestType1) GetObjectKind() schema.ObjectKind {
|
|
||||||
return &obj.MyWeirdCustomEmbeddedVersionKindField
|
|
||||||
}
|
|
||||||
|
|
||||||
func (obj *TestType2) GetObjectKind() schema.ObjectKind { return schema.EmptyObjectKind }
|
|
||||||
func (obj *ExternalTestType2) GetObjectKind() schema.ObjectKind { return schema.EmptyObjectKind }
|
|
@ -1,197 +0,0 @@
|
|||||||
// +build !ignore_autogenerated
|
|
||||||
|
|
||||||
/*
|
|
||||||
Copyright 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by deepcopy-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package testing
|
|
||||||
|
|
||||||
import (
|
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
|
||||||
)
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *ExternalInternalSame) DeepCopyInto(out *ExternalInternalSame) {
|
|
||||||
*out = *in
|
|
||||||
out.MyWeirdCustomEmbeddedVersionKindField = in.MyWeirdCustomEmbeddedVersionKindField
|
|
||||||
out.A = in.A
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExternalInternalSame.
|
|
||||||
func (in *ExternalInternalSame) DeepCopy() *ExternalInternalSame {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(ExternalInternalSame)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
|
||||||
func (in *ExternalInternalSame) DeepCopyObject() runtime.Object {
|
|
||||||
if c := in.DeepCopy(); c != nil {
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *ExternalTestType1) DeepCopyInto(out *ExternalTestType1) {
|
|
||||||
*out = *in
|
|
||||||
out.MyWeirdCustomEmbeddedVersionKindField = in.MyWeirdCustomEmbeddedVersionKindField
|
|
||||||
if in.M != nil {
|
|
||||||
in, out := &in.M, &out.M
|
|
||||||
*out = make(map[string]int, len(*in))
|
|
||||||
for key, val := range *in {
|
|
||||||
(*out)[key] = val
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if in.N != nil {
|
|
||||||
in, out := &in.N, &out.N
|
|
||||||
*out = make(map[string]ExternalTestType2, len(*in))
|
|
||||||
for key, val := range *in {
|
|
||||||
(*out)[key] = val
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if in.O != nil {
|
|
||||||
in, out := &in.O, &out.O
|
|
||||||
*out = new(ExternalTestType2)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
if in.P != nil {
|
|
||||||
in, out := &in.P, &out.P
|
|
||||||
*out = make([]ExternalTestType2, len(*in))
|
|
||||||
copy(*out, *in)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExternalTestType1.
|
|
||||||
func (in *ExternalTestType1) DeepCopy() *ExternalTestType1 {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(ExternalTestType1)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
|
||||||
func (in *ExternalTestType1) DeepCopyObject() runtime.Object {
|
|
||||||
if c := in.DeepCopy(); c != nil {
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *ExternalTestType2) DeepCopyInto(out *ExternalTestType2) {
|
|
||||||
*out = *in
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExternalTestType2.
|
|
||||||
func (in *ExternalTestType2) DeepCopy() *ExternalTestType2 {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(ExternalTestType2)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
|
||||||
func (in *ExternalTestType2) DeepCopyObject() runtime.Object {
|
|
||||||
if c := in.DeepCopy(); c != nil {
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *TestType1) DeepCopyInto(out *TestType1) {
|
|
||||||
*out = *in
|
|
||||||
out.MyWeirdCustomEmbeddedVersionKindField = in.MyWeirdCustomEmbeddedVersionKindField
|
|
||||||
if in.M != nil {
|
|
||||||
in, out := &in.M, &out.M
|
|
||||||
*out = make(map[string]int, len(*in))
|
|
||||||
for key, val := range *in {
|
|
||||||
(*out)[key] = val
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if in.N != nil {
|
|
||||||
in, out := &in.N, &out.N
|
|
||||||
*out = make(map[string]TestType2, len(*in))
|
|
||||||
for key, val := range *in {
|
|
||||||
(*out)[key] = val
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if in.O != nil {
|
|
||||||
in, out := &in.O, &out.O
|
|
||||||
*out = new(TestType2)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
if in.P != nil {
|
|
||||||
in, out := &in.P, &out.P
|
|
||||||
*out = make([]TestType2, len(*in))
|
|
||||||
copy(*out, *in)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TestType1.
|
|
||||||
func (in *TestType1) DeepCopy() *TestType1 {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(TestType1)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
|
||||||
func (in *TestType1) DeepCopyObject() runtime.Object {
|
|
||||||
if c := in.DeepCopy(); c != nil {
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *TestType2) DeepCopyInto(out *TestType2) {
|
|
||||||
*out = *in
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TestType2.
|
|
||||||
func (in *TestType2) DeepCopy() *TestType2 {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(TestType2)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
|
||||||
func (in *TestType2) DeepCopyObject() runtime.Object {
|
|
||||||
if c := in.DeepCopy(); c != nil {
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
@ -9,6 +9,7 @@ go_library(
|
|||||||
name = "go_default_library",
|
name = "go_default_library",
|
||||||
srcs = [
|
srcs = [
|
||||||
"cacheable_object.go",
|
"cacheable_object.go",
|
||||||
|
"conversion.go",
|
||||||
"doc.go",
|
"doc.go",
|
||||||
"types.go",
|
"types.go",
|
||||||
"zz_generated.deepcopy.go",
|
"zz_generated.deepcopy.go",
|
||||||
@ -16,6 +17,7 @@ go_library(
|
|||||||
importmap = "k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/testing",
|
importmap = "k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/testing",
|
||||||
importpath = "k8s.io/apimachinery/pkg/runtime/testing",
|
importpath = "k8s.io/apimachinery/pkg/runtime/testing",
|
||||||
deps = [
|
deps = [
|
||||||
|
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/json:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/json:go_default_library",
|
||||||
|
Loading…
Reference in New Issue
Block a user