@@ -593,10 +593,11 @@ func TestIsPolicyTypeManifest(t *testing.T) {
593593	t .Parallel ()
594594
595595	tests  :=  map [string ]struct  {
596- 		manifest         map [string ]interface {}
597- 		wantIsPolicy     bool 
598- 		wantIsOcmPolicy  bool 
599- 		wantErr          string 
596+ 		manifest                  map [string ]interface {}
597+ 		informGatekeeperPolicies  bool 
598+ 		wantIsPolicy              bool 
599+ 		wantIsOcmPolicy           bool 
600+ 		wantErr                   string 
600601	}{
601602		"valid RandomPolicy" : {
602603			manifest : map [string ]interface {}{
@@ -622,7 +623,33 @@ func TestIsPolicyTypeManifest(t *testing.T) {
622623			wantIsOcmPolicy : true ,
623624			wantErr :         "" ,
624625		},
625- 		"valid Gatekeeper Constraint" : {
626+ 		"valid Gatekeeper Constraint with expander" : {
627+ 			manifest : map [string ]interface {}{
628+ 				"apiVersion" : "constraints.gatekeeper.sh" ,
629+ 				"kind" :       "Foo" ,
630+ 				"metadata" : map [string ]interface {}{
631+ 					"name" : "foo" ,
632+ 				},
633+ 			},
634+ 			informGatekeeperPolicies : true ,
635+ 			wantIsPolicy :             false ,
636+ 			wantIsOcmPolicy :          false ,
637+ 			wantErr :                  "" ,
638+ 		},
639+ 		"valid Gatekeeper ConstraintTemplate with expander" : {
640+ 			manifest : map [string ]interface {}{
641+ 				"apiVersion" : "templates.gatekeeper.sh" ,
642+ 				"kind" :       "ConstraintTemplate" ,
643+ 				"metadata" : map [string ]interface {}{
644+ 					"name" : "foo" ,
645+ 				},
646+ 			},
647+ 			informGatekeeperPolicies : true ,
648+ 			wantIsPolicy :             false ,
649+ 			wantIsOcmPolicy :          false ,
650+ 			wantErr :                  "" ,
651+ 		},
652+ 		"valid Gatekeeper Constraint without expander" : {
626653			manifest : map [string ]interface {}{
627654				"apiVersion" : "constraints.gatekeeper.sh" ,
628655				"kind" :       "Foo" ,
@@ -634,7 +661,7 @@ func TestIsPolicyTypeManifest(t *testing.T) {
634661			wantIsOcmPolicy : false ,
635662			wantErr :         "" ,
636663		},
637- 		"valid Gatekeeper ConstraintTemplate" : {
664+ 		"valid Gatekeeper ConstraintTemplate without expander " : {
638665			manifest : map [string ]interface {}{
639666				"apiVersion" : "templates.gatekeeper.sh" ,
640667				"kind" :       "ConstraintTemplate" ,
@@ -738,7 +765,7 @@ func TestIsPolicyTypeManifest(t *testing.T) {
738765		t .Run (name , func (t  * testing.T ) {
739766			t .Parallel ()
740767
741- 			gotIsPolicy , gotIsOcmPolicy , gotErr  :=  isPolicyTypeManifest (test .manifest )
768+ 			gotIsPolicy , gotIsOcmPolicy , gotErr  :=  isPolicyTypeManifest (test .manifest ,  test . informGatekeeperPolicies )
742769			if  gotErr  !=  nil  {
743770				assertEqual (t , gotErr .Error (), test .wantErr )
744771			}
0 commit comments