Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions core-tests/shared/src/test/scala/zio/metrics/MetricSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import zio.ZIOAspect._
import zio.metrics._
import zio.metrics.MetricKeyType.Histogram
import zio.test._
import zio.test.TestAspect._

import java.time.temporal.ChronoUnit

Expand Down Expand Up @@ -179,31 +178,6 @@ object MetricSpec extends ZIOBaseSpec {
state <- h.value
} yield assertTrue(state.count == 2L, state.sum == 4.0, state.min == 1.0, state.max == 3.0)
},
test("observeDurations") {
val h =
Metric
.histogram("h3", Histogram.Boundaries.linear(0, 1.0, 10))
.tagged(labels1)
.contramap[Duration](_.toMillis.toDouble / 1000.0)

for {
// NOTE: observeDurations always uses real clock
start <- ZIO.attempt(java.lang.System.nanoTime())
_ <- (Clock.sleep(1.second) @@ h.trackDuration)
_ <- (Clock.sleep(3.seconds) @@ h.trackDuration)
end <- ZIO.attempt(java.lang.System.nanoTime())
elapsed = (end - start) / 1e9
state <- h.value
} yield assertTrue(
state.count == 2L,
state.sum > 3.9,
state.sum <= elapsed,
state.min >= 1.0,
state.min < state.max,
state.max >= 3.0,
state.max < elapsed
)
} @@ withLiveClock @@ flaky,
test("observeHistogram") {
val h = Metric
.histogram("h4", Histogram.Boundaries.linear(0, 1.0, 10))
Expand Down