Source:
<code>public void testRaceCondition() throws InterruptedException { int taskShutdownInMs = (int) (Math.random() * 10000); CountDownLatch containerShutdownLatch = new CountDownLatch(1); Map<String, String> configs = new HashMap<>(); configs.put(JobCoordinatorConfig.JOB_COORDINATOR_FACTORY, "org.apache.samza.standalone.PassthroughJobCoordinatorFactory"); <START> configs.put(JobCoordinatorConfig.JOB_COORDINATION_UTILS_FACTORY, "org.apache.samza.standalone.PassthroughCoordinationUtilsFactory"); <END> configs.put(JobConfig.PROCESSOR_ID(), "0"); configs.put(TaskConfig.GROUPER_FACTORY(), "org.apache.samza.container.grouper.task.GroupByContainerIdsFactory"); configs.put(FaultInjectionStreamApp.INPUT_TOPIC_NAME_PROP, "page-views"); configs.put(TaskConfig.INPUT_STREAMS(), "kafka.page-views"); configs.put("task.shutdown.ms", Integer.toString(taskShutdownInMs)); configs.put(JobConfig.PROCESSOR_ID(), "0"); createTopic(PAGE_VIEWS, 2); produceMessage(PAGE_VIEWS, 0, "p1", "{\"viewId\":\"v1\",\"pageId\":\"p1\",\"userId\":\"u1\"}"); produceMessage(PAGE_VIEWS, 1, "p2", "{\"viewId\":\"v2\",\"pageId\":\"p2\",\"userId\":\"u1\"}"); FaultInjectionStreamApp app = new FaultInjectionStreamApp(); FaultInjectionStreamApp.containerShutdownLatch = containerShutdownLatch; RunApplicationContext context = runApplication(app, "fault-injection-app", configs); containerShutdownLatch.await(); context.getRunner().kill(); context.getRunner().waitForFinish(); assertEquals(context.getRunner().status(), ApplicationStatus.UnsuccessfulFinish); }</code><technical_language>This idea is a good one, is test this ZkJobCoordinatorFactory (in zookeeper world). Brooklin is removing support for pass-through coordinator is recommending existing users migrate Zk-Standalone. useful if ZkJobcoordinator here(since PassthroughCoordinator deprecated sooner if works in ZkJobCoordinator(complicated case), work in passThroughCoordinator well)</technical_language>

Target:
public void testRaceCondition() throws InterruptedException { int taskShutdownInMs = (int) (Math.random() * 10000); CountDownLatch containerShutdownLatch = new CountDownLatch(1); Map<String, String> configs = new HashMap<>(); configs.put(JobCoordinatorConfig.JOB_COORDINATOR_FACTORY, "org.apache.samza.zk.ZkJobCoordinatorFactory"); configs.put(JobCoordinatorConfig.JOB_COORDINATION_UTILS_FACTORY, "org.apache.samza.zk.ZkCoordinationUtilsFactory"); configs.put(JobConfig.PROCESSOR_ID(), "0"); configs.put(TaskConfig.GROUPER_FACTORY(), "org.apache.samza.container.grouper.task.GroupByContainerIdsFactory"); configs.put(FaultInjectionStreamApp.INPUT_TOPIC_NAME_PROP, "page-views"); configs.put(TaskConfig.INPUT_STREAMS(), "kafka.page-views"); configs.put(ZkConfig.ZK_CONNECT, zkConnect()); configs.put(JobConfig.JOB_DEBOUNCE_TIME_MS(), "5000"); configs.put("task.shutdown.ms", Integer.toString(taskShutdownInMs)); configs.put(JobConfig.PROCESSOR_ID(), "0"); createTopic(PAGE_VIEWS, 2); produceMessage(PAGE_VIEWS, 0, "p1", "{\"viewId\":\"v1\",\"pageId\":\"p1\",\"userId\":\"u1\"}"); produceMessage(PAGE_VIEWS, 1, "p2", "{\"viewId\":\"v2\",\"pageId\":\"p2\",\"userId\":\"u1\"}"); FaultInjectionStreamApp app = new FaultInjectionStreamApp(); FaultInjectionStreamApp.containerShutdownLatch = containerShutdownLatch; RunApplicationContext context = runApplication(app, "fault-injection-app", configs); containerShutdownLatch.await(); context.getRunner().kill(); context.getRunner().waitForFinish(); assertEquals(context.getRunner().status(), ApplicationStatus.UnsuccessfulFinish); }