7
7
import java .nio .file .Files ;
8
8
import java .nio .file .Path ;
9
9
import java .nio .file .Paths ;
10
+ import java .util .ArrayList ;
10
11
import java .util .HashMap ;
11
12
import java .util .List ;
12
13
import java .util .Map ;
28
29
import oracle .weblogic .kubernetes .annotations .Namespaces ;
29
30
import oracle .weblogic .kubernetes .logging .LoggingFacade ;
30
31
import oracle .weblogic .kubernetes .utils .BuildApplication ;
32
+ import oracle .weblogic .kubernetes .utils .ExecCommand ;
31
33
import oracle .weblogic .kubernetes .utils .ExecResult ;
32
34
import org .junit .jupiter .api .BeforeAll ;
33
35
import org .junit .jupiter .api .DisplayName ;
39
41
import static oracle .weblogic .kubernetes .TestConstants .DOMAIN_API_VERSION ;
40
42
import static oracle .weblogic .kubernetes .TestConstants .IMAGE_PULL_POLICY ;
41
43
import static oracle .weblogic .kubernetes .TestConstants .INGRESS_CLASS_FILE_NAME ;
44
+ import static oracle .weblogic .kubernetes .TestConstants .KUBERNETES_CLI ;
42
45
import static oracle .weblogic .kubernetes .TestConstants .MANAGED_SERVER_NAME_BASE ;
43
46
import static oracle .weblogic .kubernetes .TestConstants .OKD ;
47
+ import static oracle .weblogic .kubernetes .TestConstants .OKE_CLUSTER ;
44
48
import static oracle .weblogic .kubernetes .TestConstants .TEST_IMAGES_REPO_SECRET_NAME ;
45
49
import static oracle .weblogic .kubernetes .TestConstants .TRAEFIK_INGRESS_HTTP_HOSTPORT ;
46
50
import static oracle .weblogic .kubernetes .actions .ActionConstants .APP_DIR ;
74
78
@ IntegrationTest
75
79
@ Tag ("kind-parallel" )
76
80
@ Tag ("okd-wls-mrg" )
77
- @ Tag ("oke-sequential1 " )
81
+ @ Tag ("oke-parallelnew " )
78
82
class ItManagedCoherence {
79
83
80
84
// constants for Coherence
@@ -129,10 +133,15 @@ public static void init(@Namespaces(3) List<String> namespaces) {
129
133
assertNotNull (namespaces .get (2 ), "Namespace list is null" );
130
134
domainNamespace = namespaces .get (2 );
131
135
136
+ String nodePortValue = null ;
137
+ if (!OKE_CLUSTER ) {
138
+ nodePortValue = "NodePort" ;
139
+ }
140
+
132
141
// install and verify Traefik if not running on OKD
133
142
if (!OKD || (TestConstants .KIND_CLUSTER
134
- && TestConstants .WLSIMG_BUILDER .equals (TestConstants .WLSIMG_BUILDER_DEFAULT ))) {
135
- traefikParams = installAndVerifyTraefik (traefikNamespace , 0 , 0 , "NodePort" );
143
+ && TestConstants .WLSIMG_BUILDER .equals (TestConstants .WLSIMG_BUILDER_DEFAULT ))) {
144
+ traefikParams = installAndVerifyTraefik (traefikNamespace , 0 , 0 , nodePortValue );
136
145
traefikHelmParams = traefikParams .getHelmParams ();
137
146
}
138
147
@@ -165,6 +174,16 @@ void testMultiClusterCoherenceDomain() throws IOException {
165
174
// create and verify a two-cluster WebLogic domain with a Coherence cluster
166
175
createAndVerifyDomain (domImage );
167
176
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
+
168
187
if (OKD ) {
169
188
String cluster1HostName = domainUid + "-cluster-cluster-1" ;
170
189
final String cluster1IngressHost = createRouteForOKD (cluster1HostName , domainNamespace );
@@ -174,12 +193,12 @@ void testMultiClusterCoherenceDomain() throws IOException {
174
193
-> coherenceCacheTest (cluster1IngressHost , 0 ), "Test Coherence cache failed" );
175
194
assertTrue (testCompletedSuccessfully , "Test Coherence cache failed" );
176
195
} else {
177
-
178
196
Map <String , Integer > clusterNameMsPortMap = new HashMap <>();
179
197
for (int i = 1 ; i <= NUMBER_OF_CLUSTERS ; i ++) {
180
198
clusterNameMsPortMap .put (CLUSTER_NAME_PREFIX + i , MANAGED_SERVER_PORT );
181
199
}
182
- String hostHeader = domainUid + "." + domainNamespace + ".cluster-1.test" ;
200
+
201
+ String clusterHostname = domainUid + "." + domainNamespace + ".cluster-1.test" ;
183
202
String hostAndPort ;
184
203
int ingressServiceNodePort ;
185
204
if (TestConstants .KIND_CLUSTER
@@ -191,10 +210,12 @@ void testMultiClusterCoherenceDomain() throws IOException {
191
210
hostAndPort = "localhost:" + TRAEFIK_INGRESS_HTTP_HOSTPORT ;
192
211
ingressServiceNodePort = TRAEFIK_INGRESS_HTTP_HOSTPORT ;
193
212
} else {
194
- // clusterNameMsPortMap.put(clusterName, managedServerPort);
213
+ List <String > domainUids = new ArrayList <>();
214
+ domainUids .add (domainUid );
215
+
195
216
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 ());
198
219
199
220
// get ingress service Name and Nodeport
200
221
String ingressServiceName = traefikHelmParams .getReleaseName ();
@@ -207,13 +228,13 @@ void testMultiClusterCoherenceDomain() throws IOException {
207
228
208
229
hostAndPort = getServiceExtIPAddrtOke (ingressServiceName , traefikNamespace ) != null
209
230
? getServiceExtIPAddrtOke (ingressServiceName , traefikNamespace )
210
- : getHostAndPort (hostHeader , ingressServiceNodePort );
231
+ : getHostAndPort (clusterHostname , ingressServiceNodePort );
211
232
}
212
233
213
- assertTrue (checkCoheranceApp (hostAndPort , hostHeader ), "Failed to access Coherance Application" );
234
+ assertTrue (checkCoheranceApp (hostAndPort , clusterHostname ), "Failed to access Coherance Application" );
214
235
// test adding data to the cache and retrieving them from the cache
215
236
boolean testCompletedSuccessfully = assertDoesNotThrow (()
216
- -> coherenceCacheTest (hostHeader , ingressServiceNodePort ), "Test Coherence cache failed" );
237
+ -> coherenceCacheTest (clusterHostname , ingressServiceNodePort ), "Test Coherence cache failed" );
217
238
assertTrue (testCompletedSuccessfully , "Test Coherence cache failed" );
218
239
}
219
240
}
@@ -486,8 +507,7 @@ private ExecResult clearCache(String hostName, String hostAndPort) {
486
507
}
487
508
488
509
private boolean checkCoheranceApp (String hostAndPort , String hostHeader ) {
489
-
490
- StringBuffer curlCmd = new StringBuffer ("curl -g --silent --show-error --noproxy '*' " );
510
+ StringBuffer curlCmd = new StringBuffer ("curl -g --show-error -ks --noproxy '*' " );
491
511
curlCmd
492
512
.append ("-d 'action=clear' " )
493
513
.append ("-X POST -H 'host: " )
@@ -509,5 +529,4 @@ private boolean checkCoheranceApp(String hostAndPort, String hostHeader) {
509
529
curlCmd );
510
530
return true ;
511
531
}
512
-
513
532
}
0 commit comments