Skip to content

Commit e687563

Browse files
authored
Add support in diagnostic logging to archive PV (#1609)
* Added methods to copy persistent volume contents to the client machine by the use of a temporary pod. Creating a temporary pod to mount to same volume used by the tests. Also few more fixes in the logging of files * Enable the cleanup method * Add javadocs * Correct typo * Addressing review comments * Addressing the review comments * Removed the persistent volume related assertions since it is no loner needed * Change the pod container image to use oraclelinux instead of nginx and wait for temp pod to be deleted * javadoc fix * fic formatting
1 parent fda0686 commit e687563

File tree

3 files changed

+292
-48
lines changed

3 files changed

+292
-48
lines changed

new-integration-tests/src/test/java/oracle/weblogic/kubernetes/assertions/TestAssertions.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,22 @@ public static Callable<Boolean> podExists(String podName, String domainUid, Stri
6868
};
6969
}
7070

71+
/**
72+
* Check a named pod does not exist in the given namespace.
73+
*
74+
* @param podName name of the pod to check for
75+
* @param domainUid Uid of WebLogic domain
76+
* @param namespace namespace in which to check for the pod
77+
* @return true if the pod does not exist in the namespace otherwise false
78+
* @throws ApiException when cluster query fails
79+
*/
80+
public static Callable<Boolean> podDoesNotExist(String podName, String domainUid, String namespace)
81+
throws ApiException {
82+
return () -> {
83+
return !Kubernetes.doesPodExist(namespace, domainUid, podName);
84+
};
85+
}
86+
7187
/**
7288
* Check if a Kubernetes pod is in running/ready state.
7389
*
@@ -187,4 +203,5 @@ public static boolean doesImageExist(String searchString) {
187203
public static boolean isHelmReleaseDeployed(String releaseName, String namespace) {
188204
return Helm.isReleaseDeployed(releaseName, namespace);
189205
}
206+
190207
}

new-integration-tests/src/test/java/oracle/weblogic/kubernetes/extensions/IntegrationTestWatcher.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import java.util.ArrayList;
1212
import java.util.List;
1313

14-
import io.kubernetes.client.openapi.ApiException;
1514
import oracle.weblogic.kubernetes.TestConstants;
1615
import oracle.weblogic.kubernetes.annotations.Namespaces;
1716
import oracle.weblogic.kubernetes.utils.CleanupUtil;
@@ -333,12 +332,8 @@ private void collectLogs(ExtensionContext extensionContext, String failedStage)
333332
} catch (IOException ex) {
334333
logger.warning(ex.getMessage());
335334
}
336-
try {
337-
for (var namespace : namespaces) {
338-
LoggingUtil.generateLog((String)namespace, resultDir);
339-
}
340-
} catch (IOException | ApiException ex) {
341-
logger.warning(ex.getMessage());
335+
for (var namespace : namespaces) {
336+
LoggingUtil.collectLogs((String)namespace, resultDir.toString());
342337
}
343338
}
344339

0 commit comments

Comments
 (0)