4
4
5
5
package oracle .kubernetes .operator ;
6
6
7
+ import java .nio .file .Files ;
8
+ import java .nio .file .Paths ;
7
9
import java .util .Map ;
8
10
import oracle .kubernetes .operator .utils .Domain ;
9
11
import oracle .kubernetes .operator .utils .Operator ;
@@ -85,10 +87,10 @@ public void testServerPodsRestartByChangingEnvProperty() throws Exception {
85
87
logTestBegin (testMethodName );
86
88
87
89
logger .info (
88
- "About to testDomainServerPodRestart for Domain: "
90
+ "About to verifyDomainServerPodRestart for Domain: "
89
91
+ domain .getDomainUid ()
90
92
+ " env property: StdoutDebugEnabled=false to StdoutDebugEnabled=true" );
91
- domain .testDomainServerPodRestart (
93
+ domain .verifyDomainServerPodRestart (
92
94
"\" -Dweblogic.StdoutDebugEnabled=false\" " , "\" -Dweblogic.StdoutDebugEnabled=true\" " );
93
95
94
96
logger .info ("SUCCESS - " + testMethodName );
@@ -108,10 +110,10 @@ public void testServerPodsRestartByChangingLogHomeEnabled() throws Exception {
108
110
logTestBegin (testMethodName );
109
111
110
112
logger .info (
111
- "About to testDomainServerPodRestart for Domain: "
113
+ "About to verifyDomainServerPodRestart for Domain: "
112
114
+ domain .getDomainUid ()
113
115
+ " logHomeEnabled: true --> logHomeEnabled: false" );
114
- domain .testDomainServerPodRestart ("logHomeEnabled: true" , "logHomeEnabled: false" );
116
+ domain .verifyDomainServerPodRestart ("logHomeEnabled: true" , "logHomeEnabled: false" );
115
117
116
118
logger .info ("SUCCESS - " + testMethodName );
117
119
}
@@ -130,10 +132,10 @@ public void testServerPodsRestartByChangingImagePullPolicy() throws Exception {
130
132
logTestBegin (testMethodName );
131
133
132
134
logger .info (
133
- "About to testDomainServerPodRestart for Domain: "
135
+ "About to verifyDomainServerPodRestart for Domain: "
134
136
+ domain .getDomainUid ()
135
137
+ " imagePullPolicy: IfNotPresent --> imagePullPolicy: Never " );
136
- domain .testDomainServerPodRestart (
138
+ domain .verifyDomainServerPodRestart (
137
139
"imagePullPolicy: \" IfNotPresent\" " , "imagePullPolicy: \" Never\" " );
138
140
139
141
logger .info ("SUCCESS - " + testMethodName );
@@ -153,10 +155,10 @@ public void testServerPodsRestartByChangingIncludeServerOutInPodLog() throws Exc
153
155
logTestBegin (testMethodName );
154
156
155
157
logger .info (
156
- "About to testDomainServerPodRestart for Domain: "
158
+ "About to verifyDomainServerPodRestart for Domain: "
157
159
+ domain .getDomainUid ()
158
160
+ " includeServerOutInPodLog: true --> includeServerOutInPodLog: false" );
159
- domain .testDomainServerPodRestart (
161
+ domain .verifyDomainServerPodRestart (
160
162
"includeServerOutInPodLog: true" , "includeServerOutInPodLog: false" );
161
163
162
164
logger .info ("SUCCESS - " + testMethodName );
@@ -177,12 +179,12 @@ public void testServerPodsRestartByChangingZImage() throws Exception {
177
179
178
180
try {
179
181
logger .info (
180
- "About to testDomainServerPodRestart for Domain: "
182
+ "About to verifyDomainServerPodRestart for Domain: "
181
183
+ domain .getDomainUid ()
182
184
+ " Image property: store/oracle/weblogic:12.2.1.3 to store/oracle/weblogic:duplicate" );
183
185
184
186
TestUtils .exec ("docker tag store/oracle/weblogic:12.2.1.3 store/oracle/weblogic:duplicate" );
185
- domain .testDomainServerPodRestart (
187
+ domain .verifyDomainServerPodRestart (
186
188
"\" store/oracle/weblogic:12.2.1.3\" " , "\" store/oracle/weblogic:duplicate\" " );
187
189
} finally {
188
190
TestUtils .exec ("docker rmi -f store/oracle/weblogic:duplicate" );
@@ -209,18 +211,19 @@ public void testServerPodsRestartByChangingContSecurityContext() throws Exceptio
209
211
// firstly ensure that original domain.yaml doesn't include the property-to-be-added
210
212
String domainFileName =
211
213
BaseTest .getUserProjectsDir () + "/weblogic-domains/" + domainUid + "/domain.yaml" ;
212
- boolean result = TestUtils .checkFileIncludeProperty ("fsGroup: 1000" , domainFileName );
214
+ boolean result =
215
+ (new String (Files .readAllBytes (Paths .get (domainFileName )))).contains ("fsGroup: 1000" );
213
216
Assert .assertFalse (result );
214
217
215
218
// domainYaml: the yaml file name with changed property under resources dir
216
219
String domainYaml = "cont.security.context.domain.yaml" ;
217
220
logger .info (
218
- "About to testDomainServerPodRestart for Domain: "
221
+ "About to verifyDomainServerPodRestart for Domain: "
219
222
+ domain .getDomainUid ()
220
223
+ " change container securityContext:\n "
221
224
+ " runAsUser: 1000\n "
222
225
+ " fsGroup: 1000 " );
223
- domain .testDomainServerPodRestart (domainYaml );
226
+ domain .verifyDomainServerPodRestart (domainYaml );
224
227
domain .findServerPropertyChange ("securityContext" , "admin-server" );
225
228
domain .findServerPropertyChange ("securityContext" , "managed-server1" );
226
229
@@ -245,19 +248,20 @@ public void testServerPodsRestartByChangingPodSecurityContext() throws Exception
245
248
// firstly ensure that original domain.yaml doesn't include the property-to-be-added
246
249
String domainFileName =
247
250
BaseTest .getUserProjectsDir () + "/weblogic-domains/" + domainUid + "/domain.yaml" ;
248
- boolean result = TestUtils .checkFileIncludeProperty ("fsGroup: 2000" , domainFileName );
251
+ boolean result =
252
+ (new String (Files .readAllBytes (Paths .get (domainFileName )))).contains ("fsGroup: 2000" );
249
253
Assert .assertFalse (result );
250
254
251
255
// domainYaml: the yaml file name with changed property under resources dir
252
256
String domainYaml = "pod.security.context.domain.yaml" ;
253
257
254
258
logger .info (
255
- "About to testDomainServerPodRestart for Domain: "
259
+ "About to verifyDomainServerPodRestart for Domain: "
256
260
+ domain .getDomainUid ()
257
261
+ " change securityContext:\n "
258
262
+ " runAsUser: 1000\n "
259
263
+ " fsGroup: 2000 " );
260
- domain .testDomainServerPodRestart (domainYaml );
264
+ domain .verifyDomainServerPodRestart (domainYaml );
261
265
domain .findServerPropertyChange ("fsGroup: 2000" , "admin-server" );
262
266
domain .findServerPropertyChange ("fsGroup: 2000" , "managed-server1" );
263
267
@@ -282,18 +286,19 @@ public void testServerPodsRestartByChangingResource() throws Exception {
282
286
// firstly ensure that original domain.yaml doesn't include the property-to-be-addeded
283
287
String domainFileName =
284
288
BaseTest .getUserProjectsDir () + "/weblogic-domains/" + domainUid + "/domain.yaml" ;
285
- boolean result = TestUtils .checkFileIncludeProperty ("cpu: 500m" , domainFileName );
289
+ boolean result =
290
+ (new String (Files .readAllBytes (Paths .get (domainFileName )))).contains ("cpu: 500m" );
286
291
Assert .assertFalse (result );
287
292
288
293
// domainYaml: the yaml file name with changed property under resources dir
289
294
String domainYaml = "resource.domain.yaml" ;
290
295
291
296
logger .info (
292
- "About to testDomainServerPodRestart for Domain: "
297
+ "About to verifyDomainServerPodRestart for Domain: "
293
298
+ domain .getDomainUid ()
294
299
+ " change resource:\n "
295
300
+ " cpu: 500m" );
296
- domain .testDomainServerPodRestart (domainYaml );
301
+ domain .verifyDomainServerPodRestart (domainYaml );
297
302
domain .findServerPropertyChange ("cpu: 500m" , "admin-server" );
298
303
domain .findServerPropertyChange ("cpu: 500m" , "managed-server1" );
299
304
0 commit comments