@@ -340,14 +340,6 @@ func TestMetrics(t *testing.T) {
340340}
341341
342342func TestPods (t * testing.T ) {
343- updatedPod := & corev1.Pod {
344- ObjectMeta : metav1.ObjectMeta {
345- Name : "pod1" ,
346- },
347- Spec : corev1.PodSpec {
348- NodeName : "node-1" ,
349- },
350- }
351343 tests := []struct {
352344 name string
353345 op func (ctx context.Context , ds Datastore )
@@ -371,40 +363,19 @@ func TestPods(t *testing.T) {
371363 },
372364 },
373365 {
374- name : "Update existing pod, new field, should update" ,
375- existingPods : []* corev1.Pod {pod1 },
376- wantPods : []* corev1.Pod {updatedPod },
377- op : func (ctx context.Context , ds Datastore ) {
378- ds .PodUpdateOrAddIfNotExist (updatedPod )
379- },
380- },
381- {
382- name : "Update existing pod, no new fields, should not update" ,
383- existingPods : []* corev1.Pod {pod1 },
366+ name : "Delete the pod" ,
367+ existingPods : []* corev1.Pod {pod1 , pod2 },
384368 wantPods : []* corev1.Pod {pod1 },
385369 op : func (ctx context.Context , ds Datastore ) {
386- incoming := & corev1.Pod {
387- ObjectMeta : metav1.ObjectMeta {
388- Name : "pod1" ,
389- Namespace : "default" ,
390- },
391- }
392- ds .PodUpdateOrAddIfNotExist (incoming )
393- },
394- },
395- {
396- name : "Delete the pod" ,
397- wantPods : []* corev1.Pod {pod1 },
398- op : func (ctx context.Context , ds Datastore ) {
399- ds .PodDelete (pod2NamespacedName )
370+ ds .PodRemove (pod2 .Name )
400371 },
401372 },
402373 {
403374 name : "Delete the pod that doesn't exist" ,
404375 existingPods : []* corev1.Pod {pod1 },
405376 wantPods : []* corev1.Pod {pod1 },
406377 op : func (ctx context.Context , ds Datastore ) {
407- ds .PodDelete ( pod2NamespacedName )
378+ ds .PodRemove ( pod2 . Name )
408379 },
409380 },
410381 }
0 commit comments