}
@Test(timeout = TestConstants.ITEST_TIMEOUT)
public void testFirewallAuthorizationIsIdempotent() throws IOException {
if (EC2ComputeService.class.isInstance(context.getComputeService())) {
EC2Api api = context.unwrapApi(EC2Api.class);
String groupName = "jclouds#" + clusterSpec.getClusterName();
api.getSecurityGroupApi().get().createSecurityGroupInRegion(region, groupName, "group description");
try {
manager.addRule(
Rule.create().destination(instances).port(23344)
);
/* The second call should not throw an exception. */
manager.addRule(
Rule.create().destination(instances).port(23344)
);
manager.authorizeAllRules();
} finally {
api.getSecurityGroupApi().get()
.deleteSecurityGroupInRegion(region, groupName);
}
}
}