use of org.apache.kafka.trogdor.common.CapturingCommandRunner in project kafka by apache.
the class CoordinatorTest method testNetworkPartitionFault.
@Test
public void testNetworkPartitionFault() throws Exception {
CapturingCommandRunner runner = new CapturingCommandRunner();
MockTime time = new MockTime(0, 0, 0);
Scheduler scheduler = new MockScheduler(time);
try (MiniTrogdorCluster cluster = new MiniTrogdorCluster.Builder().addCoordinator("node01").addAgent("node01").addAgent("node02").addAgent("node03").commandRunner(runner).scheduler(scheduler).build()) {
CoordinatorClient coordinatorClient = cluster.coordinatorClient();
NetworkPartitionFaultSpec spec = new NetworkPartitionFaultSpec(0, Long.MAX_VALUE, createPartitionLists(new String[][] { new String[] { "node01", "node02" }, new String[] { "node03" } }));
coordinatorClient.createTask(new CreateTaskRequest("netpart", spec));
new ExpectedTasks().addTask(new ExpectedTaskBuilder("netpart").taskSpec(spec).build()).waitFor(coordinatorClient);
checkLines("-A", runner);
}
checkLines("-D", runner);
}
use of org.apache.kafka.trogdor.common.CapturingCommandRunner in project apache-kafka-on-k8s by banzaicloud.
the class CoordinatorTest method testNetworkPartitionFault.
@Test
public void testNetworkPartitionFault() throws Exception {
CapturingCommandRunner runner = new CapturingCommandRunner();
try (MiniTrogdorCluster cluster = new MiniTrogdorCluster.Builder().addCoordinator("node01").addAgent("node01").addAgent("node02").addAgent("node03").commandRunner(runner).build()) {
CoordinatorClient coordinatorClient = cluster.coordinatorClient();
NetworkPartitionFaultSpec spec = new NetworkPartitionFaultSpec(0, Long.MAX_VALUE, createPartitionLists(new String[][] { new String[] { "node01", "node02" }, new String[] { "node03" } }));
coordinatorClient.createTask(new CreateTaskRequest("netpart", spec));
new ExpectedTasks().addTask(new ExpectedTaskBuilder("netpart").taskSpec(spec).build()).waitFor(coordinatorClient);
checkLines("-A", runner);
}
checkLines("-D", runner);
}
Aggregations