diff --git a/zipkin-test/src/test/scala/com/twitter/zipkin/ZipkinSpec.scala b/zipkin-test/src/test/scala/com/twitter/zipkin/ZipkinSpec.scala index 25905e72c4a..da44b771ca6 100644 --- a/zipkin-test/src/test/scala/com/twitter/zipkin/ZipkinSpec.scala +++ b/zipkin-test/src/test/scala/com/twitter/zipkin/ZipkinSpec.scala @@ -47,6 +47,8 @@ class ZipkinSpec extends Specification with JMocker with ClassMocker { var collectorTransport: Service[ThriftClientRequest, Array[Byte]] = null var query: ZipkinQuery = null var queryTransport: Service[ThriftClientRequest, Array[Byte]] = null + var zooKeeperServer: ZooKeeperServer = null + var connectionFactory: NIOServerCnxn.Factory = null "ZipkinCollector and ZipkinQuery" should { doBefore { @@ -56,9 +58,9 @@ class ZipkinSpec extends Specification with JMocker with ClassMocker { // start a temporary zookeeper server val zkPort = 2181 // TODO pick another port? val tmpDir = FileUtils.createTempDir() - val zooKeeperServer = + zooKeeperServer = new ZooKeeperServer(new FileTxnSnapLog(tmpDir, tmpDir), new BasicDataTreeBuilder()) - val connectionFactory = new NIOServerCnxn.Factory(new InetSocketAddress(zkPort)) + connectionFactory = new NIOServerCnxn.Factory(new InetSocketAddress(zkPort)) connectionFactory.startup(zooKeeperServer) // no need to register in serversets @@ -106,6 +108,9 @@ class ZipkinSpec extends Specification with JMocker with ClassMocker { queryTransport.release() query.shutdown() + zooKeeperServer.shutdown() + connectionFactory.shutdown() + FakeServer.stop() }