Check if leader election is complete during tests
This commit is contained in:
committed by
Artem Bilan
parent
108197cffd
commit
9ddc4e6d12
@@ -19,6 +19,7 @@ package org.springframework.integration.kafka.util;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import kafka.common.LeaderNotAvailableException;
|
||||
import org.I0Itec.zkclient.ZkClient;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -142,6 +143,9 @@ public class TopicUtils {
|
||||
if (partitionMetadata.errorCode() != ErrorMapping.NoError()) {
|
||||
throw (Exception) ErrorMapping.exceptionFor(partitionMetadata.errorCode());
|
||||
}
|
||||
if (partitionMetadata.leader() == null) {
|
||||
throw new LeaderNotAvailableException();
|
||||
}
|
||||
}
|
||||
return topicMetadata;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user