Skip to content

Commit

Permalink
Do not delete aws config directory between tests (#546)
Browse files Browse the repository at this point in the history
  • Loading branch information
dexamundsen authored Sep 20, 2023
1 parent 5e02d49 commit 45b6b65
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/test/java/harness/TestContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ private TestContext() {}

/**
* Delete the contents of the global context directory, except for the Java library dependencies
* in the "lib" sub-directory and the running log files in the "logs" sub-directory.
* in the "lib" sub-directory, the running log files in the "logs" sub-directory and the
* aws-workspace configuration in the "aws" sub-directory
*/
public static void clearGlobalContextDir() throws IOException {
Path globalContextDir = Context.getContextDir();
Expand All @@ -25,15 +26,19 @@ public static void clearGlobalContextDir() throws IOException {
}
Path globalContextLibDir = globalContextDir.resolve("lib");
Path globalContextLogsDir = globalContextDir.resolve("logs");
Path globalContextAwsDir = globalContextDir.resolve("aws");

// delete all children of the global context directory, except for:
// - "lib" sub-directory that contains all the JAR dependencies
// - "logs" sub-directory that contains the rolling log files
// - "aws" sub-directory that contains the workspace aws configuration (created and deleted by
// the workspace)
FileUtils.walkUpFileTree(
globalContextDir,
childPath -> {
if (!childPath.startsWith(globalContextLibDir)
&& !childPath.startsWith(globalContextLogsDir)) {
&& !childPath.startsWith(globalContextLogsDir)
&& !childPath.startsWith(globalContextAwsDir)) {
childPath.toFile().delete();
}
},
Expand Down

0 comments on commit 45b6b65

Please sign in to comment.