File tree Expand file tree Collapse file tree 3 files changed +42
-0
lines changed
integration-tests/src/test/java/oracle/weblogic/kubernetes Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 5050import static oracle .weblogic .kubernetes .utils .CommonTestUtils .getUniqueName ;
5151import static oracle .weblogic .kubernetes .utils .ImageUtils .createBaseRepoSecret ;
5252import static oracle .weblogic .kubernetes .utils .ImageUtils .createTestRepoSecret ;
53+ import static oracle .weblogic .kubernetes .utils .SampleUtils .createPVHostPathAndChangePermissionInKindCluster ;
5354import static oracle .weblogic .kubernetes .utils .ThreadSafeLogger .getLogger ;
5455import static org .junit .jupiter .api .Assertions .assertNotNull ;
5556import static org .junit .jupiter .api .Assertions .assertTrue ;
@@ -232,6 +233,7 @@ public void testInitialMain() {
232233 if (KIND_REPO != null ) {
233234 logger .info ("loading image {0} to kind" , FMWINFRA_IMAGE_TO_USE_IN_SPEC );
234235 imagePush (FMWINFRA_IMAGE_TO_USE_IN_SPEC );
236+ createPVHostPathAndChangePermissionInKindCluster ("/shared" , envMap );
235237 }
236238
237239 execTestScriptAndAssertSuccess ("-initial-main" , "Failed to run -initial-main" );
Original file line number Diff line number Diff line change 4848import static oracle .weblogic .kubernetes .utils .CommonTestUtils .getUniqueName ;
4949import static oracle .weblogic .kubernetes .utils .ImageUtils .createBaseRepoSecret ;
5050import static oracle .weblogic .kubernetes .utils .ImageUtils .createTestRepoSecret ;
51+ import static oracle .weblogic .kubernetes .utils .SampleUtils .createPVHostPathAndChangePermissionInKindCluster ;
5152import static oracle .weblogic .kubernetes .utils .ThreadSafeLogger .getLogger ;
5253import static org .junit .jupiter .api .Assertions .assertNotNull ;
5354import static org .junit .jupiter .api .Assertions .assertTrue ;
@@ -191,6 +192,7 @@ public void testInitialMain() {
191192 if (KIND_REPO != null ) {
192193 logger .info ("loading image {0} to kind" , WEBLOGIC_IMAGE_TO_USE_IN_SPEC );
193194 imagePush (WEBLOGIC_IMAGE_TO_USE_IN_SPEC );
195+ createPVHostPathAndChangePermissionInKindCluster ("/shared" , envMap );
194196 }
195197
196198 execTestScriptAndAssertSuccess ("-initial-main" , "Failed to run -initial-main" );
Original file line number Diff line number Diff line change 1+ // Copyright (c) 2023, Oracle and/or its affiliates.
2+ // Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
3+
4+ package oracle .weblogic .kubernetes .utils ;
5+
6+ import java .util .Map ;
7+
8+ import oracle .weblogic .kubernetes .actions .impl .primitive .Command ;
9+ import oracle .weblogic .kubernetes .actions .impl .primitive .CommandParams ;
10+
11+ import static oracle .weblogic .kubernetes .TestConstants .WLSIMG_BUILDER_DEFAULT ;
12+
13+ /**
14+ * The Sample utility class for tests.
15+ */
16+ public class SampleUtils {
17+
18+ /**
19+ * Create PV hostPath and change permission in Kind cluster.
20+ * @param hostPath - hostPath for PV
21+ * @param envMap - envMap for running the docker command
22+ */
23+ public static void createPVHostPathAndChangePermissionInKindCluster (String hostPath , Map <String , String > envMap ) {
24+ String command = WLSIMG_BUILDER_DEFAULT
25+ + " exec kind-worker sh -c \" mkdir "
26+ + hostPath
27+ + " && chmod g+w "
28+ + hostPath
29+ + "\" " ;
30+
31+ Command .withParams (
32+ new CommandParams ()
33+ .command (command )
34+ .env (envMap )
35+ .redirect (true )
36+ ).execute ();
37+ }
38+ }
You can’t perform that action at this time.
0 commit comments