Skip to content

Commit 5a61dd2

Browse files
anpanigrANTARYAMI.PANIGRAHI@ORACLE.COM
andauthored
Add coherence integration test with istio (#2485)
* Add coherence integration test with Istio * add explicit UnicastListenAddress configuration Co-authored-by: ANTARYAMI.PANIGRAHI@ORACLE.COM <anpanigr@anpanigr-2.subnet1ad3phx.devweblogicphx.oraclevcn.com>
1 parent 0ec0aaa commit 5a61dd2

File tree

8 files changed

+906
-52
lines changed

8 files changed

+906
-52
lines changed

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItCoherenceTests.java

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import oracle.weblogic.kubernetes.utils.ExecResult;
3232
import oracle.weblogic.kubernetes.utils.FileUtils;
3333
import org.awaitility.core.ConditionFactory;
34-
import org.junit.jupiter.api.AfterAll;
3534
import org.junit.jupiter.api.BeforeAll;
3635
import org.junit.jupiter.api.DisplayName;
3736
import org.junit.jupiter.api.Tag;
@@ -43,7 +42,6 @@
4342
import static oracle.weblogic.kubernetes.TestConstants.OCIR_SECRET_NAME;
4443
import static oracle.weblogic.kubernetes.actions.ActionConstants.APP_DIR;
4544
import static oracle.weblogic.kubernetes.actions.TestActions.createDomainCustomResource;
46-
import static oracle.weblogic.kubernetes.actions.TestActions.deleteDomainCustomResource;
4745
import static oracle.weblogic.kubernetes.actions.TestActions.execCommand;
4846
import static oracle.weblogic.kubernetes.actions.TestActions.getPodIP;
4947
import static oracle.weblogic.kubernetes.actions.TestActions.patchDomainResourceWithNewRestartVersion;
@@ -86,7 +84,7 @@ class ItCoherenceTests {
8684
private static final String COHERENCE_MODEL_PROP = "coherence-wdt-config.properties";
8785
private static final String COHERENCE_IMAGE_NAME = "coherence-image";
8886

89-
private static String domainUid = "coh-domain1";
87+
private static String domainUid = "coherence-domain";
9088
private static String clusterName = "cluster-1";
9189
private static String adminServerPodName = domainUid + "-admin-server";
9290
private static String managedServerPrefix = domainUid + "-managed-server";
@@ -127,17 +125,6 @@ public static void init(@Namespaces(2) List<String> namespaces) {
127125
installAndVerifyOperator(opNamespace, domainNamespace);
128126
}
129127

130-
// This method is needed in this test class, since the cleanup util
131-
// won't cleanup the images.
132-
@AfterAll
133-
void tearDown() {
134-
// Delete domain custom resource
135-
logger.info("Delete domain custom resource in namespace {0}", domainNamespace);
136-
assertDoesNotThrow(() -> deleteDomainCustomResource(domainUid, domainNamespace),
137-
"deleteDomainCustomResource failed with ApiException");
138-
logger.info("Deleted Domain Custom Resource " + domainUid + " from " + domainNamespace);
139-
}
140-
141128
/**
142129
* Create a WebLogic domain with a Coherence cluster and deploying it using WDT
143130
* Test rolling restart of Coherence managed servers and verify

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioCoherenceTests.java

Lines changed: 386 additions & 0 deletions
Large diffs are not rendered by default.

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioManagedCoherence.java

Lines changed: 445 additions & 0 deletions
Large diffs are not rendered by default.

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItManagedCoherence.java

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import oracle.weblogic.kubernetes.utils.ExecCommand;
3232
import oracle.weblogic.kubernetes.utils.ExecResult;
3333
import org.awaitility.core.ConditionFactory;
34-
import org.junit.jupiter.api.AfterAll;
3534
import org.junit.jupiter.api.BeforeAll;
3635
import org.junit.jupiter.api.DisplayName;
3736
import org.junit.jupiter.api.Tag;
@@ -48,7 +47,6 @@
4847
import static oracle.weblogic.kubernetes.actions.ActionConstants.APP_DIR;
4948
import static oracle.weblogic.kubernetes.actions.TestActions.createDomainCustomResource;
5049
import static oracle.weblogic.kubernetes.actions.TestActions.getServiceNodePort;
51-
import static oracle.weblogic.kubernetes.actions.TestActions.uninstallVoyager;
5250
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkPodReady;
5351
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkServiceExists;
5452
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createImageAndVerify;
@@ -61,7 +59,6 @@
6159
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.installVoyagerIngressAndVerify;
6260
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.setPodAntiAffinity;
6361
import static oracle.weblogic.kubernetes.utils.ThreadSafeLogger.getLogger;
64-
import static org.assertj.core.api.Assertions.assertThat;
6562
import static org.awaitility.Awaitility.with;
6663
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
6764
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -84,7 +81,7 @@ class ItManagedCoherence {
8481
private static final String COHERENCE_IMAGE_NAME = "coherence-managed-image";
8582

8683
// constants for WebLogic domain
87-
private static final String domainUid = "coherence-managed-domain1";
84+
private static final String domainUid = "coherence-managed-domain";
8885
private static final int NUMBER_OF_CLUSTERS = 2;
8986
private static final String CLUSTER_NAME_PREFIX = "cluster-";
9087
private static final int MANAGED_SERVER_PORT = 8001;
@@ -156,26 +153,15 @@ public static void init(@Namespaces(3) List<String> namespaces) {
156153
logger.info("Path of CoherenceApp GAR " + coherenceAppGarPath.toString());
157154
}
158155

159-
@AfterAll
160-
void tearDown() {
161-
// uninstall Voyager
162-
if (voyagerHelmParams != null) {
163-
assertThat(uninstallVoyager(voyagerHelmParams))
164-
.as("Test uninstallVoyager returns true")
165-
.withFailMessage("uninstallVoyager() did not return true")
166-
.isTrue();
167-
}
168-
}
169-
170156
/**
171157
* Create domain with two clusters, cluster-1 and cluster-2 and associate them with a Coherence cluster
172158
* Deploy the EAR file to cluster-1 that has no storage enabled
173159
* Deploy the GAR file to cluster-2 that has storage enabled
174160
* Verify that data can be added and stored in the cache and can also be retrieved from cache.
175161
*/
176162
@Test
177-
@DisplayName("Create a two-cluster domain with a Coherence cluster using WDT and test interaction with cache data")
178-
public void testCreateCoherenceDomainInImageUsingWdt() {
163+
@DisplayName("Two cluster domain with a Coherence cluster and test interaction with cache data")
164+
public void testMultiClusterCoherenceDomain() {
179165
String ingressName = domainUid + "-ingress-host-routing";
180166
String ingressServiceName = VOYAGER_CHART_NAME + "-" + ingressName;
181167
String channelName = "tcp-80";

integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonTestUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1609,7 +1609,7 @@ public static List<String> installVoyagerIngressAndVerify(String domainUid,
16091609
.conditionEvaluationListener(
16101610
condition -> logger.info(
16111611
"Waiting for Voyager ingress to be ready in namespace {0} (elapsed time {1}ms, remaining time {2}ms)",
1612-
domainUid,
1612+
domainNamespace,
16131613
condition.getElapsedTimeInMS(),
16141614
condition.getRemainingTimeInMS()))
16151615
.until(assertDoesNotThrow(() -> isVoyagerReady(domainNamespace, voyagerIngressName),
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Copyright (c) 2020, 2021, 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+
apiVersion: networking.istio.io/v1alpha3
5+
kind: Gateway
6+
metadata:
7+
name: NAMESPACE-istio-http-gateway
8+
namespace: NAMESPACE
9+
spec:
10+
selector:
11+
istio: ingressgateway
12+
servers:
13+
- hosts:
14+
- '*'
15+
port:
16+
name: http
17+
number: 80
18+
protocol: HTTP
19+
---
20+
apiVersion: networking.istio.io/v1alpha3
21+
kind: VirtualService
22+
metadata:
23+
name: NAMESPACE-istio-http-virtualservice
24+
namespace: NAMESPACE
25+
spec:
26+
gateways:
27+
- NAMESPACE-istio-http-gateway
28+
hosts:
29+
- '*'
30+
http:
31+
- match:
32+
- uri:
33+
prefix: /console
34+
- uri:
35+
prefix: /weblogic
36+
- uri:
37+
prefix: /management
38+
- port: 7001
39+
route:
40+
- destination:
41+
host: ADMIN_SERVICE
42+
port:
43+
number: 7001
44+
45+
- match:
46+
- uri:
47+
prefix: /CoherenceApp
48+
- port: 8001
49+
route:
50+
- destination:
51+
host: CLUSTER_SERVICE
52+
port:
53+
number: 8001

integration-tests/src/test/resources/wdt-models/coherence-managed-wdt-config.yaml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,30 @@ topology:
1313
Cluster:
1414
'cluster-1':
1515
CoherenceClusterSystemResource: CoherenceCluster
16+
CoherenceTier:
17+
CoherenceWebFederatedStorageEnabled: false
18+
CoherenceWebLocalStorageEnabled: false
19+
LocalStorageEnabled: false
1620
DynamicServers:
1721
ServerNamePrefix: 'cluster-1-managed-server'
1822
MaxDynamicClusterSize: 5
1923
CalculatedListenPorts: false
2024
MaximumDynamicServerCount: 5
21-
ServerTemplate: 'cluster-1-template'
2225
DynamicClusterSize: 5
26+
ServerTemplate: 'cluster-1-template'
2327
'cluster-2':
2428
CoherenceClusterSystemResource: CoherenceCluster
29+
CoherenceTier:
30+
CoherenceWebFederatedStorageEnabled: false
31+
CoherenceWebLocalStorageEnabled: false
32+
LocalStorageEnabled: true
2533
DynamicServers:
2634
ServerNamePrefix: 'cluster-2-managed-server'
2735
MaxDynamicClusterSize: 5
2836
CalculatedListenPorts: false
2937
MaximumDynamicServerCount: 5
30-
ServerTemplate: 'cluster-2-template'
3138
DynamicClusterSize: 5
39+
ServerTemplate: 'cluster-2-template'
3240
Server:
3341
'admin-server':
3442
NetworkAccessPoint:
@@ -40,20 +48,19 @@ topology:
4048
'cluster-1-template':
4149
ListenPort: 8001
4250
Cluster: 'cluster-1'
43-
JTAMigratableTarget:
44-
Cluster: 'cluster-1'
45-
SSL:
46-
ListenPort: 8100
51+
CoherenceClusterSystemResource: CoherenceCluster
52+
CoherenceMemberConfig:
53+
UnicastListenAddress: 'coherence-managed-domain-cluster-1-managed-server${id}'
4754
'cluster-2-template':
4855
ListenPort: 8001
4956
Cluster: 'cluster-2'
50-
JTAMigratableTarget:
51-
Cluster: 'cluster-2'
52-
SSL:
53-
ListenPort: 8100
57+
CoherenceClusterSystemResource: CoherenceCluster
58+
CoherenceMemberConfig:
59+
UnicastListenAddress: 'coherence-managed-domain-cluster-2-managed-server${id}'
5460
resources:
5561
CoherenceClusterSystemResource:
5662
CoherenceCluster:
63+
Target: 'cluster-1,cluster-2'
5764
CoherenceResource:
5865
CoherenceClusterParams:
5966
ClusteringMode: unicast

integration-tests/src/test/resources/wdt-models/coherence-wdt-config.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ topology:
1010
ProductionModeEnabled: true
1111
Log:
1212
FileName: domain1.log
13-
NMProperties:
14-
JavaHome: /usr/java/jdk1.8.0_211
15-
LogFile: '@@PROP:DomainHome@@/nodemanager/nodemanager.log'
16-
DomainsFile: '@@PROP:DomainHome@@/nodemanager/nodemanager.domains'
17-
NodeManagerHome: '@@PROP:DomainHome@@/nodemanager'
18-
weblogic.StartScriptName: startWebLogic.sh
1913
Cluster:
2014
'cluster-1':
2115
CoherenceClusterSystemResource: CoherenceCluster
@@ -37,10 +31,6 @@ topology:
3731
'cluster-1-template':
3832
ListenPort: 8001
3933
Cluster: 'cluster-1'
40-
JTAMigratableTarget:
41-
Cluster: 'cluster-1'
42-
SSL:
43-
ListenPort: 8100
4434
resources:
4535
CoherenceClusterSystemResource:
4636
CoherenceCluster:

0 commit comments

Comments
 (0)