|
61 | 61 | import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_TAG;
|
62 | 62 | import static oracle.weblogic.kubernetes.TestConstants.WLSIMG_BUILDER;
|
63 | 63 | import static oracle.weblogic.kubernetes.actions.ActionConstants.APP_DIR;
|
| 64 | +import static oracle.weblogic.kubernetes.actions.ActionConstants.ITTESTS_DIR; |
64 | 65 | import static oracle.weblogic.kubernetes.actions.ActionConstants.MODEL_DIR;
|
65 | 66 | import static oracle.weblogic.kubernetes.actions.ActionConstants.REMOTECONSOLE;
|
66 | 67 | import static oracle.weblogic.kubernetes.actions.ActionConstants.REMOTECONSOLE_DOWNLOAD_FILENAME_DEFAULT;
|
|
77 | 78 | import static oracle.weblogic.kubernetes.actions.ActionConstants.WLE;
|
78 | 79 | import static oracle.weblogic.kubernetes.actions.ActionConstants.WLE_DOWNLOAD_FILENAME_DEFAULT;
|
79 | 80 | import static oracle.weblogic.kubernetes.actions.ActionConstants.WLE_DOWNLOAD_URL_DEFAULT;
|
| 81 | +import static oracle.weblogic.kubernetes.actions.ActionConstants.WORK_DIR; |
80 | 82 | import static oracle.weblogic.kubernetes.actions.TestActions.getDomainCustomResource;
|
81 | 83 | import static oracle.weblogic.kubernetes.actions.TestActions.getPodCreationTimestamp;
|
82 | 84 | import static oracle.weblogic.kubernetes.actions.TestActions.getServiceNodePort;
|
@@ -1938,4 +1940,33 @@ public static String getImageRepoFromImageName(String imageName) {
|
1938 | 1940 | }
|
1939 | 1941 | return imageRepo;
|
1940 | 1942 | }
|
| 1943 | + |
| 1944 | + /** |
| 1945 | + * Backup failsafe-reports directory to a temporary location. |
| 1946 | + * |
| 1947 | + * @param uniqueDir directory to save reports |
| 1948 | + * @return absolute path of the reports directory |
| 1949 | + */ |
| 1950 | + public static String backupReports(String uniqueDir) { |
| 1951 | + String srcContents = ITTESTS_DIR + "/target/failsafe-reports/*"; |
| 1952 | + String dstDir = WORK_DIR + "/" + uniqueDir; |
| 1953 | + CommandParams params = new CommandParams().defaults(); |
| 1954 | + Command.withParams(params.command("ls -lrt " + srcContents)).execute(); |
| 1955 | + Command.withParams(params.command("mkdir -p " + dstDir)).execute(); |
| 1956 | + Command.withParams(params.command("cp " + srcContents + " " + dstDir)).execute(); |
| 1957 | + return dstDir; |
| 1958 | + } |
| 1959 | + |
| 1960 | + /** |
| 1961 | + * Restore reports from backup. |
| 1962 | + * |
| 1963 | + * @param backupDir directory containing the reports |
| 1964 | + */ |
| 1965 | + public static void restoreReports(String backupDir) { |
| 1966 | + String dstDir = ITTESTS_DIR + "/target/failsafe-reports"; |
| 1967 | + CommandParams params = new CommandParams().defaults(); |
| 1968 | + Command.withParams(params.command("mkdir -p " + dstDir)).execute(); |
| 1969 | + Command.withParams(params.command("cp " + backupDir + "/* " + dstDir)).execute(); |
| 1970 | + } |
| 1971 | + |
1941 | 1972 | }
|
0 commit comments