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

@@ -35,7 +35,7 @@ func TestGetJobFromTemplate(t *testing.T) {
var no bool = false
sj := batch.CronJob{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: "mycronjob",
Namespace: "snazzycats",
UID: types.UID("1a2b3c"),
@@ -45,7 +45,7 @@ func TestGetJobFromTemplate(t *testing.T) {
Schedule: "* * * * ?",
ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"a": "b"},
Annotations: map[string]string{"x": "y"},
},
@@ -53,7 +53,7 @@ func TestGetJobFromTemplate(t *testing.T) {
ActiveDeadlineSeconds: &one,
ManualSelector: &no,
Template: v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
"foo": "bar",
},
@@ -99,7 +99,7 @@ func TestGetJobFromTemplate(t *testing.T) {
func TestGetParentUIDFromJob(t *testing.T) {
j := &batch.Job{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: "foobar",
Namespace: v1.NamespaceDefault,
},
@@ -108,7 +108,7 @@ func TestGetParentUIDFromJob(t *testing.T) {
MatchLabels: map[string]string{"foo": "bar"},
},
Template: v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
"foo": "bar",
},
@@ -173,7 +173,7 @@ func TestGroupJobsByParent(t *testing.T) {
{
// Case 2: there is one controller with no job.
sjs := []batch.CronJob{
{ObjectMeta: v1.ObjectMeta{Name: "e", Namespace: "x", UID: uid1}},
{ObjectMeta: metav1.ObjectMeta{Name: "e", Namespace: "x", UID: uid1}},
}
js := []batch.Job{}
jobsBySj := groupJobsByParent(sjs, js)
@@ -185,10 +185,10 @@ func TestGroupJobsByParent(t *testing.T) {
{
// Case 3: there is one controller with one job it created.
sjs := []batch.CronJob{
{ObjectMeta: v1.ObjectMeta{Name: "e", Namespace: "x", UID: uid1}},
{ObjectMeta: metav1.ObjectMeta{Name: "e", Namespace: "x", UID: uid1}},
}
js := []batch.Job{
{ObjectMeta: v1.ObjectMeta{Name: "a", Namespace: "x", Annotations: createdBy1}},
{ObjectMeta: metav1.ObjectMeta{Name: "a", Namespace: "x", Annotations: createdBy1}},
}
jobsBySj := groupJobsByParent(sjs, js)
@@ -208,18 +208,18 @@ func TestGroupJobsByParent(t *testing.T) {
// Case 4: Two namespaces, one has two jobs from one controller, other has 3 jobs from two controllers.
// There are also two jobs with no created-by annotation.
js := []batch.Job{
{ObjectMeta: v1.ObjectMeta{Name: "a", Namespace: "x", Annotations: createdBy1}},
{ObjectMeta: v1.ObjectMeta{Name: "b", Namespace: "x", Annotations: createdBy2}},
{ObjectMeta: v1.ObjectMeta{Name: "c", Namespace: "x", Annotations: createdBy1}},
{ObjectMeta: v1.ObjectMeta{Name: "d", Namespace: "x", Annotations: noCreatedBy}},
{ObjectMeta: v1.ObjectMeta{Name: "a", Namespace: "y", Annotations: createdBy3}},
{ObjectMeta: v1.ObjectMeta{Name: "b", Namespace: "y", Annotations: createdBy3}},
{ObjectMeta: v1.ObjectMeta{Name: "d", Namespace: "y", Annotations: noCreatedBy}},
{ObjectMeta: metav1.ObjectMeta{Name: "a", Namespace: "x", Annotations: createdBy1}},
{ObjectMeta: metav1.ObjectMeta{Name: "b", Namespace: "x", Annotations: createdBy2}},
{ObjectMeta: metav1.ObjectMeta{Name: "c", Namespace: "x", Annotations: createdBy1}},
{ObjectMeta: metav1.ObjectMeta{Name: "d", Namespace: "x", Annotations: noCreatedBy}},
{ObjectMeta: metav1.ObjectMeta{Name: "a", Namespace: "y", Annotations: createdBy3}},
{ObjectMeta: metav1.ObjectMeta{Name: "b", Namespace: "y", Annotations: createdBy3}},
{ObjectMeta: metav1.ObjectMeta{Name: "d", Namespace: "y", Annotations: noCreatedBy}},
}
sjs := []batch.CronJob{
{ObjectMeta: v1.ObjectMeta{Name: "e", Namespace: "x", UID: uid1}},
{ObjectMeta: v1.ObjectMeta{Name: "f", Namespace: "x", UID: uid2}},
{ObjectMeta: v1.ObjectMeta{Name: "g", Namespace: "y", UID: uid3}},
{ObjectMeta: metav1.ObjectMeta{Name: "e", Namespace: "x", UID: uid1}},
{ObjectMeta: metav1.ObjectMeta{Name: "f", Namespace: "x", UID: uid2}},
{ObjectMeta: metav1.ObjectMeta{Name: "g", Namespace: "y", UID: uid3}},
}
jobsBySj := groupJobsByParent(sjs, js)
@@ -267,7 +267,7 @@ func TestGetRecentUnmetScheduleTimes(t *testing.T) {
}
sj := batch.CronJob{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: "mycronjob",
Namespace: v1.NamespaceDefault,
UID: types.UID("1a2b3c"),