Skip to content

Commit 2565080

Browse files
committed
merge with latest develop
2 parents 864ccd1 + dbcfc81 commit 2565080

File tree

31 files changed

+1307
-3019
lines changed

31 files changed

+1307
-3019
lines changed

integration-tests/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@ The tests accepts optional env var overrides:
240240
| RESULT_ROOT | The root directory to use for the tests temporary files. See "Directory Configuration and Structure" for defaults and a detailed description of test directories. |
241241
| PV_ROOT | The root directory on the kubernetes cluster used for persistent volumes. See "Directory Configuration and Structure" for defaults and a detailed description of test directories. |
242242
| QUICKTEST | When set to "true", limits testing to a subset of the tests. |
243-
| INGRESSPERDOMAIN | The defult value is true. If you want to test creating LB by kubectl yaml for multiple domains, set it to false. |
243+
| LB_TYPE | The default value is "TRAEFIK". Set to "VOYAGER" if you want to use it as LB. |
244+
| INGRESSPERDOMAIN | The defult value is true. If you want to test creating TRAEFIK LB by kubectl yaml for multiple domains, set it to false. |
244245
| WERCKER | Set to true if invoking from Wercker, set to false or "" if running stand-alone or from Jenkins. Default is "". |
245246
| JENKINS | Set to true if invoking from Jenkins, set to false or "" if running stand-alone or from Wercker. Default is "". |
246247
| K8S_NODEPORT_HOST | DNS name of a Kubernetes worker node. Default is the local host's hostname. |

integration-tests/pom.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,12 @@
7474
<dependency>
7575
<groupId>javax.jms</groupId>
7676
<artifactId>javax.jms-api</artifactId>
77-
<version>2.0</version>
77+
<version>2.0.1</version>
78+
</dependency>
79+
<dependency>
80+
<groupId>javax.xml.bind</groupId>
81+
<artifactId>jaxb-api</artifactId>
82+
<version>2.3.1</version>
7883
</dependency>
7984
</dependencies>
8085

@@ -149,7 +154,7 @@
149154
<plugin>
150155
<groupId>org.apache.maven.plugins</groupId>
151156
<artifactId>maven-failsafe-plugin</artifactId>
152-
<version>2.20.1</version>
157+
<version>2.22.1</version>
153158
<configuration> <!-- run tests in parallel -->
154159
<encoding>UTF-8</encoding>
155160
<argLine>${failsafeArgLine}</argLine>

integration-tests/src/test/java/oracle/kubernetes/operator/BaseTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@ public void testClusterScaling(Operator operator, Domain domain) throws Exceptio
315315
+ replicas);
316316
}
317317

318+
domain.verifyWebAppLoadBalancing(TESTWEBAPP);
319+
318320
replicas = 2;
319321
podName = domainUid + "-" + managedServerNameBase + (replicas + 1);
320322
logger.info("Scale down to " + replicas + " managed servers");
@@ -331,8 +333,9 @@ public void testClusterScaling(Operator operator, Domain domain) throws Exceptio
331333
+ "/"
332334
+ replicas);
333335
}
334-
// commenting the load balance check, bug 29325139
335-
// domain.verifyWebAppLoadBalancing(TESTWEBAPP);
336+
337+
domain.verifyWebAppLoadBalancing(TESTWEBAPP);
338+
336339
logger.info("Done - testClusterScaling");
337340
}
338341

