2018-05-11 19:44:21 +00:00
|
|
|
/*
|
|
|
|
Copyright 2017 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 util
|
|
|
|
|
|
|
|
import (
|
2018-07-05 13:00:37 +00:00
|
|
|
"bytes"
|
2018-05-11 19:44:21 +00:00
|
|
|
"reflect"
|
2018-07-05 13:00:37 +00:00
|
|
|
"sort"
|
2018-05-11 19:44:21 +00:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
corev1 "k8s.io/api/core/v1"
|
|
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
2018-07-08 18:32:51 +00:00
|
|
|
"k8s.io/apimachinery/pkg/runtime"
|
2018-07-05 13:00:37 +00:00
|
|
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
2018-07-08 18:32:51 +00:00
|
|
|
"k8s.io/apimachinery/pkg/runtime/serializer"
|
2018-10-04 10:03:38 +00:00
|
|
|
kubeadmapiv1beta1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta1"
|
2018-07-05 13:00:37 +00:00
|
|
|
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
2018-05-11 19:44:21 +00:00
|
|
|
)
|
|
|
|
|
2018-07-05 13:00:37 +00:00
|
|
|
var files = map[string][]byte{
|
|
|
|
"foo": []byte(`
|
|
|
|
kind: Foo
|
|
|
|
apiVersion: foo.k8s.io/v1
|
|
|
|
fooField: foo
|
|
|
|
`),
|
|
|
|
"bar": []byte(`
|
|
|
|
apiVersion: bar.k8s.io/v2
|
|
|
|
barField: bar
|
|
|
|
kind: Bar
|
|
|
|
`),
|
|
|
|
"baz": []byte(`
|
|
|
|
apiVersion: baz.k8s.io/v1
|
|
|
|
kind: Baz
|
|
|
|
baz:
|
|
|
|
foo: bar
|
|
|
|
`),
|
|
|
|
"nokind": []byte(`
|
|
|
|
apiVersion: baz.k8s.io/v1
|
|
|
|
foo: foo
|
|
|
|
bar: bar
|
|
|
|
`),
|
|
|
|
"noapiversion": []byte(`
|
|
|
|
kind: Bar
|
|
|
|
foo: foo
|
|
|
|
bar: bar
|
|
|
|
`),
|
|
|
|
}
|
|
|
|
|
2018-05-11 19:44:21 +00:00
|
|
|
func TestMarshalUnmarshalYaml(t *testing.T) {
|
|
|
|
pod := &corev1.Pod{
|
|
|
|
ObjectMeta: metav1.ObjectMeta{
|
|
|
|
Name: "someName",
|
|
|
|
Namespace: "testNamespace",
|
|
|
|
Labels: map[string]string{
|
|
|
|
"test": "yes",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Spec: corev1.PodSpec{
|
|
|
|
RestartPolicy: corev1.RestartPolicyAlways,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
bytes, err := MarshalToYaml(pod, corev1.SchemeGroupVersion)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("unexpected error marshalling: %v", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
t.Logf("\n%s", bytes)
|
|
|
|
|
|
|
|
obj2, err := UnmarshalFromYaml(bytes, corev1.SchemeGroupVersion)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("unexpected error marshalling: %v", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
pod2, ok := obj2.(*corev1.Pod)
|
|
|
|
if !ok {
|
|
|
|
t.Fatal("did not get a Pod")
|
|
|
|
}
|
|
|
|
|
|
|
|
if pod2.Name != pod.Name {
|
|
|
|
t.Errorf("expected %q, got %q", pod.Name, pod2.Name)
|
|
|
|
}
|
|
|
|
|
|
|
|
if pod2.Namespace != pod.Namespace {
|
|
|
|
t.Errorf("expected %q, got %q", pod.Namespace, pod2.Namespace)
|
|
|
|
}
|
|
|
|
|
|
|
|
if !reflect.DeepEqual(pod2.Labels, pod.Labels) {
|
|
|
|
t.Errorf("expected %v, got %v", pod.Labels, pod2.Labels)
|
|
|
|
}
|
|
|
|
|
|
|
|
if pod2.Spec.RestartPolicy != pod.Spec.RestartPolicy {
|
|
|
|
t.Errorf("expected %q, got %q", pod.Spec.RestartPolicy, pod2.Spec.RestartPolicy)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestMarshalUnmarshalToYamlForCodecs(t *testing.T) {
|
2018-10-04 10:03:38 +00:00
|
|
|
cfg := &kubeadmapiv1beta1.InitConfiguration{
|
2018-07-03 18:27:33 +00:00
|
|
|
TypeMeta: metav1.TypeMeta{
|
2018-08-10 18:30:54 +00:00
|
|
|
Kind: constants.InitConfigurationKind,
|
2018-10-04 10:03:38 +00:00
|
|
|
APIVersion: kubeadmapiv1beta1.SchemeGroupVersion.String(),
|
2018-07-03 18:27:33 +00:00
|
|
|
},
|
2018-10-04 10:03:38 +00:00
|
|
|
NodeRegistration: kubeadmapiv1beta1.NodeRegistrationOptions{
|
2018-07-03 18:27:33 +00:00
|
|
|
Name: "testNode",
|
|
|
|
CRISocket: "/var/run/cri.sock",
|
|
|
|
},
|
2018-10-04 10:03:38 +00:00
|
|
|
BootstrapTokens: []kubeadmapiv1beta1.BootstrapToken{
|
2018-07-08 18:32:51 +00:00
|
|
|
{
|
2018-10-04 10:03:38 +00:00
|
|
|
Token: &kubeadmapiv1beta1.BootstrapTokenString{ID: "abcdef", Secret: "abcdef0123456789"},
|
2018-07-08 18:32:51 +00:00
|
|
|
},
|
|
|
|
},
|
2018-08-10 18:30:54 +00:00
|
|
|
// NOTE: Using MarshalToYamlForCodecs and UnmarshalFromYamlForCodecs for ClusterConfiguration fields here won't work
|
|
|
|
// by design. This is because we have a `json:"-"` annotation in order to avoid struct duplication. See the comment
|
2018-10-04 10:03:38 +00:00
|
|
|
// at the kubeadmapiv1beta1.InitConfiguration definition.
|
2018-05-11 19:44:21 +00:00
|
|
|
}
|
|
|
|
|
2018-10-04 10:03:38 +00:00
|
|
|
kubeadmapiv1beta1.SetDefaults_InitConfiguration(cfg)
|
2018-07-08 18:32:51 +00:00
|
|
|
scheme := runtime.NewScheme()
|
2018-10-04 10:03:38 +00:00
|
|
|
if err := kubeadmapiv1beta1.AddToScheme(scheme); err != nil {
|
2018-07-17 10:29:55 +00:00
|
|
|
t.Fatal(err)
|
|
|
|
}
|
2018-07-08 18:32:51 +00:00
|
|
|
codecs := serializer.NewCodecFactory(scheme)
|
|
|
|
|
2018-10-04 10:03:38 +00:00
|
|
|
bytes, err := MarshalToYamlForCodecs(cfg, kubeadmapiv1beta1.SchemeGroupVersion, codecs)
|
2018-05-11 19:44:21 +00:00
|
|
|
if err != nil {
|
2018-07-09 01:55:02 +00:00
|
|
|
t.Fatalf("unexpected error marshalling InitConfiguration: %v", err)
|
2018-05-11 19:44:21 +00:00
|
|
|
}
|
|
|
|
t.Logf("\n%s", bytes)
|
|
|
|
|
2018-10-04 10:03:38 +00:00
|
|
|
obj, err := UnmarshalFromYamlForCodecs(bytes, kubeadmapiv1beta1.SchemeGroupVersion, codecs)
|
2018-05-11 19:44:21 +00:00
|
|
|
if err != nil {
|
2018-07-09 01:55:02 +00:00
|
|
|
t.Fatalf("unexpected error unmarshalling InitConfiguration: %v", err)
|
2018-05-11 19:44:21 +00:00
|
|
|
}
|
|
|
|
|
2018-10-04 10:03:38 +00:00
|
|
|
cfg2, ok := obj.(*kubeadmapiv1beta1.InitConfiguration)
|
2018-07-03 18:27:33 +00:00
|
|
|
if !ok || cfg2 == nil {
|
2018-07-09 01:55:02 +00:00
|
|
|
t.Fatal("did not get InitConfiguration back")
|
2018-05-11 19:44:21 +00:00
|
|
|
}
|
2018-07-03 18:27:33 +00:00
|
|
|
if !reflect.DeepEqual(*cfg, *cfg2) {
|
|
|
|
t.Errorf("expected %v, got %v", *cfg, *cfg2)
|
2018-05-11 19:44:21 +00:00
|
|
|
}
|
|
|
|
}
|
2018-07-05 13:00:37 +00:00
|
|
|
|
2018-10-04 10:03:38 +00:00
|
|
|
// {{InitConfiguration kubeadm.k8s.io/v1beta1} [{<nil> nil <nil> [] []}] {testNode /var/run/cri.sock [] map[]} {10.100.0.1 4332} {0xc4200ad2c0 <nil>} {10.100.0.0/24 10.100.1.0/24 cluster.local} stable-1.11 map[] map[] map[] [] [] [] [] /etc/kubernetes/pki k8s.gcr.io { /var/log/kubernetes/audit 0x156e2f4} map[] kubernetes}
|
|
|
|
// {{InitConfiguration kubeadm.k8s.io/v1beta1} [{<nil> &Duration{Duration:24h0m0s,} <nil> [signing authentication] [system:bootstrappers:kubeadm:default-node-token]}] {testNode /var/run/cri.sock [] map[]} {10.100.0.1 4332} {0xc4205c5260 <nil>} {10.100.0.0/24 10.100.1.0/24 cluster.local} stable-1.11 map[] map[] map[] [] [] [] [] /etc/kubernetes/pki k8s.gcr.io { /var/log/kubernetes/audit 0xc4204dd82c} map[] kubernetes}
|
2018-07-08 18:32:51 +00:00
|
|
|
|
2018-10-04 10:03:38 +00:00
|
|
|
// {{InitConfiguration kubeadm.k8s.io/v1beta1} [{abcdef.abcdef0123456789 nil <nil> [] []}] {testNode /var/run/cri.sock [] map[]} {10.100.0.1 4332} {0xc42012ca80 <nil>} {10.100.0.0/24 10.100.1.0/24 cluster.local} stable-1.11 map[] map[] map[] [] [] [] [] /etc/kubernetes/pki k8s.gcr.io { /var/log/kubernetes/audit 0x156e2f4} map[] kubernetes}
|
|
|
|
// {{InitConfiguration kubeadm.k8s.io/v1beta1} [{abcdef.abcdef0123456789 &Duration{Duration:24h0m0s,} <nil> [signing authentication] [system:bootstrappers:kubeadm:default-node-token]}] {testNode /var/run/cri.sock [] map[]} {10.100.0.1 4332} {0xc42039d1a0 <nil>} {10.100.0.0/24 10.100.1.0/24 cluster.local} stable-1.11 map[] map[] map[] [] [] [] [] /etc/kubernetes/pki k8s.gcr.io { /var/log/kubernetes/audit 0xc4204fef3c} map[] kubernetes}
|
2018-07-08 18:32:51 +00:00
|
|
|
|
2018-07-05 13:00:37 +00:00
|
|
|
func TestSplitYAMLDocuments(t *testing.T) {
|
|
|
|
var tests = []struct {
|
|
|
|
name string
|
|
|
|
fileContents []byte
|
|
|
|
gvkmap map[schema.GroupVersionKind][]byte
|
|
|
|
expectedErr bool
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
name: "FooOnly",
|
|
|
|
fileContents: files["foo"],
|
|
|
|
gvkmap: map[schema.GroupVersionKind][]byte{
|
|
|
|
{Group: "foo.k8s.io", Version: "v1", Kind: "Foo"}: files["foo"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "FooBar",
|
|
|
|
fileContents: bytes.Join([][]byte{files["foo"], files["bar"]}, []byte(constants.YAMLDocumentSeparator)),
|
|
|
|
gvkmap: map[schema.GroupVersionKind][]byte{
|
|
|
|
{Group: "foo.k8s.io", Version: "v1", Kind: "Foo"}: files["foo"],
|
|
|
|
{Group: "bar.k8s.io", Version: "v2", Kind: "Bar"}: files["bar"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "FooTwiceInvalid",
|
|
|
|
fileContents: bytes.Join([][]byte{files["foo"], files["bar"], files["foo"]}, []byte(constants.YAMLDocumentSeparator)),
|
|
|
|
expectedErr: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "InvalidBaz",
|
|
|
|
fileContents: bytes.Join([][]byte{files["foo"], files["baz"]}, []byte(constants.YAMLDocumentSeparator)),
|
|
|
|
expectedErr: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "InvalidNoKind",
|
|
|
|
fileContents: files["nokind"],
|
|
|
|
expectedErr: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "InvalidNoAPIVersion",
|
|
|
|
fileContents: files["noapiversion"],
|
|
|
|
expectedErr: true,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, rt := range tests {
|
|
|
|
t.Run(rt.name, func(t2 *testing.T) {
|
|
|
|
|
|
|
|
gvkmap, err := SplitYAMLDocuments(rt.fileContents)
|
|
|
|
if (err != nil) != rt.expectedErr {
|
|
|
|
t2.Errorf("expected error: %t, actual: %t", rt.expectedErr, err != nil)
|
|
|
|
}
|
|
|
|
|
|
|
|
if !reflect.DeepEqual(gvkmap, rt.gvkmap) {
|
|
|
|
t2.Errorf("expected gvkmap: %s\n\tactual: %s\n", rt.gvkmap, gvkmap)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestGroupVersionKindsFromBytes(t *testing.T) {
|
|
|
|
var tests = []struct {
|
|
|
|
name string
|
|
|
|
fileContents []byte
|
|
|
|
gvks []string
|
|
|
|
expectedErr bool
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
name: "FooOnly",
|
|
|
|
fileContents: files["foo"],
|
|
|
|
gvks: []string{
|
|
|
|
"foo.k8s.io/v1, Kind=Foo",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "FooBar",
|
|
|
|
fileContents: bytes.Join([][]byte{files["foo"], files["bar"]}, []byte(constants.YAMLDocumentSeparator)),
|
|
|
|
gvks: []string{
|
|
|
|
"foo.k8s.io/v1, Kind=Foo",
|
|
|
|
"bar.k8s.io/v2, Kind=Bar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "FooTwiceInvalid",
|
|
|
|
fileContents: bytes.Join([][]byte{files["foo"], files["bar"], files["foo"]}, []byte(constants.YAMLDocumentSeparator)),
|
|
|
|
gvks: []string{},
|
|
|
|
expectedErr: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "InvalidBaz",
|
|
|
|
fileContents: bytes.Join([][]byte{files["foo"], files["baz"]}, []byte(constants.YAMLDocumentSeparator)),
|
|
|
|
gvks: []string{},
|
|
|
|
expectedErr: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "InvalidNoKind",
|
|
|
|
fileContents: files["nokind"],
|
|
|
|
gvks: []string{},
|
|
|
|
expectedErr: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "InvalidNoAPIVersion",
|
|
|
|
fileContents: files["noapiversion"],
|
|
|
|
gvks: []string{},
|
|
|
|
expectedErr: true,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, rt := range tests {
|
|
|
|
t.Run(rt.name, func(t2 *testing.T) {
|
|
|
|
|
|
|
|
gvks, err := GroupVersionKindsFromBytes(rt.fileContents)
|
|
|
|
if (err != nil) != rt.expectedErr {
|
|
|
|
t2.Errorf("expected error: %t, actual: %t", rt.expectedErr, err != nil)
|
|
|
|
}
|
|
|
|
|
|
|
|
strgvks := []string{}
|
|
|
|
for _, gvk := range gvks {
|
|
|
|
strgvks = append(strgvks, gvk.String())
|
|
|
|
}
|
|
|
|
sort.Strings(strgvks)
|
|
|
|
sort.Strings(rt.gvks)
|
|
|
|
|
|
|
|
if !reflect.DeepEqual(strgvks, rt.gvks) {
|
|
|
|
t2.Errorf("expected gvks: %s\n\tactual: %s\n", rt.gvks, strgvks)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestGroupVersionKindsHasKind(t *testing.T) {
|
|
|
|
var tests = []struct {
|
|
|
|
name string
|
|
|
|
gvks []schema.GroupVersionKind
|
|
|
|
kind string
|
|
|
|
expected bool
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
name: "FooOnly",
|
|
|
|
gvks: []schema.GroupVersionKind{
|
|
|
|
{Group: "foo.k8s.io", Version: "v1", Kind: "Foo"},
|
|
|
|
},
|
|
|
|
kind: "Foo",
|
|
|
|
expected: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "FooBar",
|
|
|
|
gvks: []schema.GroupVersionKind{
|
|
|
|
{Group: "foo.k8s.io", Version: "v1", Kind: "Foo"},
|
|
|
|
{Group: "bar.k8s.io", Version: "v2", Kind: "Bar"},
|
|
|
|
},
|
|
|
|
kind: "Bar",
|
|
|
|
expected: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "FooBazNoBaz",
|
|
|
|
gvks: []schema.GroupVersionKind{
|
|
|
|
{Group: "foo.k8s.io", Version: "v1", Kind: "Foo"},
|
|
|
|
{Group: "bar.k8s.io", Version: "v2", Kind: "Bar"},
|
|
|
|
},
|
|
|
|
kind: "Baz",
|
|
|
|
expected: false,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, rt := range tests {
|
|
|
|
t.Run(rt.name, func(t2 *testing.T) {
|
|
|
|
|
|
|
|
actual := GroupVersionKindsHasKind(rt.gvks, rt.kind)
|
|
|
|
if rt.expected != actual {
|
|
|
|
t2.Errorf("expected gvks has kind: %t\n\tactual: %t\n", rt.expected, actual)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-09 01:55:02 +00:00
|
|
|
func TestGroupVersionKindsHasInitConfiguration(t *testing.T) {
|
2018-07-05 13:00:37 +00:00
|
|
|
var tests = []struct {
|
|
|
|
name string
|
|
|
|
gvks []schema.GroupVersionKind
|
|
|
|
kind string
|
|
|
|
expected bool
|
|
|
|
}{
|
|
|
|
{
|
2018-07-09 01:55:02 +00:00
|
|
|
name: "NoInitConfiguration",
|
2018-07-05 13:00:37 +00:00
|
|
|
gvks: []schema.GroupVersionKind{
|
|
|
|
{Group: "foo.k8s.io", Version: "v1", Kind: "Foo"},
|
|
|
|
},
|
|
|
|
expected: false,
|
|
|
|
},
|
|
|
|
{
|
2018-07-09 01:55:02 +00:00
|
|
|
name: "InitConfigurationFound",
|
2018-07-05 13:00:37 +00:00
|
|
|
gvks: []schema.GroupVersionKind{
|
|
|
|
{Group: "foo.k8s.io", Version: "v1", Kind: "Foo"},
|
2018-07-09 01:55:02 +00:00
|
|
|
{Group: "bar.k8s.io", Version: "v2", Kind: "InitConfiguration"},
|
2018-07-05 13:00:37 +00:00
|
|
|
},
|
|
|
|
expected: true,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, rt := range tests {
|
|
|
|
t.Run(rt.name, func(t2 *testing.T) {
|
|
|
|
|
2018-07-09 01:55:45 +00:00
|
|
|
actual := GroupVersionKindsHasInitConfiguration(rt.gvks...)
|
2018-07-05 13:00:37 +00:00
|
|
|
if rt.expected != actual {
|
2018-07-09 01:55:02 +00:00
|
|
|
t2.Errorf("expected gvks has InitConfiguration: %t\n\tactual: %t\n", rt.expected, actual)
|
2018-07-05 13:00:37 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-13 20:52:41 +00:00
|
|
|
func TestGroupVersionKindsHasJoinConfiguration(t *testing.T) {
|
2018-07-05 13:00:37 +00:00
|
|
|
var tests = []struct {
|
|
|
|
name string
|
|
|
|
gvks []schema.GroupVersionKind
|
|
|
|
kind string
|
|
|
|
expected bool
|
|
|
|
}{
|
|
|
|
{
|
2018-07-13 20:52:41 +00:00
|
|
|
name: "NoJoinConfiguration",
|
2018-07-05 13:00:37 +00:00
|
|
|
gvks: []schema.GroupVersionKind{
|
|
|
|
{Group: "foo.k8s.io", Version: "v1", Kind: "Foo"},
|
|
|
|
},
|
|
|
|
expected: false,
|
|
|
|
},
|
|
|
|
{
|
2018-07-13 20:52:41 +00:00
|
|
|
name: "JoinConfigurationFound",
|
2018-07-05 13:00:37 +00:00
|
|
|
gvks: []schema.GroupVersionKind{
|
|
|
|
{Group: "foo.k8s.io", Version: "v1", Kind: "Foo"},
|
2018-07-13 20:52:41 +00:00
|
|
|
{Group: "bar.k8s.io", Version: "v2", Kind: "JoinConfiguration"},
|
2018-07-05 13:00:37 +00:00
|
|
|
},
|
|
|
|
expected: true,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, rt := range tests {
|
|
|
|
t.Run(rt.name, func(t2 *testing.T) {
|
|
|
|
|
2018-07-13 21:06:17 +00:00
|
|
|
actual := GroupVersionKindsHasJoinConfiguration(rt.gvks...)
|
2018-07-05 13:00:37 +00:00
|
|
|
if rt.expected != actual {
|
2018-07-13 20:52:41 +00:00
|
|
|
t2.Errorf("expected gvks has JoinConfiguration: %t\n\tactual: %t\n", rt.expected, actual)
|
2018-07-05 13:00:37 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|