77import java .nio .file .Files ;
88import java .nio .file .Path ;
99import java .nio .file .Paths ;
10+ import java .util .ArrayList ;
1011import java .util .HashMap ;
1112import java .util .List ;
1213import java .util .Map ;
2829import oracle .weblogic .kubernetes .annotations .Namespaces ;
2930import oracle .weblogic .kubernetes .logging .LoggingFacade ;
3031import oracle .weblogic .kubernetes .utils .BuildApplication ;
32+ import oracle .weblogic .kubernetes .utils .ExecCommand ;
3133import oracle .weblogic .kubernetes .utils .ExecResult ;
3234import org .junit .jupiter .api .BeforeAll ;
3335import org .junit .jupiter .api .DisplayName ;
3941import static oracle .weblogic .kubernetes .TestConstants .DOMAIN_API_VERSION ;
4042import static oracle .weblogic .kubernetes .TestConstants .IMAGE_PULL_POLICY ;
4143import static oracle .weblogic .kubernetes .TestConstants .INGRESS_CLASS_FILE_NAME ;
44+ import static oracle .weblogic .kubernetes .TestConstants .KUBERNETES_CLI ;
4245import static oracle .weblogic .kubernetes .TestConstants .MANAGED_SERVER_NAME_BASE ;
4346import static oracle .weblogic .kubernetes .TestConstants .OKD ;
47+ import static oracle .weblogic .kubernetes .TestConstants .OKE_CLUSTER ;
4448import static oracle .weblogic .kubernetes .TestConstants .TEST_IMAGES_REPO_SECRET_NAME ;
4549import static oracle .weblogic .kubernetes .TestConstants .TRAEFIK_INGRESS_HTTP_HOSTPORT ;
4650import static oracle .weblogic .kubernetes .actions .ActionConstants .APP_DIR ;
7478@ IntegrationTest
7579@ Tag ("kind-parallel" )
7680@ Tag ("okd-wls-mrg" )
77- @ Tag ("oke-sequential1 " )
81+ @ Tag ("oke-gate " )
7882class ItManagedCoherence {
7983
8084 // constants for Coherence
@@ -129,10 +133,15 @@ public static void init(@Namespaces(3) List<String> namespaces) {
129133 assertNotNull (namespaces .get (2 ), "Namespace list is null" );
130134 domainNamespace = namespaces .get (2 );
131135
136+ String nodePortValue = null ;
137+ if (!OKE_CLUSTER ) {
138+ nodePortValue = "NodePort" ;
139+ }
140+
132141 // install and verify Traefik if not running on OKD
133142 if (!OKD || (TestConstants .KIND_CLUSTER
134143 && TestConstants .WLSIMG_BUILDER .equals (TestConstants .WLSIMG_BUILDER_DEFAULT ))) {
135- traefikParams = installAndVerifyTraefik (traefikNamespace , 0 , 0 , "NodePort" );
144+ traefikParams = installAndVerifyTraefik (traefikNamespace , 0 , 0 , nodePortValue );
136145 traefikHelmParams = traefikParams .getHelmParams ();
137146 }
138147
@@ -165,6 +174,16 @@ void testMultiClusterCoherenceDomain() throws IOException {
165174 // create and verify a two-cluster WebLogic domain with a Coherence cluster
166175 createAndVerifyDomain (domImage );
167176
177+ String command = KUBERNETES_CLI + " get all --all-namespaces" ;
178+ logger .info ("curl command to get all --all-namespaces is: {0}" , command );
179+
180+ try {
181+ ExecResult result0 = ExecCommand .exec (command , true );
182+ logger .info ("result is: {0}" , result0 .toString ());
183+ } catch (IOException | InterruptedException ex ) {
184+ ex .printStackTrace ();
185+ }
186+
168187 if (OKD ) {
169188 String cluster1HostName = domainUid + "-cluster-cluster-1" ;
170189 final String cluster1IngressHost = createRouteForOKD (cluster1HostName , domainNamespace );
@@ -174,12 +193,12 @@ void testMultiClusterCoherenceDomain() throws IOException {
174193 -> coherenceCacheTest (cluster1IngressHost , 0 ), "Test Coherence cache failed" );
175194 assertTrue (testCompletedSuccessfully , "Test Coherence cache failed" );
176195 } else {
177-
178196 Map <String , Integer > clusterNameMsPortMap = new HashMap <>();
179197 for (int i = 1 ; i <= NUMBER_OF_CLUSTERS ; i ++) {
180198 clusterNameMsPortMap .put (CLUSTER_NAME_PREFIX + i , MANAGED_SERVER_PORT );
181199 }
182- String hostHeader = domainUid + "." + domainNamespace + ".cluster-1.test" ;
200+
201+ String clusterHostname = domainUid + "." + domainNamespace + ".cluster-1.test" ;
183202 String hostAndPort ;
184203 int ingressServiceNodePort ;
185204 if (TestConstants .KIND_CLUSTER
@@ -191,10 +210,12 @@ void testMultiClusterCoherenceDomain() throws IOException {
191210 hostAndPort = "localhost:" + TRAEFIK_INGRESS_HTTP_HOSTPORT ;
192211 ingressServiceNodePort = TRAEFIK_INGRESS_HTTP_HOSTPORT ;
193212 } else {
194- // clusterNameMsPortMap.put(clusterName, managedServerPort);
213+ List <String > domainUids = new ArrayList <>();
214+ domainUids .add (domainUid );
215+
195216 logger .info ("Creating ingress for domain {0} in namespace {1}" , domainUid , domainNamespace );
196- createTraefikIngressForDomainAndVerify (domainUid , domainNamespace , 0 , clusterNameMsPortMap , true , null ,
197- traefikParams .getIngressClassName ());
217+ createTraefikIngressForDomainAndVerify (domainUid , domainNamespace , 0 ,
218+ clusterNameMsPortMap , true , null , traefikParams .getIngressClassName ());
198219
199220 // get ingress service Name and Nodeport
200221 String ingressServiceName = traefikHelmParams .getReleaseName ();
@@ -207,13 +228,13 @@ void testMultiClusterCoherenceDomain() throws IOException {
207228
208229 hostAndPort = getServiceExtIPAddrtOke (ingressServiceName , traefikNamespace ) != null
209230 ? getServiceExtIPAddrtOke (ingressServiceName , traefikNamespace )
210- : getHostAndPort (hostHeader , ingressServiceNodePort );
231+ : getHostAndPort (clusterHostname , ingressServiceNodePort );
211232 }
212233
213- assertTrue (checkCoheranceApp (hostAndPort , hostHeader ), "Failed to access Coherance Application" );
234+ assertTrue (checkCoheranceApp (hostAndPort , clusterHostname ), "Failed to access Coherance Application" );
214235 // test adding data to the cache and retrieving them from the cache
215236 boolean testCompletedSuccessfully = assertDoesNotThrow (()
216- -> coherenceCacheTest (hostHeader , ingressServiceNodePort ), "Test Coherence cache failed" );
237+ -> coherenceCacheTest (clusterHostname , ingressServiceNodePort ), "Test Coherence cache failed" );
217238 assertTrue (testCompletedSuccessfully , "Test Coherence cache failed" );
218239 }
219240 }
@@ -486,7 +507,6 @@ private ExecResult clearCache(String hostName, String hostAndPort) {
486507 }
487508
488509 private boolean checkCoheranceApp (String hostAndPort , String hostHeader ) {
489-
490510 StringBuffer curlCmd = new StringBuffer ("curl -g --silent --show-error --noproxy '*' " );
491511 curlCmd
492512 .append ("-d 'action=clear' " )
@@ -509,5 +529,4 @@ private boolean checkCoheranceApp(String hostAndPort, String hostHeader) {
509529 curlCmd );
510530 return true ;
511531 }
512-
513532}
0 commit comments