Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/scala.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Scala CI

on: [push]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11.0
- name: Run tests
run: sbt test
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class RackUnawareStrategyTest extends FunSuite {
tokenMetadata.update(newToken(), InetAddressAndPort.create("10.10.10.14", 8000))
val rackUnawareStrategy = new RackUnawareStrategy(tokenMetadata)

assert(2 == getEndPoints(rackUnawareStrategy, "5"))
assert(2 == getEndPoints(rackUnawareStrategy, "5").length)
}


Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/org/dist/queue/AdminUtilsTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import scala.collection.{Map, mutable}
class AdminUtilsTest extends ZookeeperTestHarness {

test("should create assign replicas to topic partitions") {
val value: collection.Map[Int, collection.Seq[Int]] = AdminUtils.assignReplicasToBrokers(Seq(0, 1), 1, 1)
assert(value(0) == List(1))
val value: collection.Map[Int, collection.Seq[Int]] = AdminUtils.assignReplicasToBrokers(Seq(0, 1), 1, 1, 0)
assert(value(0) == List(0))
}

test("should spread replicas on other brokers") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.dist.util.Networks

import scala.jdk.CollectionConverters._


// TODO Flaky test. Code block ("clean up") towards the end is an attempt to fix the flakiness
class ControllerZookeeperFailureTests extends ZookeeperTestHarness {
test("should elect new broker as leader once controller shuts down") {
val broker1 = newBroker(1)
Expand Down Expand Up @@ -54,6 +54,11 @@ class ControllerZookeeperFailureTests extends ZookeeperTestHarness {
partitionReplicaLeaderInfo.foreach(leaderAndReplicas => {
assert(leaderAndReplicas.partitionStateInfo.leader.id != 1)
})

// Clean up
broker2.shutdown()
broker3.shutdown()
Thread.sleep(1000) // Delay for brokers to finish shutting down.
}

def testSocketServer(server: Server) = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ class ProducerConsumerTest extends ZookeeperTestHarness with Logging {
assert(messages.get("key1") == "message1")
assert(messages.get("key2") == "message2")
assert(messages.get("key3") == "message3")

// Clean up
broker1.shutdown()
broker2.shutdown()
broker3.shutdown()
broker4.shutdown()
broker5.shutdown()
Thread.sleep(1000) // Delay for brokers to finish shutting down.
}

private def leaderCache(broker: Server) = {
Expand Down