From 4e1b07d9c2a037481ea5e6b75966241459c9f5f7 Mon Sep 17 00:00:00 2001 From: Anthony Yeh Date: Mon, 6 Mar 2017 11:18:15 -0800 Subject: [PATCH] CronJob: Check ControllerRef Name and UID in unit test. --- pkg/controller/cronjob/cronjob_controller_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/controller/cronjob/cronjob_controller_test.go b/pkg/controller/cronjob/cronjob_controller_test.go index b15e4b87036..d9f9b667c3d 100644 --- a/pkg/controller/cronjob/cronjob_controller_test.go +++ b/pkg/controller/cronjob/cronjob_controller_test.go @@ -302,6 +302,12 @@ func TestSyncOne_RunOrNot(t *testing.T) { if got, want := controllerRef.Kind, "CronJob"; got != want { t.Errorf("%s: controllerRef.Kind = %q, want %q", name, got, want) } + if got, want := controllerRef.Name, sj.Name; got != want { + t.Errorf("%s: controllerRef.Name = %q, want %q", name, got, want) + } + if got, want := controllerRef.UID, sj.UID; got != want { + t.Errorf("%s: controllerRef.UID = %q, want %q", name, got, want) + } if controllerRef.Controller == nil || *controllerRef.Controller != true { t.Errorf("%s: controllerRef.Controller is not set to true", name) }