Skip to content

Commit

Permalink
twitter-server: Fix flaky LoggingHandler test
Browse files Browse the repository at this point in the history
Motivation

Due to the recent logging addition via TimerStats, depending on timing
this test sometimes sees different output.

Solution

Make the test more resilient to this sort of behavior.

RB_ID=743918
  • Loading branch information
kevinoliver authored and jenkins committed Sep 21, 2015
1 parent 45133d9 commit 6e38982
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package com.twitter.server.handler

import com.twitter.finagle.httpx.{Request, Response, Status}
import com.twitter.io.Charsets
import com.twitter.finagle.httpx.{Request, Status}
import com.twitter.logging.{Level, Logger}
import com.twitter.server.util.HttpUtils._
import com.twitter.util.Await
import org.junit.runner.RunWith
import org.scalatest.FunSuite
import org.scalatest.{Matchers, FunSuite}
import org.scalatest.junit.JUnitRunner

@RunWith(classOf[JUnitRunner])
class LoggingHandlerTest extends FunSuite {
class LoggingHandlerTest extends FunSuite
with Matchers
{
test("query all loggers") {
val handler = new LoggingHandler
val loggers = Logger.iterator
Expand Down Expand Up @@ -61,7 +61,9 @@ class LoggingHandlerTest extends FunSuite {
val res = Await.result(handler(req))
assert(res.status === Status.Ok)
val text = res.contentString
assert(text === "root OFF\nl0 ALL\nl1 DEBUG")
text should include ("root OFF")
text should include ("l0 ALL")
text should include ("l1 DEBUG")
}
}
}

0 comments on commit 6e38982

Please sign in to comment.