From 0c0560c49fcd9354dee805bda8fad0f3489422c8 Mon Sep 17 00:00:00 2001 From: Dan Fox Date: Mon, 17 Feb 2020 20:16:21 +0000 Subject: [PATCH] Do markdown reports render better in github? --- .../dialogue/core/SimulationTest.java | 22 +++++++--- .../test/resources/{report.txt => report.md} | 43 +++++++++++++++++++ 2 files changed, 60 insertions(+), 5 deletions(-) rename simulation/src/test/resources/{report.txt => report.md} (57%) diff --git a/simulation/src/test/java/com/palantir/dialogue/core/SimulationTest.java b/simulation/src/test/java/com/palantir/dialogue/core/SimulationTest.java index 61ede0b8cc..c80aebaa93 100644 --- a/simulation/src/test/java/com/palantir/dialogue/core/SimulationTest.java +++ b/simulation/src/test/java/com/palantir/dialogue/core/SimulationTest.java @@ -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 list = Files.list(Paths.get("src/test/resources"))) { - String report = list.filter( - p -> p.toString().endsWith(".txt") && !p.toString().endsWith("report.txt")) + List 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( @@ -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%n%s%n%n%s%n", + txtSection, images); + Files.write(Paths.get("src/test/resources/report.md"), report.getBytes(StandardCharsets.UTF_8)); } } } diff --git a/simulation/src/test/resources/report.txt b/simulation/src/test/resources/report.md similarity index 57% rename from simulation/src/test/resources/report.txt rename to simulation/src/test/resources/report.md index 78c1fedb87..d3b9601154 100644 --- a/simulation/src/test/resources/report.txt +++ b/simulation/src/test/resources/report.md @@ -1,3 +1,6 @@ +# 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} @@ -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) +