use of org.apache.hadoop.hdds.client.RatisReplicationConfig in project ozone by apache.
the class TestSCMNodeManager method assertPipelines.
private void assertPipelines(HddsProtos.ReplicationFactor factor, Predicate<Integer> countCheck, Collection<DatanodeDetails> allowedDNs) throws Exception {
Set<String> allowedDnIds = allowedDNs.stream().map(DatanodeDetails::getUuidString).collect(Collectors.toSet());
RatisReplicationConfig replConfig = RatisReplicationConfig.getInstance(factor);
// Wait for the expected number of pipelines using allowed DNs.
GenericTestUtils.waitFor(() -> {
List<Pipeline> pipelines = scm.getPipelineManager().getPipelines(replConfig);
LOG.info("Found {} pipelines of type {} and factor {}.", pipelines.size(), replConfig.getReplicationType(), replConfig.getReplicationFactor());
boolean success = countCheck.test(pipelines.size());
// these pipelines use nodes outside of allowedDNs.
if (success) {
for (Pipeline pipeline : pipelines) {
for (DatanodeDetails pipelineDN : pipeline.getNodes()) {
// never be used once we have the expected number of pipelines.
if (!allowedDnIds.contains(pipelineDN.getUuidString())) {
String message = String.format("Pipeline %s used datanode %s " + "which is not in the set of allowed datanodes: %s", pipeline.getId().toString(), pipelineDN.getUuidString(), allowedDnIds.toString());
Assert.fail(message);
}
}
}
}
return success;
}, 1000, 10000);
}
Aggregations