diff --git a/pkg/controller/node/nodecontroller_test.go b/pkg/controller/node/nodecontroller_test.go index 967a7e946d3..818be93f22d 100644 --- a/pkg/controller/node/nodecontroller_test.go +++ b/pkg/controller/node/nodecontroller_test.go @@ -1426,8 +1426,25 @@ func newNode(name string) *api.Node { } func newPod(name, host string) *api.Pod { - return &api.Pod{ObjectMeta: api.ObjectMeta{Name: name}, Spec: api.PodSpec{NodeName: host}, - Status: api.PodStatus{Conditions: []api.PodCondition{{Type: api.PodReady, Status: api.ConditionTrue}}}} + pod := &api.Pod{ + ObjectMeta: api.ObjectMeta{ + Namespace: "default", + Name: name, + }, + Spec: api.PodSpec{ + NodeName: host, + }, + Status: api.PodStatus{ + Conditions: []api.PodCondition{ + { + Type: api.PodReady, + Status: api.ConditionTrue, + }, + }, + }, + } + + return pod } func contains(node *api.Node, nodes []*api.Node) bool { diff --git a/pkg/controller/resourcequota/resource_quota_controller_test.go b/pkg/controller/resourcequota/resource_quota_controller_test.go index 71ef5df79b4..6fb82b9a5e4 100644 --- a/pkg/controller/resourcequota/resource_quota_controller_test.go +++ b/pkg/controller/resourcequota/resource_quota_controller_test.go @@ -162,6 +162,10 @@ func TestSyncResourceQuota(t *testing.T) { func TestSyncResourceQuotaSpecChange(t *testing.T) { resourceQuota := api.ResourceQuota{ + ObjectMeta: api.ObjectMeta{ + Namespace: "default", + Name: "rq", + }, Spec: api.ResourceQuotaSpec{ Hard: api.ResourceList{ api.ResourceCPU: resource.MustParse("4"), @@ -250,6 +254,10 @@ func TestSyncResourceQuotaSpecChange(t *testing.T) { func TestSyncResourceQuotaNoChange(t *testing.T) { resourceQuota := api.ResourceQuota{ + ObjectMeta: api.ObjectMeta{ + Namespace: "default", + Name: "rq", + }, Spec: api.ResourceQuotaSpec{ Hard: api.ResourceList{ api.ResourceCPU: resource.MustParse("4"), diff --git a/pkg/controller/serviceaccount/tokens_controller_test.go b/pkg/controller/serviceaccount/tokens_controller_test.go index 4fad2775279..3442b896dc9 100644 --- a/pkg/controller/serviceaccount/tokens_controller_test.go +++ b/pkg/controller/serviceaccount/tokens_controller_test.go @@ -223,7 +223,7 @@ func TestTokenCreation(t *testing.T) { ExpectedActions []core.Action }{ "new serviceaccount with no secrets": { - ClientObjects: []runtime.Object{serviceAccount(emptySecretReferences()), createdTokenSecret()}, + ClientObjects: []runtime.Object{serviceAccount(emptySecretReferences())}, AddedServiceAccount: serviceAccount(emptySecretReferences()), ExpectedActions: []core.Action{ @@ -233,7 +233,7 @@ func TestTokenCreation(t *testing.T) { }, }, "new serviceaccount with no secrets encountering create error": { - ClientObjects: []runtime.Object{serviceAccount(emptySecretReferences()), createdTokenSecret()}, + ClientObjects: []runtime.Object{serviceAccount(emptySecretReferences())}, MaxRetries: 10, IsAsync: true, Reactors: []reaction{{ @@ -250,7 +250,6 @@ func TestTokenCreation(t *testing.T) { } }, }}, - AddedServiceAccount: serviceAccount(emptySecretReferences()), ExpectedActions: []core.Action{ // Attempt 1 @@ -295,7 +294,7 @@ func TestTokenCreation(t *testing.T) { }, }, "new serviceaccount with missing secrets": { - ClientObjects: []runtime.Object{serviceAccount(missingSecretReferences()), createdTokenSecret()}, + ClientObjects: []runtime.Object{serviceAccount(missingSecretReferences())}, AddedServiceAccount: serviceAccount(missingSecretReferences()), ExpectedActions: []core.Action{ @@ -305,7 +304,7 @@ func TestTokenCreation(t *testing.T) { }, }, "new serviceaccount with non-token secrets": { - ClientObjects: []runtime.Object{serviceAccount(regularSecretReferences()), createdTokenSecret(), opaqueSecret()}, + ClientObjects: []runtime.Object{serviceAccount(regularSecretReferences()), opaqueSecret()}, AddedServiceAccount: serviceAccount(regularSecretReferences()), ExpectedActions: []core.Action{ @@ -329,9 +328,8 @@ func TestTokenCreation(t *testing.T) { core.NewGetAction(unversioned.GroupVersionResource{Resource: "serviceaccounts"}, api.NamespaceDefault, "default"), }, }, - "updated serviceaccount with no secrets": { - ClientObjects: []runtime.Object{serviceAccount(emptySecretReferences()), createdTokenSecret()}, + ClientObjects: []runtime.Object{serviceAccount(emptySecretReferences())}, UpdatedServiceAccount: serviceAccount(emptySecretReferences()), ExpectedActions: []core.Action{ @@ -341,7 +339,7 @@ func TestTokenCreation(t *testing.T) { }, }, "updated serviceaccount with missing secrets": { - ClientObjects: []runtime.Object{serviceAccount(missingSecretReferences()), createdTokenSecret()}, + ClientObjects: []runtime.Object{serviceAccount(missingSecretReferences())}, UpdatedServiceAccount: serviceAccount(missingSecretReferences()), ExpectedActions: []core.Action{ @@ -351,7 +349,7 @@ func TestTokenCreation(t *testing.T) { }, }, "updated serviceaccount with non-token secrets": { - ClientObjects: []runtime.Object{serviceAccount(regularSecretReferences()), createdTokenSecret(), opaqueSecret()}, + ClientObjects: []runtime.Object{serviceAccount(regularSecretReferences()), opaqueSecret()}, UpdatedServiceAccount: serviceAccount(regularSecretReferences()), ExpectedActions: []core.Action{ @@ -367,7 +365,7 @@ func TestTokenCreation(t *testing.T) { ExpectedActions: []core.Action{}, }, "updated serviceaccount with no secrets with resource conflict": { - ClientObjects: []runtime.Object{updatedServiceAccount(emptySecretReferences()), createdTokenSecret()}, + ClientObjects: []runtime.Object{updatedServiceAccount(emptySecretReferences())}, UpdatedServiceAccount: serviceAccount(emptySecretReferences()), ExpectedActions: []core.Action{ diff --git a/pkg/kubectl/describe_test.go b/pkg/kubectl/describe_test.go index 3ce344fe917..e767c125bb5 100644 --- a/pkg/kubectl/describe_test.go +++ b/pkg/kubectl/describe_test.go @@ -578,6 +578,9 @@ func TestDescribeEvents(t *testing.T) { events := &api.EventList{ Items: []api.Event{ { + ObjectMeta: api.ObjectMeta{ + Namespace: "foo", + }, Source: api.EventSource{Component: "kubelet"}, Message: "Item 1", FirstTimestamp: unversioned.NewTime(time.Date(2014, time.January, 15, 0, 0, 0, 0, time.UTC)), diff --git a/pkg/volume/configmap/configmap_test.go b/pkg/volume/configmap/configmap_test.go index cf0a54f402a..5078fc3eb95 100644 --- a/pkg/volume/configmap/configmap_test.go +++ b/pkg/volume/configmap/configmap_test.go @@ -228,7 +228,7 @@ func TestPlugin(t *testing.T) { t.Errorf("Can't find the plugin by name") } - pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: testPodUID}} + pod := &api.Pod{ObjectMeta: api.ObjectMeta{Namespace: testNamespace, UID: testPodUID}} mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{}) if err != nil { t.Errorf("Failed to make a new Mounter: %v", err) @@ -283,7 +283,7 @@ func TestPluginReboot(t *testing.T) { t.Errorf("Can't find the plugin by name") } - pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: testPodUID}} + pod := &api.Pod{ObjectMeta: api.ObjectMeta{Namespace: testNamespace, UID: testPodUID}} mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{}) if err != nil { t.Errorf("Failed to make a new Mounter: %v", err) diff --git a/pkg/volume/glusterfs/glusterfs_test.go b/pkg/volume/glusterfs/glusterfs_test.go index 524ec59da93..76939ba3657 100644 --- a/pkg/volume/glusterfs/glusterfs_test.go +++ b/pkg/volume/glusterfs/glusterfs_test.go @@ -212,7 +212,8 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { ep := &api.Endpoints{ ObjectMeta: api.ObjectMeta{ - Name: "ep", + Namespace: "nsA", + Name: "ep", }, Subsets: []api.EndpointSubset{{ Addresses: []api.EndpointAddress{{IP: "127.0.0.1"}}, @@ -228,7 +229,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { // readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes spec := volume.NewSpecFromPersistentVolume(pv, true) - pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}} + pod := &api.Pod{ObjectMeta: api.ObjectMeta{Namespace: "nsA", UID: types.UID("poduid")}} mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{}) if !mounter.GetAttributes().ReadOnly { diff --git a/pkg/volume/secret/secret_test.go b/pkg/volume/secret/secret_test.go index fff7e0bef2d..645d1e08e51 100644 --- a/pkg/volume/secret/secret_test.go +++ b/pkg/volume/secret/secret_test.go @@ -231,7 +231,7 @@ func TestPlugin(t *testing.T) { t.Errorf("Can't find the plugin by name") } - pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: testPodUID}} + pod := &api.Pod{ObjectMeta: api.ObjectMeta{Namespace: testNamespace, UID: testPodUID}} mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{}) if err != nil { t.Errorf("Failed to make a new Mounter: %v", err) @@ -304,7 +304,7 @@ func TestPluginReboot(t *testing.T) { t.Errorf("Can't find the plugin by name") } - pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: testPodUID}} + pod := &api.Pod{ObjectMeta: api.ObjectMeta{Namespace: testNamespace, UID: testPodUID}} mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{}) if err != nil { t.Errorf("Failed to make a new Mounter: %v", err) diff --git a/plugin/pkg/admission/security/podsecuritypolicy/admission_test.go b/plugin/pkg/admission/security/podsecuritypolicy/admission_test.go index 186bc9f6eb8..b875997efb4 100644 --- a/plugin/pkg/admission/security/podsecuritypolicy/admission_test.go +++ b/plugin/pkg/admission/security/podsecuritypolicy/admission_test.go @@ -1193,7 +1193,8 @@ func createNamespaceForTest() *kapi.Namespace { func createSAForTest() *kapi.ServiceAccount { return &kapi.ServiceAccount{ ObjectMeta: kapi.ObjectMeta{ - Name: "default", + Namespace: "default", + Name: "default", }, } }