@@ -84,13 +84,14 @@ func TestKeycloakContainerImage(t *testing.T) {
84
84
85
85
defer removeTemplateAPI ()
86
86
tests := []struct {
87
- name string
88
- setEnvVarFunc func (* testing.T , string )
89
- envVar string
90
- argoCD * argoproj.ArgoCD
91
- updateCrFunc func (cr * argoproj.ArgoCD )
92
- templateAPIFound bool
93
- wantContainerImage string
87
+ name string
88
+ setEnvVarFunc func (* testing.T , string )
89
+ envVar string
90
+ argoCD * argoproj.ArgoCD
91
+ updateCrFunc func (cr * argoproj.ArgoCD )
92
+ templateAPIFound bool
93
+ deploymentConfigAPIFound bool
94
+ wantContainerImage string
94
95
}{
95
96
{
96
97
name : "no .spec.sso, no ArgoCDKeycloakImageEnvName env var set" ,
@@ -101,9 +102,10 @@ func TestKeycloakContainerImage(t *testing.T) {
101
102
Provider : argoproj .SSOProviderTypeKeycloak ,
102
103
}
103
104
}),
104
- updateCrFunc : nil ,
105
- templateAPIFound : false ,
106
- wantContainerImage : "quay.io/keycloak/keycloak@sha256:64fb81886fde61dee55091e6033481fa5ccdac62ae30a4fd29b54eb5e97df6a9" ,
105
+ updateCrFunc : nil ,
106
+ templateAPIFound : false ,
107
+ deploymentConfigAPIFound : false ,
108
+ wantContainerImage : "quay.io/keycloak/keycloak@sha256:64fb81886fde61dee55091e6033481fa5ccdac62ae30a4fd29b54eb5e97df6a9" ,
107
109
},
108
110
{
109
111
name : "no .spec.sso, no ArgoCDKeycloakImageEnvName env var set - for OCP" ,
@@ -114,9 +116,10 @@ func TestKeycloakContainerImage(t *testing.T) {
114
116
Provider : argoproj .SSOProviderTypeKeycloak ,
115
117
}
116
118
}),
117
- updateCrFunc : nil ,
118
- templateAPIFound : true ,
119
- wantContainerImage : "registry.redhat.io/rh-sso-7/sso76-openshift-rhel8@sha256:ec9f60018694dcc5d431ba47d5536b761b71cb3f66684978fe6bb74c157679ac" ,
119
+ updateCrFunc : nil ,
120
+ templateAPIFound : true ,
121
+ deploymentConfigAPIFound : true ,
122
+ wantContainerImage : "registry.redhat.io/rh-sso-7/sso76-openshift-rhel8@sha256:ec9f60018694dcc5d431ba47d5536b761b71cb3f66684978fe6bb74c157679ac" ,
120
123
},
121
124
{
122
125
name : "ArgoCDKeycloakImageEnvName env var set" ,
@@ -129,9 +132,10 @@ func TestKeycloakContainerImage(t *testing.T) {
129
132
Provider : argoproj .SSOProviderTypeKeycloak ,
130
133
}
131
134
}),
132
- updateCrFunc : nil ,
133
- templateAPIFound : true ,
134
- wantContainerImage : "envImage:latest" ,
135
+ updateCrFunc : nil ,
136
+ templateAPIFound : true ,
137
+ deploymentConfigAPIFound : true ,
138
+ wantContainerImage : "envImage:latest" ,
135
139
},
136
140
{
137
141
name : "both cr.spec.sso.keycloak.Image and ArgoCDKeycloakImageEnvName are set" ,
@@ -153,14 +157,16 @@ func TestKeycloakContainerImage(t *testing.T) {
153
157
},
154
158
}
155
159
},
156
- templateAPIFound : true ,
157
- wantContainerImage : "crImage:crVersion" ,
160
+ templateAPIFound : true ,
161
+ deploymentConfigAPIFound : true ,
162
+ wantContainerImage : "crImage:crVersion" ,
158
163
},
159
164
}
160
165
161
166
for _ , test := range tests {
162
167
t .Run (test .name , func (t * testing.T ) {
163
168
templateAPIFound = test .templateAPIFound
169
+ deploymentConfigAPIFound = test .deploymentConfigAPIFound
164
170
165
171
if test .setEnvVarFunc != nil {
166
172
test .setEnvVarFunc (t , test .envVar )
@@ -244,6 +250,8 @@ func TestNewKeycloakTemplate_testKeycloakContainer(t *testing.T) {
244
250
// For OpenShift Container Platform.
245
251
t .Setenv (common .ArgoCDKeycloakImageEnvName , "" )
246
252
templateAPIFound = true
253
+ deploymentConfigAPIFound = true
254
+
247
255
defer removeTemplateAPI ()
248
256
249
257
a := makeTestArgoCD ()
@@ -496,4 +504,5 @@ func TestKeycloak_NodeLabelSelector(t *testing.T) {
496
504
497
505
func removeTemplateAPI () {
498
506
templateAPIFound = false
507
+ deploymentConfigAPIFound = false
499
508
}
0 commit comments