Remove k8s.io/apimachinery/pkg/runtime/serializer/testing directory

This commit is contained in:
wojtekt 2020-04-02 21:47:03 +02:00
parent aff467bbb4
commit 8eb60c2474
9 changed files with 38 additions and 404 deletions

View File

@ -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/recognizer
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/selection
staging/src/k8s.io/apimachinery/pkg/test

View File

@ -19,7 +19,7 @@ go_test(
"//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",
"//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/runtime: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/recognizer: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/yaml:all-srcs",
],

View File

@ -29,7 +29,7 @@ import (
"k8s.io/apimachinery/pkg/conversion"
"k8s.io/apimachinery/pkg/runtime"
"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"
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.
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)
j.APIVersion = ""
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
// both types are from the same package, we need to get it into the system
// so that converter will match it with ExternalType2.
s.AddKnownTypes(internalGV, &serializertesting.TestType1{}, &serializertesting.TestType2{}, &serializertesting.ExternalInternalSame{})
s.AddKnownTypes(externalGV, &serializertesting.ExternalInternalSame{})
s.AddKnownTypeWithName(externalGV.WithKind("TestType1"), &serializertesting.ExternalTestType1{})
s.AddKnownTypeWithName(externalGV.WithKind("TestType2"), &serializertesting.ExternalTestType2{})
s.AddKnownTypeWithName(internalGV.WithKind("TestType3"), &serializertesting.TestType1{})
s.AddKnownTypeWithName(externalGV.WithKind("TestType3"), &serializertesting.ExternalTestType1{})
s.AddKnownTypeWithName(externalGV2.WithKind("TestType1"), &serializertesting.ExternalTestType1{})
s.AddKnownTypes(internalGV, &runtimetesting.TestType1{}, &runtimetesting.TestType2{}, &runtimetesting.ExternalInternalSame{})
s.AddKnownTypes(externalGV, &runtimetesting.ExternalInternalSame{})
s.AddKnownTypeWithName(externalGV.WithKind("TestType1"), &runtimetesting.ExternalTestType1{})
s.AddKnownTypeWithName(externalGV.WithKind("TestType2"), &runtimetesting.ExternalTestType2{})
s.AddKnownTypeWithName(internalGV.WithKind("TestType3"), &runtimetesting.TestType1{})
s.AddKnownTypeWithName(externalGV.WithKind("TestType3"), &runtimetesting.ExternalTestType1{})
s.AddKnownTypeWithName(externalGV2.WithKind("TestType1"), &runtimetesting.ExternalTestType1{})
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}))
codec := cf.LegacyCodec(schema.GroupVersion{Version: "v1"})
@ -96,7 +96,7 @@ func GetTestScheme() (*runtime.Scheme, runtime.Codec) {
}
var semantic = conversion.EqualitiesOrDie(
func(a, b serializertesting.MyWeirdCustomEmbeddedVersionKindField) bool {
func(a, b runtimetesting.MyWeirdCustomEmbeddedVersionKindField) bool {
a.APIVersion, a.ObjectKind = "", ""
b.APIVersion, b.ObjectKind = "", ""
return a == b
@ -135,8 +135,8 @@ func runTest(t *testing.T, source interface{}) {
func TestTypes(t *testing.T) {
table := []interface{}{
&serializertesting.TestType1{},
&serializertesting.ExternalInternalSame{},
&runtimetesting.TestType1{},
&runtimetesting.ExternalInternalSame{},
}
for _, item := range table {
// Try a few times, since runTest uses random values.
@ -153,7 +153,7 @@ func TestVersionedEncoding(t *testing.T) {
encoder := info.Serializer
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 {
t.Fatal(err)
}
@ -162,14 +162,14 @@ func TestVersionedEncoding(t *testing.T) {
}
codec = cf.EncoderForVersion(encoder, schema.GroupVersion{Version: "v3"})
_, err = runtime.Encode(codec, &serializertesting.TestType1{})
_, err = runtime.Encode(codec, &runtimetesting.TestType1{})
if err == nil {
t.Fatal(err)
}
// unversioned encode with no versions is written directly to wire
codec = cf.EncoderForVersion(encoder, runtime.InternalGroupVersioner)
out, err = runtime.Encode(codec, &serializertesting.TestType1{})
out, err = runtime.Encode(codec, &runtimetesting.TestType1{})
if err != nil {
t.Fatal(err)
}
@ -185,7 +185,7 @@ func TestMultipleNames(t *testing.T) {
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
internal := obj.(*serializertesting.TestType1)
internal := obj.(*runtimetesting.TestType1)
if internal.A != "value" {
t.Fatalf("unexpected decoded object: %#v", internal)
}
@ -222,16 +222,16 @@ func TestConvertTypesWhenDefaultNamesMatch(t *testing.T) {
s := runtime.NewScheme()
// create two names internally, with TestType1 being preferred
s.AddKnownTypeWithName(internalGV.WithKind("TestType1"), &serializertesting.TestType1{})
s.AddKnownTypeWithName(internalGV.WithKind("OtherType1"), &serializertesting.TestType1{})
s.AddKnownTypeWithName(internalGV.WithKind("TestType1"), &runtimetesting.TestType1{})
s.AddKnownTypeWithName(internalGV.WithKind("OtherType1"), &runtimetesting.TestType1{})
// create two names externally, with TestType1 being preferred
s.AddKnownTypeWithName(externalGV.WithKind("TestType1"), &serializertesting.ExternalTestType1{})
s.AddKnownTypeWithName(externalGV.WithKind("OtherType1"), &serializertesting.ExternalTestType1{})
if err := serializertesting.RegisterConversions(s); err != nil {
s.AddKnownTypeWithName(externalGV.WithKind("TestType1"), &runtimetesting.ExternalTestType1{})
s.AddKnownTypeWithName(externalGV.WithKind("OtherType1"), &runtimetesting.ExternalTestType1{})
if err := runtimetesting.RegisterConversions(s); err != nil {
t.Fatalf("unexpected error; %v", err)
}
ext := &serializertesting.ExternalTestType1{}
ext := &runtimetesting.ExternalTestType1{}
ext.APIVersion = "v1"
ext.ObjectKind = "OtherType1"
ext.A = "test"
@ -239,7 +239,7 @@ func TestConvertTypesWhenDefaultNamesMatch(t *testing.T) {
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
expect := &serializertesting.TestType1{A: "test"}
expect := &runtimetesting.TestType1{A: "test"}
codec := newCodecFactory(
s, newSerializersForScheme(s, testMetaFactory{}, CodecFactoryOptions{Pretty: true, Strict: true}),
@ -253,7 +253,7 @@ func TestConvertTypesWhenDefaultNamesMatch(t *testing.T) {
t.Errorf("unexpected object: %#v", obj)
}
into := &serializertesting.TestType1{}
into := &runtimetesting.TestType1{}
if err := runtime.DecodeInto(codec, data, into); err != nil {
t.Fatalf("unexpected error: %v", err)
}
@ -264,13 +264,13 @@ func TestConvertTypesWhenDefaultNamesMatch(t *testing.T) {
func TestEncode_Ptr(t *testing.T) {
_, 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)
obj2, err2 := runtime.Decode(codec, data)
if err != nil || err2 != nil {
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")
}
if !semantic.DeepEqual(obj2, tt) {
@ -293,10 +293,10 @@ func TestBadJSONRejection(t *testing.T) {
}
}
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)
}
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)
}
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
// both types are from the same package, we need to get it into the system
// so that converter will match it with ExternalType2.
s.AddKnownTypes(internalGV, &serializertesting.TestType1{})
s.AddKnownTypes(externalGV, &serializertesting.ExternalTestType1{})
s.AddKnownTypes(internalGV, &runtimetesting.TestType1{})
s.AddKnownTypes(externalGV, &runtimetesting.ExternalTestType1{})
s.AddUnversionedTypes(externalGV, &metav1.Status{})
utilruntime.Must(serializertesting.RegisterConversions(s))
utilruntime.Must(runtimetesting.RegisterConversions(s))
return s
}
@ -346,7 +346,7 @@ func TestDirectCodec(t *testing.T) {
}
directEncoder := df.EncoderForVersion(serializer, ignoredGV)
directDecoder := df.DecoderToVersion(serializer, ignoredGV)
out, err := runtime.Encode(directEncoder, &serializertesting.ExternalTestType1{})
out, err := runtime.Encode(directEncoder, &runtimetesting.ExternalTestType1{})
if err != nil {
t.Fatal(err)
}
@ -357,8 +357,8 @@ func TestDirectCodec(t *testing.T) {
if err != nil {
t.Fatalf("error on Decode: %v", err)
}
e := &serializertesting.ExternalTestType1{
MyWeirdCustomEmbeddedVersionKindField: serializertesting.MyWeirdCustomEmbeddedVersionKindField{
e := &runtimetesting.ExternalTestType1{
MyWeirdCustomEmbeddedVersionKindField: runtimetesting.MyWeirdCustomEmbeddedVersionKindField{
APIVersion: "v1",
ObjectKind: "ExternalTestType1",
},

View File

@ -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"],
)

View File

@ -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"

View File

@ -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 }

View File

@ -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
}

View File

@ -9,6 +9,7 @@ go_library(
name = "go_default_library",
srcs = [
"cacheable_object.go",
"conversion.go",
"doc.go",
"types.go",
"zz_generated.deepcopy.go",
@ -16,6 +17,7 @@ go_library(
importmap = "k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/testing",
importpath = "k8s.io/apimachinery/pkg/runtime/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",
"//staging/src/k8s.io/apimachinery/pkg/util/json:go_default_library",