@@ -48,16 +48,22 @@ func init() {
4848var  OIDCTest  =  suite.ConformanceTest {
4949	ShortName :   "OIDC" ,
5050	Description : "Test OIDC authentication" ,
51- 	Manifests :   []string {"testdata/oidc-keycloak.yaml" ,  "testdata/oidc-securitypolicy.yaml" },
51+ 	Manifests :   []string {"testdata/oidc-keycloak.yaml" },
5252	Test : func (t  * testing.T , suite  * suite.ConformanceTestSuite ) {
5353		t .Run ("oidc provider represented by a URL" , func (t  * testing.T ) {
54- 			testOIDC (t , suite )
54+ 			testOIDC (t , suite ,  "testdata/oidc-securitypolicy.yaml" )
5555		})
5656
5757		t .Run ("oidc bypass" , func (t  * testing.T ) {
5858			ns  :=  "gateway-conformance-infra" 
59+ 
60+ 			podInitialized  :=  corev1.PodCondition {Type : corev1 .PodInitialized , Status : corev1 .ConditionTrue }
5961			// Wait for the keycloak pod to be configured with the test user and client 
60- 			WaitForPods (t , suite .Client , ns , map [string ]string {"app" : "keycloak" }, corev1 .PodRunning , & PodReady )
62+ 			WaitForPods (t , suite .Client , ns , map [string ]string {"job-name" : "setup-keycloak" }, corev1 .PodSucceeded , & podInitialized )
63+ 
64+ 			// Apply the security policy that configures OIDC authentication 
65+ 			suite .Applier .MustApplyWithCleanup (t , suite .Client , suite .TimeoutConfig , "testdata/oidc-securitypolicy.yaml" , true )
66+ 
6167			routeWithOIDCNN  :=  types.NamespacedName {Name : "http-with-oidc" , Namespace : ns }
6268			routeWithoutOIDCNN  :=  types.NamespacedName {Name : "http-without-oidc" , Namespace : ns }
6369			gwNN  :=  types.NamespacedName {Name : "same-namespace" , Namespace : ns }
@@ -112,7 +118,7 @@ var OIDCTest = suite.ConformanceTest{
112118	},
113119}
114120
115- func  testOIDC (t  * testing.T , suite  * suite.ConformanceTestSuite ) {
121+ func  testOIDC (t  * testing.T , suite  * suite.ConformanceTestSuite ,  securityPolicyManifest   string ) {
116122	var  (
117123		testURL    =  "http://www.example.com/myapp" 
118124		logoutURL  =  "http://www.example.com/myapp/logout" 
@@ -121,8 +127,12 @@ func testOIDC(t *testing.T, suite *suite.ConformanceTestSuite) {
121127		ns         =  "gateway-conformance-infra" 
122128	)
123129
130+ 	podInitialized  :=  corev1.PodCondition {Type : corev1 .PodInitialized , Status : corev1 .ConditionTrue }
124131	// Wait for the keycloak pod to be configured with the test user and client 
125- 	WaitForPods (t , suite .Client , ns , map [string ]string {"app" : "keycloak" }, corev1 .PodRunning , & PodReady )
132+ 	WaitForPods (t , suite .Client , ns , map [string ]string {"job-name" : "setup-keycloak" }, corev1 .PodSucceeded , & podInitialized )
133+ 
134+ 	// Apply the security policy that configures OIDC authentication 
135+ 	suite .Applier .MustApplyWithCleanup (t , suite .Client , suite .TimeoutConfig , securityPolicyManifest , true )
126136
127137	routeNN  :=  types.NamespacedName {Name : route , Namespace : ns }
128138	gwNN  :=  types.NamespacedName {Name : "same-namespace" , Namespace : ns }
@@ -179,6 +189,7 @@ func testOIDC(t *testing.T, suite *suite.ConformanceTestSuite) {
179189					},
180190				}
181191				require .NoError (t , suite .Client .Delete (context .TODO (), existingSP ))
192+ 				suite .Applier .MustApplyWithCleanup (t , suite .Client , suite .TimeoutConfig , securityPolicyManifest , false )
182193				SecurityPolicyMustBeAccepted (t , suite .Client , types.NamespacedName {Name : sp , Namespace : ns }, suite .ControllerName , ancestorRef )
183194				return  false , nil 
184195			}
0 commit comments