From 49fe9d1b413ed396aa1c755a45002f46a88b2721 Mon Sep 17 00:00:00 2001 From: Harry Zhang Date: Tue, 21 Jun 2016 22:23:37 -0400 Subject: [PATCH] Add unit test to ensure no error thrown --- plugin/pkg/admission/antiaffinity/admission_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugin/pkg/admission/antiaffinity/admission_test.go b/plugin/pkg/admission/antiaffinity/admission_test.go index bded0340b61..3073d6d81c6 100644 --- a/plugin/pkg/admission/antiaffinity/admission_test.go +++ b/plugin/pkg/admission/antiaffinity/admission_test.go @@ -200,6 +200,16 @@ func TestInterPodAffinityAdmission(t *testing.T) { }, errorExpected: true, }, + { + affinity: map[string]string{ + api.AffinityAnnotationKey: ` + {"podAntiAffinity": { + "thisIsAInvalidAffinity": [{} + }}`, + }, + // however, we should not got error here + errorExpected: false, + }, } for _, test := range tests { pod.ObjectMeta.Annotations = test.affinity