use of io.fabric8.api.SshConfiguration in project fabric8 by jboss-fuse.
the class SshAutoScalerTest method assertMaximumContainerCountNotExceeded.
/**
* lets assert that no host has more than its maximum number of containers
*/
public static void assertMaximumContainerCountNotExceeded(FabricRequirements requirements, Map<String, CountingMap> hostToProfileCounts) {
for (Map.Entry<String, CountingMap> entry : hostToProfileCounts.entrySet()) {
String hostName = entry.getKey();
CountingMap counts = entry.getValue();
int total = counts.total();
SshConfiguration sshConfiguration = requirements.getSshConfiguration();
assertNotNull("Should have a sshConfiguration!", sshConfiguration);
SshHostConfiguration hostConfiguration = sshConfiguration.getHost(hostName);
assertNotNull("Should have a hosts configuration for host " + hostName, hostConfiguration);
Integer maximumContainerCount = hostConfiguration.getMaximumContainerCount();
if (maximumContainerCount != null) {
assertTrue("Host " + hostName + " has a maximum container count of " + maximumContainerCount + " but was " + total, total <= maximumContainerCount);
}
}
}
Aggregations