@Test public void testDescribeSpotPriceHistoryInRegion() { for (String region : Region.DEFAULT_REGIONS) { Set<Spot> spots = client.getSpotInstanceApi().get().describeSpotPriceHistoryInRegion(region, from(new Date())); assertNotNull(spots); assert !spots.isEmpty(); for (Spot spot : spots) { assert spot.getSpotPrice() > 0 : spots; assertEquals(spot.getRegion(), region); assert in( ImmutableSet.of("Linux/UNIX", "Linux/UNIX (Amazon VPC)", "SUSE Linux", "SUSE Linux (Amazon VPC)", "Windows", "Windows (Amazon VPC)")).apply(spot.getProductDescription()) : spot; assert // sometimes get D2 type, which we don't yet enumerate spot.getInstanceType().startsWith("d2.") || in(ImmutableSet.of("c1.medium", "c1.xlarge", "cc1.4xlarge", "cg1.4xlarge", "cc2.8xlarge", "m1.large", "m1.small", "m1.medium", "m1.xlarge", "m2.2xlarge", "m2.4xlarge", "m2.xlarge", "m3.xlarge", "m3.2xlarge", "t1.micro", "cr1.8xlarge", "c4.large", "c4.xlarge", "c4.2xlarge", "c4.4xlarge", "c4.8xlarge")).apply(spot.getInstanceType()) : spot; } } }
public void describeSpotPriceHistoryInRegion() throws Exception { enqueueRegions(DEFAULT_REGION); enqueueXml(DEFAULT_REGION, "/describe_spot_price_history.xml"); Set<Spot> result = spotApi().describeSpotPriceHistoryInRegion(DEFAULT_REGION); assertEquals(result.size(), 3); assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); assertPosted(DEFAULT_REGION, "Action=DescribeSpotPriceHistory"); }
public void describeSpotPriceHistoryInRegionOptions() throws Exception { enqueueRegions(DEFAULT_REGION); enqueueXml(DEFAULT_REGION, "/describe_spot_price_history.xml"); Date from = new Date(12345678910L); Date to = new Date(1234567891011L); Set<Spot> result = spotApi().describeSpotPriceHistoryInRegion(DEFAULT_REGION, from(from).to(to).productDescription("description").instanceType("m1.small")); assertEquals(result.size(), 3); assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); assertPosted(DEFAULT_REGION, "Action=DescribeSpotPriceHistory&StartTime=1970-05-23T21%3A21%3A18.910Z&EndTime=2009-02-13T23%3A31%3A31.011Z&ProductDescription=description&InstanceType.1=m1.small"); }
public void describeSpotPriceHistoryInRegion_404() throws Exception { enqueueRegions(DEFAULT_REGION); enqueue(DEFAULT_REGION, new MockResponse().setResponseCode(404)); Set<Spot> result = spotApi().describeSpotPriceHistoryInRegion(DEFAULT_REGION); assertTrue(result.isEmpty()); assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); assertPosted(DEFAULT_REGION, "Action=DescribeSpotPriceHistory"); }