Skip to content

Commit

Permalink
Do markdown reports render better in github?
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdanfox committed Feb 17, 2020
1 parent 92f6986 commit 0c0560c
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -450,10 +450,14 @@ public void after() throws IOException {

@AfterClass
public static void afterClass() throws IOException {
// squish all txt files together into one report to make it easier to compare during code review
// squish all txt files together into one markdown report so that github displays diffs
try (Stream<Path> list = Files.list(Paths.get("src/test/resources"))) {
String report = list.filter(
p -> p.toString().endsWith(".txt") && !p.toString().endsWith("report.txt"))
List<Path> files = list.filter(p -> !p.toString().endsWith("report.md"))
.sorted(Comparator.comparing(Path::getFileName))
.collect(Collectors.toList());

String txtSection = files.stream()
.filter(p -> p.toString().endsWith("txt"))
.map(p -> {
try {
return String.format(
Expand All @@ -464,9 +468,17 @@ public static void afterClass() throws IOException {
throw new RuntimeException(e);
}
})
.sorted(Comparator.comparing(String::trim))
.collect(Collectors.joining("", "```\n", "```\n"));

String images = files.stream()
.filter(p -> p.toString().endsWith("png"))
.map(p -> String.format("## %s%n![%s](%s)%n", p.getFileName(), p.getFileName(), p.getFileName()))
.collect(Collectors.joining());
Files.write(Paths.get("src/test/resources/report.txt"), report.getBytes(StandardCharsets.UTF_8));

String report = String.format(
"# Report%n<!-- Run SimulationTest to regenerate this report. -->%n%s%n%n%s%n",
txtSection, images);
Files.write(Paths.get("src/test/resources/report.md"), report.getBytes(StandardCharsets.UTF_8));
}
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Report
<!-- Run SimulationTest to regenerate this report. -->
```
all_nodes_500[CONCURRENCY_LIMITER].txt: success=59.0% client_mean=PT1.446S server_cpu=PT4M49.2S received=200/200 codes={200=118, Retries exhausted=82}
all_nodes_500[ROUND_ROBIN].txt: success=59.0% client_mean=PT1.446S server_cpu=PT4M49.2S received=200/200 codes={200=118, Retries exhausted=82}
black_hole[CONCURRENCY_LIMITER].txt: success=90.0% client_mean=PT0.6S server_cpu=PT1M48S received=180/200 codes={200=180}
Expand All @@ -16,3 +19,43 @@
slow_503s_then_revert[ROUND_ROBIN].txt: success=100.0% client_mean=PT1.408771222S server_cpu=PT1H10M26.313666644S received=3000/3000 codes={200=3000}
slowdown_and_error_thresholds[CONCURRENCY_LIMITER].txt: success=100.0% client_mean=PT1.977419999S server_cpu=PT31M8.473333135S received=1000/1000 codes={200=1000}
slowdown_and_error_thresholds[ROUND_ROBIN].txt: success=64.1% client_mean=PT8.803926666S server_cpu=PT2H26M43.92666658S received=1000/1000 codes={200=641, Retries exhausted=359}
```


## all_nodes_500[CONCURRENCY_LIMITER].png
![all_nodes_500[CONCURRENCY_LIMITER].png](all_nodes_500[CONCURRENCY_LIMITER].png)
## all_nodes_500[ROUND_ROBIN].png
![all_nodes_500[ROUND_ROBIN].png](all_nodes_500[ROUND_ROBIN].png)
## black_hole[CONCURRENCY_LIMITER].png
![black_hole[CONCURRENCY_LIMITER].png](black_hole[CONCURRENCY_LIMITER].png)
## black_hole[ROUND_ROBIN].png
![black_hole[ROUND_ROBIN].png](black_hole[ROUND_ROBIN].png)
## drastic_slowdown[CONCURRENCY_LIMITER].png
![drastic_slowdown[CONCURRENCY_LIMITER].png](drastic_slowdown[CONCURRENCY_LIMITER].png)
## drastic_slowdown[ROUND_ROBIN].png
![drastic_slowdown[ROUND_ROBIN].png](drastic_slowdown[ROUND_ROBIN].png)
## fast_500s_then_revert[CONCURRENCY_LIMITER].png
![fast_500s_then_revert[CONCURRENCY_LIMITER].png](fast_500s_then_revert[CONCURRENCY_LIMITER].png)
## fast_500s_then_revert[ROUND_ROBIN].png
![fast_500s_then_revert[ROUND_ROBIN].png](fast_500s_then_revert[ROUND_ROBIN].png)
## live_reloading[CONCURRENCY_LIMITER].png
![live_reloading[CONCURRENCY_LIMITER].png](live_reloading[CONCURRENCY_LIMITER].png)
## live_reloading[ROUND_ROBIN].png
![live_reloading[ROUND_ROBIN].png](live_reloading[ROUND_ROBIN].png)
## one_endpoint_dies_on_each_server[CONCURRENCY_LIMITER].png
![one_endpoint_dies_on_each_server[CONCURRENCY_LIMITER].png](one_endpoint_dies_on_each_server[CONCURRENCY_LIMITER].png)
## one_endpoint_dies_on_each_server[ROUND_ROBIN].png
![one_endpoint_dies_on_each_server[ROUND_ROBIN].png](one_endpoint_dies_on_each_server[ROUND_ROBIN].png)
## simplest_possible_case[CONCURRENCY_LIMITER].png
![simplest_possible_case[CONCURRENCY_LIMITER].png](simplest_possible_case[CONCURRENCY_LIMITER].png)
## simplest_possible_case[ROUND_ROBIN].png
![simplest_possible_case[ROUND_ROBIN].png](simplest_possible_case[ROUND_ROBIN].png)
## slow_503s_then_revert[CONCURRENCY_LIMITER].png
![slow_503s_then_revert[CONCURRENCY_LIMITER].png](slow_503s_then_revert[CONCURRENCY_LIMITER].png)
## slow_503s_then_revert[ROUND_ROBIN].png
![slow_503s_then_revert[ROUND_ROBIN].png](slow_503s_then_revert[ROUND_ROBIN].png)
## slowdown_and_error_thresholds[CONCURRENCY_LIMITER].png
![slowdown_and_error_thresholds[CONCURRENCY_LIMITER].png](slowdown_and_error_thresholds[CONCURRENCY_LIMITER].png)
## slowdown_and_error_thresholds[ROUND_ROBIN].png
![slowdown_and_error_thresholds[ROUND_ROBIN].png](slowdown_and_error_thresholds[ROUND_ROBIN].png)

0 comments on commit 0c0560c

Please sign in to comment.