1
- // Copyright (c) 2023, Oracle and/or its affiliates.
1
+ // Copyright (c) 2023, 2024, Oracle and/or its affiliates.
2
2
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
3
3
4
4
package oracle .weblogic .kubernetes ;
5
5
6
6
import java .util .HashMap ;
7
7
import java .util .List ;
8
8
import java .util .Map ;
9
+ import java .util .concurrent .Callable ;
9
10
10
11
import oracle .weblogic .kubernetes .actions .impl .UniqueName ;
11
12
import oracle .weblogic .kubernetes .actions .impl .primitive .Command ;
54
55
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .backupReports ;
55
56
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .getUniqueName ;
56
57
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .restoreReports ;
58
+ import static oracle .weblogic .kubernetes .utils .CommonTestUtils .testUntil ;
59
+ import static oracle .weblogic .kubernetes .utils .CommonTestUtils .withLongRetryPolicy ;
57
60
import static oracle .weblogic .kubernetes .utils .ImageUtils .createBaseRepoSecret ;
58
61
import static oracle .weblogic .kubernetes .utils .ImageUtils .createTestRepoSecret ;
59
62
import static oracle .weblogic .kubernetes .utils .SampleUtils .createPVHostPathAndChangePermissionInKindCluster ;
60
63
import static oracle .weblogic .kubernetes .utils .ThreadSafeLogger .getLogger ;
61
64
import static org .junit .jupiter .api .Assertions .assertNotNull ;
62
- import static org .junit .jupiter .api .Assertions .assertTrue ;
63
65
64
66
/**
65
67
* Test and verify Domain on PV FMW domain sample.
@@ -248,16 +250,21 @@ public void testInitialMain() {
248
250
createPVHostPathAndChangePermissionInKindCluster ("/shared" , envMap );
249
251
}
250
252
251
- execTestScriptAndAssertSuccess ("-initial-main" , "Failed to run -initial-main" );
253
+ testUntil (
254
+ withLongRetryPolicy ,
255
+ checkTestScriptAndAssertSuccess ("-initial-main" , "Failed to run -initial-main" ),
256
+ logger ,
257
+ "create PV HostPath and change Permission in Kind Cluster" );
258
+
252
259
}
253
260
254
261
/**
255
262
* Run script run-test.sh.
256
263
* @param arg arguments to execute script
257
264
* @param errString a string of detailed error
258
265
*/
259
- private void execTestScriptAndAssertSuccess (String arg ,
260
- String errString ) {
266
+ private boolean execTestScriptAndAssertSuccess (String arg ,
267
+ String errString ) {
261
268
262
269
Assumptions .assumeTrue (previousTestSuccessful );
263
270
previousTestSuccessful = false ;
@@ -284,9 +291,15 @@ private void execTestScriptAndAssertSuccess(String arg,
284
291
outStr += ", stderr=\n {\n " + (result != null ? result .stderr () : "" ) + "\n }\n " ;
285
292
outStr += ", stdout=\n {\n " + (result != null ? result .stdout () : "" ) + "\n }\n " ;
286
293
287
- assertTrue ( success , outStr );
294
+ logger . info ( "output String is: {0}" , outStr );
288
295
289
296
previousTestSuccessful = true ;
297
+
298
+ return success ;
299
+ }
300
+
301
+ private Callable <Boolean > checkTestScriptAndAssertSuccess (String arg , String errString ) {
302
+ return () -> execTestScriptAndAssertSuccess (arg , errString );
290
303
}
291
304
292
305
/**
0 commit comments