Skip to content

Commit

Permalink
Merge pull request #121 from palantir/feature/allow-circle-aware-log-…
Browse files Browse the repository at this point in the history
…directory-string

Add string version of circleAwareLogDirectory.
  • Loading branch information
iamdanfox authored Oct 18, 2016
2 parents 34ee34a + 24fa4ca commit e4a0335
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ private LogDirectory() {}
* @param testClass the JUnit test class whose name will appear on the log folder
*/
public static String circleAwareLogDirectory(Class<?> testClass) {
return circleAwareLogDirectory(testClass.getSimpleName());
}

public static String circleAwareLogDirectory(String logDirectoryName) {
String artifactRoot = Optional.ofNullable(System.getenv("CIRCLE_ARTIFACTS")).orElse("build");
return artifactRoot + "/dockerLogs/" + testClass.getSimpleName();
return artifactRoot + "/dockerLogs/" + logDirectoryName;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,13 @@ public void circleAwareLogDirectory_should_use_circle_environment_variable_if_av
assertThat(directory, is("/tmp/circle-artifacts.g4DjuuD/dockerLogs/SomeTestClass"));
}

@Test
public void circleAwareLogDirectory_should_append_logDirectoryName_to_path() {
variablesRule.set("CIRCLE_ARTIFACTS", "/tmp/circle-artifacts.123456");

String directory = LogDirectory.circleAwareLogDirectory("some-path");
assertThat(directory, is("/tmp/circle-artifacts.123456/dockerLogs/some-path"));
}

private static class SomeTestClass {}
}

0 comments on commit e4a0335

Please sign in to comment.