use of com.sequenceiq.cloudbreak.cloud.context.CloudContext.Builder in project cloudbreak by hortonworks.
the class AwsPlatformResourcesTest method collectInstanceStorageCountWhenInstanceTypeIsNotFoundTest.
@Test
void collectInstanceStorageCountWhenInstanceTypeIsNotFoundTest() {
ReflectionTestUtils.setField(underTest, "disabledInstanceTypes", Collections.emptyList());
CloudContext cloudContext = new Builder().withLocation(Location.location(region, availabilityZone(AZ_NAME))).build();
AuthenticatedContext ac = new AuthenticatedContext(cloudContext, cloudCredential);
InstanceStoreMetadata instanceStoreMetadata = underTest.collectInstanceStorageCount(ac, Collections.singletonList("unsupported"), List.of());
assertNull(instanceStoreMetadata.mapInstanceTypeToInstanceStoreCount("unsupported"));
assertEquals(0, instanceStoreMetadata.mapInstanceTypeToInstanceStoreCountNullHandled("unsupported"));
assertNull(instanceStoreMetadata.mapInstanceTypeToInstanceStoreCount("m5.2xlarge"));
assertEquals(0, instanceStoreMetadata.mapInstanceTypeToInstanceStoreCountNullHandled("m5.2xlarge"));
instanceStoreMetadata = underTest.collectInstanceStorageCount(ac, new ArrayList<>(), List.of());
assertNull(instanceStoreMetadata.mapInstanceTypeToInstanceStoreCount("m5.2xlarge"));
assertEquals(0, instanceStoreMetadata.mapInstanceTypeToInstanceStoreCountNullHandled("m5.2xlarge"));
}
use of com.sequenceiq.cloudbreak.cloud.context.CloudContext.Builder in project cloudbreak by hortonworks.
the class AwsPlatformResourcesTest method collectInstanceStorageCountTest.
@Test
void collectInstanceStorageCountTest() {
ReflectionTestUtils.setField(underTest, "disabledInstanceTypes", Collections.emptyList());
CloudContext cloudContext = new Builder().withLocation(Location.location(region, availabilityZone(AZ_NAME))).build();
AuthenticatedContext ac = new AuthenticatedContext(cloudContext, cloudCredential);
InstanceStoreMetadata instanceStoreMetadata = underTest.collectInstanceStorageCount(ac, Collections.singletonList("m5.2xlarge"), List.of());
assertEquals(2, instanceStoreMetadata.mapInstanceTypeToInstanceStoreCount("m5.2xlarge"));
assertEquals(0, instanceStoreMetadata.mapInstanceTypeToInstanceStoreCountNullHandled("unsupported"));
}
Aggregations