diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2014-03-24 00:39:31 -0300 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2014-03-24 00:39:31 -0300 |
commit | 1b7442f20d65e4a4b43b995acf8a7af538714913 (patch) | |
tree | f723a28bc6b24fe2ca022b12036778a1d0242f36 /kamon-core | |
parent | f6e9cb16798abf5eecada300df44339d3f09592d (diff) | |
download | Kamon-1b7442f20d65e4a4b43b995acf8a7af538714913.tar.gz Kamon-1b7442f20d65e4a4b43b995acf8a7af538714913.tar.bz2 Kamon-1b7442f20d65e4a4b43b995acf8a7af538714913.zip |
add assertions for time-in-mailbox and processing-time
Diffstat (limited to 'kamon-core')
-rw-r--r-- | kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala b/kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala index 646e4159..d06cbb8b 100644 --- a/kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala +++ b/kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala @@ -89,10 +89,20 @@ class ActorMetricsSpec extends TestKitBase with WordSpecLike with Matchers { // let the first snapshot pass metricsListener.expectMsgType[TickMetricSnapshot] - val actorMetrics = expectActorMetrics("user/tracked-mailbox-size-queueing-up", metricsListener, 3 seconds) - actorMetrics.mailboxSize.numberOfMeasurements should equal(1) - actorMetrics.mailboxSize.measurements should contain only (Measurement(9, 1)) // only the automatic last-value recording - actorMetrics.mailboxSize.max should equal(9) + // process the tick in which the actor is stalled. + val stalledTickMetrics = expectActorMetrics("user/tracked-mailbox-size-queueing-up", metricsListener, 2 seconds) + stalledTickMetrics.mailboxSize.numberOfMeasurements should equal(1) + stalledTickMetrics.mailboxSize.measurements should contain only (Measurement(9, 1)) // only the automatic last-value recording + stalledTickMetrics.mailboxSize.max should equal(9) + stalledTickMetrics.processingTime.numberOfMeasurements should be(0L) + stalledTickMetrics.timeInMailbox.numberOfMeasurements should be(0L) + + // process the tick after the actor is unblocked. + val afterStallTickMetrics = expectActorMetrics("user/tracked-mailbox-size-queueing-up", metricsListener, 2 seconds) + afterStallTickMetrics.processingTime.numberOfMeasurements should be(10L) + afterStallTickMetrics.timeInMailbox.numberOfMeasurements should be(10L) + afterStallTickMetrics.processingTime.max should be(2500.milliseconds.toNanos +- 100.milliseconds.toNanos) + afterStallTickMetrics.timeInMailbox.max should be(2500.milliseconds.toNanos +- 100.milliseconds.toNanos) } } |