X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FMetricsPageTest.kt;fp=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FMetricsPageTest.kt;h=5a5d5887076f4623c86ee3485ed444b0120b45b6;hp=269aafe76f4a901174de18c6187900fb02fe01fc;hb=1b83b0ae65741c6011ab36678b08ec87bc94c758;hpb=529da3428d7f6f6e2e418ff8a9348bfddefa63f2 diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/MetricsPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/MetricsPageTest.kt index 269aafe..5a5d588 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/MetricsPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/MetricsPageTest.kt @@ -62,17 +62,26 @@ class MetricsPageTest : WebPageTest() { } @Test - fun `metrics page lists stats about sone parsing durations`() { - createHistogram("sone.parsing.duration") + fun `metrics page auto-converts histogram name`() { + createHistogram("sone.random.duration") page.handleRequest(soneRequest, templateContext) - verifyHistogram("soneParsingDuration") + verifyHistogram("soneRandomDuration") } @Test - fun `metrics page lists stats about sone insert durations`() { - createHistogram("sone.insert.duration") + @Suppress("UNCHECKED_CAST") + fun `metrics page stores histogram keys in template`() { + createHistogram("sone.random.duration2") + createHistogram("sone.random.duration1") page.handleRequest(soneRequest, templateContext) - verifyHistogram("soneInsertDuration") + assertThat(templateContext["histogramKeys"] as Iterable, contains("soneRandomDuration1", "soneRandomDuration2")) + } + + @Test + fun `metrics page stores i18n names for histogram keys`() { + createHistogram("sone.random.duration1") + page.handleRequest(soneRequest, templateContext) + assertThat(templateContext["soneRandomDuration1I18n"] as String, equalTo("SoneRandomDuration1")) } @Test