refactor: use metav1.ObjectMeta in other types

This commit is contained in:
Clayton Coleman
2017-01-16 22:38:19 -05:00
parent 5a5d31555b
commit 9a2a50cda7
822 changed files with 11914 additions and 9290 deletions

View File

@@ -23,6 +23,7 @@ import (
"strings"
"testing"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/client/restclient"
@@ -33,13 +34,13 @@ import (
func TestValidateLabels(t *testing.T) {
tests := []struct {
meta *api.ObjectMeta
meta *metav1.ObjectMeta
labels map[string]string
expectErr bool
test string
}{
{
meta: &api.ObjectMeta{
meta: &metav1.ObjectMeta{
Labels: map[string]string{
"a": "b",
"c": "d",
@@ -53,7 +54,7 @@ func TestValidateLabels(t *testing.T) {
expectErr: true,
},
{
meta: &api.ObjectMeta{
meta: &metav1.ObjectMeta{
Labels: map[string]string{
"a": "b",
"c": "d",
@@ -67,7 +68,7 @@ func TestValidateLabels(t *testing.T) {
expectErr: true,
},
{
meta: &api.ObjectMeta{
meta: &metav1.ObjectMeta{
Labels: map[string]string{
"a": "b",
"c": "d",
@@ -80,7 +81,7 @@ func TestValidateLabels(t *testing.T) {
test: "no overlap",
},
{
meta: &api.ObjectMeta{},
meta: &metav1.ObjectMeta{},
labels: map[string]string{
"b": "a",
"d": "c",
@@ -165,7 +166,7 @@ func TestLabelFunc(t *testing.T) {
}{
{
obj: &api.Pod{
ObjectMeta: api.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"a": "b"},
},
},
@@ -174,41 +175,41 @@ func TestLabelFunc(t *testing.T) {
},
{
obj: &api.Pod{
ObjectMeta: api.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"a": "b"},
},
},
labels: map[string]string{"a": "c"},
overwrite: true,
expected: &api.Pod{
ObjectMeta: api.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"a": "c"},
},
},
},
{
obj: &api.Pod{
ObjectMeta: api.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"a": "b"},
},
},
labels: map[string]string{"c": "d"},
expected: &api.Pod{
ObjectMeta: api.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"a": "b", "c": "d"},
},
},
},
{
obj: &api.Pod{
ObjectMeta: api.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"a": "b"},
},
},
labels: map[string]string{"c": "d"},
version: "2",
expected: &api.Pod{
ObjectMeta: api.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"a": "b", "c": "d"},
ResourceVersion: "2",
},
@@ -216,28 +217,28 @@ func TestLabelFunc(t *testing.T) {
},
{
obj: &api.Pod{
ObjectMeta: api.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"a": "b"},
},
},
labels: map[string]string{},
remove: []string{"a"},
expected: &api.Pod{
ObjectMeta: api.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{},
},
},
},
{
obj: &api.Pod{
ObjectMeta: api.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"a": "b", "c": "d"},
},
},
labels: map[string]string{"e": "f"},
remove: []string{"a"},
expected: &api.Pod{
ObjectMeta: api.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
"c": "d",
"e": "f",
@@ -247,11 +248,11 @@ func TestLabelFunc(t *testing.T) {
},
{
obj: &api.Pod{
ObjectMeta: api.ObjectMeta{},
ObjectMeta: metav1.ObjectMeta{},
},
labels: map[string]string{"a": "b"},
expected: &api.Pod{
ObjectMeta: api.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"a": "b"},
},
},