integration-tests/src/test/java/oracle/kubernetes/operator/ITOperator.java

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,10 @@ public class ITOperator extends BaseTest {
5454
private static boolean QUICKTEST;
5555
private static boolean SMOKETEST;
5656
private static boolean JENKINS;
57-
private static boolean INGRESSPERDOMAIN = true;
5857

5958
// Set QUICKTEST env var to true to run a small subset of tests.
6059
// Set SMOKETEST env var to true to run an even smaller subset
6160
// of tests, plus leave domain1 up and running when the test completes.
62-
// set INGRESSPERDOMAIN to false to create LB's ingress by kubectl yaml file
6361
static {
6462
QUICKTEST =
6563
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true");
@@ -69,9 +67,6 @@ public class ITOperator extends BaseTest {
6967
if (System.getenv("JENKINS") != null) {
7068
JENKINS = new Boolean(System.getenv("JENKINS")).booleanValue();
7169
}
72-
if (System.getenv("INGRESSPERDOMAIN") != null) {
73-
INGRESSPERDOMAIN = new Boolean(System.getenv("INGRESSPERDOMAIN")).booleanValue();
74-
}
7570
}
7671

7772
/**
@@ -236,12 +231,7 @@ public void testTwoDomainsManagedByTwoOperators() throws Exception {
236231
wlstDomainMap.put("domainUID", "domain1onpvwlst");
237232
wlstDomainMap.put("adminNodePort", new Integer("30702"));
238233
wlstDomainMap.put("t3ChannelPort", new Integer("30031"));
239-
if (!INGRESSPERDOMAIN) {
240-
wlstDomainMap.put("ingressPerDomain", new Boolean("false"));
241-
logger.info(
242-
"domain1onpvwlst ingressPerDomain is set to: "
243-
+ ((Boolean) wlstDomainMap.get("ingressPerDomain")).booleanValue());
244-
}
234+
wlstDomainMap.put("voyagerWebPort", new Integer("30307"));
245235
domain1 = TestUtils.createDomain(wlstDomainMap);
246236
domain1.verifyDomainCreated();
247237
testBasicUseCases(domain1);
@@ -257,12 +247,7 @@ public void testTwoDomainsManagedByTwoOperators() throws Exception {
257247
wdtDomainMap.put("adminNodePort", new Integer("30703"));
258248
wdtDomainMap.put("t3ChannelPort", new Integer("30041"));
259249
// wdtDomainMap.put("clusterType", "Configured");
260-
if (!INGRESSPERDOMAIN) {
261-
wdtDomainMap.put("ingressPerDomain", new Boolean("false"));
262-
logger.info(
263-
"domain2onpvwdt ingressPerDomain is set to: "
264-
+ ((Boolean) wdtDomainMap.get("ingressPerDomain")).booleanValue());
265-
}
250+
wdtDomainMap.put("voyagerWebPort", new Integer("30308"));
266251
domain2 = TestUtils.createDomain(wdtDomainMap);
267252
domain2.verifyDomainCreated();
268253
testBasicUseCases(domain2);
@@ -323,7 +308,6 @@ public void testCreateDomainWithStartPolicyAdminOnly() throws Exception {
323308
try {
324309
domain = TestUtils.createDomain(domainadminonlyFile);
325310
domain.verifyDomainCreated();
326-
327311
} finally {
328312
if (domain != null) {
329313
// create domain on existing dir
@@ -437,6 +421,8 @@ public void testAutoAndCustomSitConfigOverrides() throws Exception {
437421
domainMap.put(
438422
"createDomainPyScript",
439423
"integration-tests/src/test/resources/domain-home-on-pv/create-domain-auto-custom-sit-config.py");
424+
domainMap.put("voyagerWebPort", new Integer("30312"));
425+
440426
// use NFS for this domain on Jenkins, defaultis HOST_PATH
441427
if (System.getenv("JENKINS") != null && System.getenv("JENKINS").equalsIgnoreCase("true")) {
442428
domainMap.put("weblogicDomainStorageType", "NFS");

integration-tests/src/test/java/oracle/kubernetes/operator/utils/Domain.java

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ public class Domain {
6666
private static int maxIterations = BaseTest.getMaxIterationsPod(); // 50 * 5 = 250 seconds
6767
private static int waitTime = BaseTest.getWaitTimePod();
6868

69+
private boolean voyager;
70+
// LB_TYPE is an evn var. Set to "VOYAGER" to use it as loadBalancer
71+
private static String LB_TYPE;
72+
// set INGRESSPERDOMAIN to false to create LB's ingress by kubectl yaml file
73+
private static boolean INGRESSPERDOMAIN = true;
74+
6975
public Domain(String inputYaml) throws Exception {
7076
// read input domain yaml to test
7177
this(TestUtils.loadYaml(inputYaml));
@@ -943,17 +949,35 @@ private void createLoadBalancer() throws Exception {
943949
lbMap.put("namespace", domainNS);
944950
lbMap.put("host", domainUid + ".org");
945951
lbMap.put("serviceName", domainUid + "-cluster-" + domainMap.get("clusterName"));
946-
lbMap.put("loadBalancer", domainMap.getOrDefault("loadBalancer", loadBalancer));
947-
lbMap.put("ingressPerDomain", domainMap.getOrDefault("ingressPerDomain", ingressPerDomain));
952+
if (voyager) {
953+
lbMap.put("loadBalancer", "VOYAGER");
954+
lbMap.put("loadBalancerWebPort", domainMap.get("voyagerWebPort"));
955+
} else {
956+
lbMap.put("loadBalancer", domainMap.getOrDefault("loadBalancer", loadBalancer));
957+
lbMap.put(
958+
"loadBalancerWebPort",
959+
domainMap.getOrDefault("loadBalancerWebPort", new Integer(loadBalancerWebPort)));
960+
}
961+
if (!INGRESSPERDOMAIN) {
962+
lbMap.put("ingressPerDomain", new Boolean("false"));
963+
logger.info("For this domain, INGRESSPERDOMAIN is set to false");
964+
} else {
965+
lbMap.put(
966+
"ingressPerDomain",
967+
domainMap.getOrDefault("ingressPerDomain", new Boolean(ingressPerDomain)));
968+
}
948969
lbMap.put("clusterName", domainMap.get("clusterName"));
949970

950971
loadBalancer = (String) lbMap.get("loadBalancer");
972+
loadBalancerWebPort = ((Integer) lbMap.get("loadBalancerWebPort")).intValue();
951973
ingressPerDomain = ((Boolean) lbMap.get("ingressPerDomain")).booleanValue();
952974
logger.info(
953975
"For this domain loadBalancer is: "
954976
+ loadBalancer
955977
+ " ingressPerDomain is: "
956-
+ ingressPerDomain);
978+
+ ingressPerDomain
979+
+ " loadBalancerWebPort is: "
980+
+ loadBalancerWebPort);
957981

958982
if (loadBalancer.equals("TRAEFIK") && !ingressPerDomain) {
959983
lbMap.put("name", "traefik-hostrouting-" + domainUid);
@@ -963,6 +987,10 @@ private void createLoadBalancer() throws Exception {
963987
lbMap.put("name", "traefik-ingress-" + domainUid);
964988
}
965989

990+
if (loadBalancer.equals("VOYAGER") && ingressPerDomain) {
991+
lbMap.put("name", "voyager-ingress-" + domainUid);
992+
}
993+
966994
if (loadBalancer.equals("APACHE")) {
967995
/* lbMap.put("loadBalancerAppPrepath", "/weblogic");
968996
lbMap.put("loadBalancerExposeAdminPort", new Boolean(true)); */
@@ -1077,11 +1105,11 @@ private void callWebAppAndCheckForServerNameInResponse(
10771105
+ " \n "
10781106
+ result.stdout());
10791107
} else {
1080-
logger.info("webapp invoked successfully");
1108+
logger.info("webapp invoked successfully for curlCmd:" + curlCmd);
10811109
}
10821110
if (verifyLoadBalancing) {
10831111
String response = result.stdout().trim();
1084-
// logger.info("response "+ response);
1112+
// logger.info("response: " + response);
10851113
for (String key : managedServers.keySet()) {
10861114
if (response.contains(key)) {
10871115
managedServers.put(key, new Boolean(true));
@@ -1091,10 +1119,15 @@ private void callWebAppAndCheckForServerNameInResponse(
10911119
}
10921120
}
10931121
logger.info("ManagedServers " + managedServers);
1122+
10941123
// error if any managedserver value is false
10951124
if (verifyLoadBalancing) {
10961125
for (Map.Entry<String, Boolean> entry : managedServers.entrySet()) {
1126+
logger.info("Load balancer will try to reach server " + entry.getKey());
10971127
if (!entry.getValue().booleanValue()) {
1128+
// print service and pods info for debugging
1129+
TestUtils.describeService(domainNS, domainUid + "-cluster-" + clusterName);
1130+
TestUtils.getPods(domainNS);
10981131
throw new RuntimeException(
10991132
"FAILURE: Load balancer can not reach server " + entry.getKey());
11001133
}
@@ -1111,6 +1144,12 @@ private void initialize(Map<String, Object> inputDomainMap) throws Exception {
11111144
TestUtils.exec(
11121145
"cp -rf " + BaseTest.getProjectRoot() + "/kubernetes/samples " + BaseTest.getResultDir());
11131146

1147+
this.voyager =
1148+
System.getenv("LB_TYPE") != null && System.getenv("LB_TYPE").equalsIgnoreCase("VOYAGER");
1149+
if (System.getenv("INGRESSPERDOMAIN") != null) {
1150+
INGRESSPERDOMAIN = new Boolean(System.getenv("INGRESSPERDOMAIN")).booleanValue();
1151+
}
1152+
11141153
domainMap.put("domainName", domainMap.get("domainUID"));
11151154

11161155
// read sample domain inputs

integration-tests/src/test/java/oracle/kubernetes/operator/utils/K8sTestUtils.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ public void verifyPods(String namespace, String labelSelectors, int expected) th
8989
V1PodList v1PodList =
9090
coreV1Api.listNamespacedPod(
9191
namespace,
92+
Boolean.FALSE,
9293
Boolean.FALSE.toString(),
9394
null,
9495
null,
95-
Boolean.FALSE,
9696
labelSelectors,
9797
null,
9898
null,
@@ -202,9 +202,7 @@ public void verifyIngresses(
202202
// TODO verify {domainUID}-cluster-1
203203
assertEquals(
204204
"Number of labeled ingress", labeledIngressList.getItems().size(), expectedLabeled);
205-
labeledIngressList
206-
.getItems()
207-
.stream()
205+
labeledIngressList.getItems().stream()
208206
.forEach(li -> li.getMetadata().getNamespace().equals(domainNs));
209207
V1beta1IngressList traefikIngressList =
210208
extensionsV1beta1Api.listIngressForAllNamespaces(
@@ -218,9 +216,7 @@ public void verifyIngresses(
218216
null,
219217
Boolean.FALSE);
220218
assertEquals("Number of Traefik ingress", traefikIngressList.getItems().size(), 1);
221-
traefikIngressList
222-
.getItems()
223-
.stream()
219+
traefikIngressList.getItems().stream()
224220
.forEach(ti -> ti.getMetadata().getNamespace().equals(domainNs));
225221
}
226222

@@ -303,10 +299,10 @@ public void verifySecrets(String secretName, int expected) throws Exception {
303299
public void verifyPvs(String labelSelectors, int expected) throws Exception {
304300
V1PersistentVolumeList v1PersistentVolumeList =
305301
coreV1Api.listPersistentVolume(
302+
Boolean.TRUE,
306303
Boolean.FALSE.toString(),
307304
null,
308305
null,
309-
Boolean.TRUE,
310306
labelSelectors,
311307
null,
312308
null,
@@ -318,10 +314,10 @@ public void verifyPvs(String labelSelectors, int expected) throws Exception {
318314
public void verifyNoClusterRoles(String domain1Ls) throws Exception {
319315
V1ClusterRoleList v1ClusterRoleList =
320316
rbacAuthorizationV1Api.listClusterRole(
317+
Boolean.TRUE,
321318
Boolean.FALSE.toString(),
322319
null,
323320
null,
324-
Boolean.TRUE,
325321
domain1Ls,
326322
null,
327323
null,
@@ -333,10 +329,10 @@ public void verifyNoClusterRoles(String domain1Ls) throws Exception {
333329
public void verifyNoClusterRoleBindings(String labelSelectors) throws Exception {
334330
V1ClusterRoleBindingList v1ClusterRoleBindingList =
335331
rbacAuthorizationV1Api.listClusterRoleBinding(
332+
Boolean.TRUE,
336333
Boolean.FALSE.toString(),
337334
null,
338335
null,
339-
Boolean.TRUE,
340336
labelSelectors,
341337
null,
342338
null,

0 commit comments

Comments
 (0)