Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add some more tests to make it closer to W3C tests

  • Loading branch information...
commit 3f7b84626b3d966507f3414d1a0fcb2924c11dbe 1 parent ce4d9a2
eaceaser authored
Showing with 17 additions and 0 deletions.
  1. +17 −0 src/test/scala/com/twitter/ostrich/stats/JsonStatsSpec.scala
View
17 src/test/scala/com/twitter/ostrich/stats/JsonStatsSpec.scala
@@ -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")
@@ -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}"""
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.