Skip to content

Commit 0cf66f1

Browse files
committed
add javadoc
1 parent 9692c3b commit 0cf66f1

File tree

2 files changed

+78
-9
lines changed

2 files changed

+78
-9
lines changed

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

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public static void staticPrepare() throws Exception {
7474
*
7575
* @throws Exception
7676
*/
77-
// @AfterClass
77+
@AfterClass
7878
public static void staticUnPrepare() throws Exception {
7979
if (!QUICKTEST) {
8080
logger.info("+++++++++++++++++++++++++++++++++---------------------------------+");
@@ -95,7 +95,7 @@ public static void staticUnPrepare() throws Exception {
9595
*
9696
* @throws Exception
9797
*/
98-
// @Test
98+
@Test
9999
public void testServerPodsRestartByChangingEnvProperty() throws Exception {
100100
Assume.assumeFalse(QUICKTEST);
101101
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
@@ -118,7 +118,7 @@ public void testServerPodsRestartByChangingEnvProperty() throws Exception {
118118
*
119119
* @throws Exception
120120
*/
121-
// @Test
121+
@Test
122122
public void testServerPodsRestartByChangingLogHomeEnabled() throws Exception {
123123
Assume.assumeFalse(QUICKTEST);
124124
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
@@ -140,7 +140,7 @@ public void testServerPodsRestartByChangingLogHomeEnabled() throws Exception {
140140
*
141141
* @throws Exception
142142
*/
143-
// @Test
143+
@Test
144144
public void testServerPodsRestartByChangingImagePullPolicy() throws Exception {
145145
Assume.assumeFalse(QUICKTEST);
146146
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
@@ -163,7 +163,7 @@ public void testServerPodsRestartByChangingImagePullPolicy() throws Exception {
163163
*
164164
* @throws Exception
165165
*/
166-
// @Test
166+
@Test
167167
public void testServerPodsRestartByChangingIncludeServerOutInPodLog() throws Exception {
168168
Assume.assumeFalse(QUICKTEST);
169169
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
@@ -186,7 +186,7 @@ public void testServerPodsRestartByChangingIncludeServerOutInPodLog() throws Exc
186186
*
187187
* @throws Exception
188188
*/
189-
// @Test
189+
@Test
190190
public void testServerPodsRestartByChangingZImage() throws Exception {
191191
Assume.assumeFalse(QUICKTEST);
192192
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
@@ -217,7 +217,7 @@ public void testServerPodsRestartByChangingZImage() throws Exception {
217217
* are not restarted or after restart the server yaml file doesn't include the new added
218218
* property
219219
*/
220-
// @Test
220+
@Test
221221
public void testServerPodsRestartByChangingContSecurityContext() throws Exception {
222222
Assume.assumeFalse(QUICKTEST);
223223
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
@@ -254,7 +254,7 @@ public void testServerPodsRestartByChangingContSecurityContext() throws Exceptio
254254
* are not restarted or after restart the server yaml file doesn't include the new added
255255
* property
256256
*/
257-
// @Test
257+
@Test
258258
public void testServerPodsRestartByChangingPodSecurityContext() throws Exception {
259259
Assume.assumeFalse(QUICKTEST);
260260
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
@@ -292,7 +292,7 @@ public void testServerPodsRestartByChangingPodSecurityContext() throws Exception
292292
* are not restarted or after restart the server yaml file doesn't include the new added
293293
* property
294294
*/
295-
// @Test
295+
@Test
296296
public void testServerPodsRestartByChangingResource() throws Exception {
297297
Assume.assumeFalse(QUICKTEST);
298298
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
@@ -320,6 +320,13 @@ public void testServerPodsRestartByChangingResource() throws Exception {
320320
logger.info("SUCCESS - " + testMethodName);
321321
}
322322

323+
/**
324+
* Add restartVersion:v1.1 at adminServer level and verify the admin pod is Terminated and
325+
* recreated
326+
*
327+
* @throws Exception when domain.yaml cannot be read or modified to include the
328+
* restartVersion:v1.1
329+
*/
323330
@Test
324331
public void testAdminServerRestartVersion() throws Exception {
325332
Assume.assumeFalse(QUICKTEST);
@@ -362,6 +369,13 @@ public void testAdminServerRestartVersion() throws Exception {
362369
logger.log(Level.INFO, "SUCCESS - {0}", testMethodName);
363370
}
364371

372+
/**
373+
* Add restartVersion:v1.1 at cluster level and verify the managed servers pods are Terminated and
374+
* recreated
375+
*
376+
* @throws Exception when domain.yaml cannot be read or modified to include the
377+
* restartVersion:v1.1
378+
*/
365379
@Test
366380
public void testClusterRestartVersion() throws Exception {
367381
Assume.assumeFalse(QUICKTEST);
@@ -402,6 +416,13 @@ public void testClusterRestartVersion() throws Exception {
402416
logger.log(Level.INFO, "SUCCESS - {0}", testMethodName);
403417
}
404418

419+
/**
420+
* Add restartVersion:v1.1 at managed server level and verify the managed server pod are
421+
* Terminated and recreated
422+
*
423+
* @throws Exception when domain.yaml cannot be read or modified to include the
424+
* restartVersion:v1.1
425+
*/
405426
@Test
406427
public void testMSRestartVersion() throws Exception {
407428
Assume.assumeFalse(QUICKTEST);
@@ -444,6 +465,13 @@ public void testMSRestartVersion() throws Exception {
444465
logger.log(Level.INFO, "SUCCESS - {0}", testMethodName);
445466
}
446467

468+
/**
469+
* Add restartVersion:v1.1 at doamin level and verify all of the server pods are Terminated and
470+
* recreated
471+
*
472+
* @throws Exception when domain.yaml cannot be read or modified to include the
473+
* restartVersion:v1.1
474+
*/
447475
@Test
448476
public void testDomainRestartVersion() throws Exception {
449477
Assume.assumeFalse(QUICKTEST);
@@ -514,6 +542,13 @@ private static void destroyPodsRestartdomain() throws Exception {
514542
}
515543
}
516544

545+
/**
546+
* Utility method to check if a pod is in Terminating or Running status
547+
*
548+
* @param podName - String name of the pod to check the status for
549+
* @param podStatusExpected - String the expected status of Terminating || RUnning
550+
* @throws InterruptedException when thread is interrupted
551+
*/
517552
private void verifyPodStatus(String podName, String podStatusExpected)
518553
throws InterruptedException {
519554
K8sTestUtils testUtil = new K8sTestUtils();

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,13 @@ public void verifyNoClusterRoleBindings(String labelSelectors) throws Exception
347347
assertEquals("Number of cluster role bindings", v1ClusterRoleBindingList.getItems().size(), 0);
348348
}
349349

350+
/**
351+
* Utility method to get the pods in a namespace filtered by given label
352+
*
353+
* @param namespace - String namespace in which to look for the pods
354+
* @param labelSelectors - String selector to filter the pods in the name space
355+
* @return - V1PodList List of the pods in the given name space.
356+
*/
350357
public V1PodList getPods(String namespace, String labelSelectors) {
351358
V1PodList v1PodList = null;
352359
try {
@@ -373,6 +380,14 @@ public V1PodList getPods(String namespace, String labelSelectors) {
373380
return v1PodList;
374381
}
375382

383+
/**
384+
* Utility method to get a pod matching the given name
385+
*
386+
* @param namespace - String namespace in which to look for the pods
387+
* @param labelSelectors - String selector to filter the pods in the name space
388+
* @param podName - String name of the pod to query for
389+
* @return V1Pod object matching the podName
390+
*/
376391
public V1Pod getPod(String namespace, String labelSelectors, String podName) {
377392
List<V1Pod> pods = getPods(namespace, labelSelectors).getItems();
378393
for (V1Pod pod : pods) {
@@ -384,6 +399,16 @@ public V1Pod getPod(String namespace, String labelSelectors, String podName) {
384399
return null;
385400
}
386401

402+
/**
403+
* Utility method to determine if a pod is in Terminating status It detects the Terminating status
404+
* by looking at the metadata.getDeletionTimestamp field, a non null value means the pod is
405+
* terminating.
406+
*
407+
* @param namespace - String namespace in which to look for the pods
408+
* @param labelSelectors - String selector to filter the pods in the name space
409+
* @param podName - String name of the pod to query for
410+
* @return boolean true if the pod is in Terminating status
411+
*/
387412
public boolean isPodTerminating(String namespace, String labelSelectors, String podName) {
388413
V1ObjectMeta metadata = getPod(namespace, labelSelectors, podName).getMetadata();
389414
if (metadata.getDeletionTimestamp() != null) {
@@ -394,6 +419,15 @@ public boolean isPodTerminating(String namespace, String labelSelectors, String
394419
return metadata.getDeletionTimestamp() != null;
395420
}
396421

422+
/**
423+
* Utility method to determine if a pod is in Running status It detects the Running status by
424+
* looking at the metadata.getDeletionTimestamp field, a null value means the pod is Running.
425+
*
426+
* @param namespace - String namespace in which to look for the pods
427+
* @param labelSelectors - String selector to filter the pods in the name space
428+
* @param podName - String name of the pod to query for
429+
* @return boolean true if the pod is in Terminating status
430+
*/
397431
public boolean isPodRunning(String namespace, String labelSelectors, String podName) {
398432
return !isPodTerminating(namespace, labelSelectors, podName);
399433
}

0 commit comments

Comments
 (0)