Skip to content
This repository has been archived by the owner on Jun 19, 2019. It is now read-only.

Commit

Permalink
add some more tests to make it closer to W3C tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eaceaser committed Mar 26, 2011
1 parent ce4d9a2 commit 3f7b846
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/test/scala/com/twitter/ostrich/stats/JsonStatsSpec.scala
Expand Up @@ -29,6 +29,15 @@ object JsonStatsSpec extends Specification {
handler.clear()
}

"can be called manually" in {
val counters = Map("widgets" -> 3L)
val gauges = Map("wodgets" -> 3.5)
val metrics = Map("timing_msec" -> new Distribution(1, 10, 10, 10))
val labels = Map("this" -> "that")
json.write(StatsSummary(counters, metrics, gauges, labels))
getLine() mustEqual """{"timing_msec":10,"wodgets":3.5,"widgets":3,"this":"that"}"""
}

"can be called transactionally" in {
json { stats =>
stats.setLabel("test", "blah")
Expand All @@ -47,5 +56,13 @@ object JsonStatsSpec extends Specification {
map("test2") mustEqual "crap"
map("test-time_msec").asInstanceOf[Int] must be_>=(0)
}

"sum counts within a transaction" in {
json { stats =>
stats.incr("test", 8)
stats.incr("test", 8)
}
getLine() mustEqual """{"test":16}"""
}
}
}

0 comments on commit 3f7b846

Please sign in to comment.