[KUUBI-198][FOLLOWUP]Fix SparkSessionCache unit test occasionally fails (#200)
* fix travis occasionally fails * ad ut
This commit is contained in:
parent
b6591d3314
commit
f4c08c6f52
@ -93,6 +93,7 @@ private[kyuubi] class FailoverService(name: String, server: KyuubiServer)
|
||||
override private[ha] def reset(): Unit = {
|
||||
info("Reset Zookeeper leader latch")
|
||||
closeLeaderLatch()
|
||||
zkServiceStarted = false
|
||||
startLeaderLatch()
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,19 +108,26 @@ class FailoverServiceSuite extends SparkFunSuite
|
||||
server.init(conf)
|
||||
haService.init(conf)
|
||||
haService.start()
|
||||
Thread.sleep(10000)
|
||||
Thread.sleep(5000)
|
||||
val list = zooKeeperClient.getChildren.forPath("/").asScala.toList
|
||||
assert(list.size === 3)
|
||||
assert(list.contains("kyuubiserver"))
|
||||
assert(list.contains("kyuubiserver-latch"))
|
||||
val l2 = zooKeeperClient.getChildren.forPath("/kyuubiserver").asScala.toList
|
||||
val ns = "kyuubiserver"
|
||||
assert(list.contains(ns))
|
||||
assert(list.contains(ns + "-latch"))
|
||||
val l2 = zooKeeperClient.getChildren.forPath("/" + ns).asScala.toList
|
||||
assert(l2.size === 1)
|
||||
val l3 = zooKeeperClient.getChildren.forPath("/kyuubiserver-latch").asScala.toList
|
||||
val l3 = zooKeeperClient.getChildren.forPath("/" + ns + "-latch").asScala.toList
|
||||
assert(l3.size === 1)
|
||||
haService.reset()
|
||||
Thread.sleep(5000)
|
||||
val l4 = zooKeeperClient.getChildren.forPath("/kyuubiserver-latch").asScala.toList
|
||||
val l4 = zooKeeperClient.getChildren.forPath("/" + ns + "-latch").asScala.toList
|
||||
assert(l4.size === 1)
|
||||
assert(l3.head !== l4.head)
|
||||
|
||||
zooKeeperClient.delete().forPath("/" + ns + "/" + l2.head)
|
||||
Thread.sleep(5000)
|
||||
val l5 = zooKeeperClient.getChildren.forPath("/" + ns + "-latch").asScala.toList
|
||||
assert(l5.size === 1)
|
||||
assert(l5.head !== l4.head)
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ class SparkSessionCacheManagerSuite
|
||||
c.decReuseTimeAndGet
|
||||
c.decReuseTimeAndGet
|
||||
}
|
||||
Thread.sleep(1000)
|
||||
Thread.sleep(5000)
|
||||
assert(cacheManager.getAndIncrease("alice").isEmpty)
|
||||
assert(cacheManager.getAndIncrease("bob").isEmpty)
|
||||
assert(cacheManager.getAndIncrease("tom").isEmpty)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user