mirror of
https://github.com/jlengrand/ktor.git
synced 2026-03-10 08:31:20 +00:00
update dropwizard version and add a super simple test
This commit is contained in:
committed by
Sergey Mashkov
parent
c811267ecb
commit
9e1e000a11
@@ -3,8 +3,8 @@ kotlin {
|
||||
sourceSets {
|
||||
jvmMain {
|
||||
dependencies {
|
||||
api group: 'io.dropwizard.metrics', name: 'metrics-core', version: '3.2.4'
|
||||
api group: 'io.dropwizard.metrics', name: 'metrics-jvm', version: '3.2.4'
|
||||
api group: 'io.dropwizard.metrics', name: 'metrics-core', version: '4.1.0'
|
||||
api group: 'io.dropwizard.metrics', name: 'metrics-jvm', version: '4.1.0'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
*/
|
||||
|
||||
package io.ktor.metrics.dropwizard
|
||||
|
||||
import com.codahale.metrics.*
|
||||
import io.ktor.application.*
|
||||
import io.ktor.response.*
|
||||
import io.ktor.routing.*
|
||||
import io.ktor.server.testing.*
|
||||
import org.junit.*
|
||||
import org.junit.Assert.*
|
||||
|
||||
|
||||
class DropwizardMetricsTests {
|
||||
|
||||
@Test
|
||||
fun `meter is registered for a given path`(): Unit = withTestApplication {
|
||||
val testRegistry = MetricRegistry()
|
||||
|
||||
application.install(DropwizardMetrics) {
|
||||
registry = testRegistry
|
||||
}
|
||||
|
||||
application.routing {
|
||||
get("/uri") {
|
||||
call.respond("hello")
|
||||
}
|
||||
}
|
||||
|
||||
handleRequest {
|
||||
uri = "/uri"
|
||||
}
|
||||
|
||||
assertEquals(1, testRegistry.meter("/uri/(method:GET).200").count)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user