Commit Graph

10 Commits

Author SHA1 Message Date
Jake Champlin 49697eb5de
provider/aws: Fix spot_fleet request tests
Due to the fact that an iam_policy_attachment can only be used once PER iam_policy, these changes create a specific iam_policy for each test, so that when they are ran in parallel we will no longer get the iam_policy_attachment clobbers that we've gotten previously.

```
##teamcity[testStarted timestamp='2017-02-08T09:11:38.361' name='TestAccAWSSpotFleetRequest_CannotUseEmptyKeyName']
##teamcity[testStdOut name='TestAccAWSSpotFleetRequest_CannotUseEmptyKeyName' out='=== RUN   TestAccAWSSpotFleetRequest_CannotUseEmptyKeyName|n--- PASS: TestAccAWSSpotFleetRequest_CannotUseEmptyKeyName (0.00s)|
nPASS|n']
##teamcity[testStdErr name='TestAccAWSSpotFleetRequest_CannotUseEmptyKeyName' out='']
##teamcity[testFinished timestamp='2017-02-08T09:11:38.420' name='TestAccAWSSpotFleetRequest_CannotUseEmptyKeyName']
##teamcity[testStarted timestamp='2017-02-08T09:11:38.361' name='TestAccAWSSpotFleetRequest_lowestPriceAzOrSubnetInRegion']
##teamcity[testStdOut name='TestAccAWSSpotFleetRequest_lowestPriceAzOrSubnetInRegion' out='=== RUN   TestAccAWSSpotFleetRequest_lowestPriceAzOrSubnetInRegion|n--- PASS: TestAccAWSSpotFleetRequest_lowestPriceAzO
rSubnetInRegion (54.59s)|nPASS|n']
##teamcity[testStdErr name='TestAccAWSSpotFleetRequest_lowestPriceAzOrSubnetInRegion' out='']
##teamcity[testFinished timestamp='2017-02-08T09:12:33.046' name='TestAccAWSSpotFleetRequest_lowestPriceAzOrSubnetInRegion']
##teamcity[testStarted timestamp='2017-02-08T09:11:38.361' name='TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameAz']
##teamcity[testStdOut name='TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameAz' out='=== RUN   TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameAz|n--- PASS: TestAccAWSSpotFleetRequest_multipleInstan
ceTypesInSameAz (55.50s)|nPASS|n']
##teamcity[testStdErr name='TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameAz' out='']
##teamcity[testFinished timestamp='2017-02-08T09:12:33.937' name='TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameAz']
##teamcity[testStarted timestamp='2017-02-08T09:11:38.361' name='TestAccAWSSpotFleetRequest_lowestPriceAzInGivenList']
##teamcity[testStdOut name='TestAccAWSSpotFleetRequest_lowestPriceAzInGivenList' out='=== RUN   TestAccAWSSpotFleetRequest_lowestPriceAzInGivenList|n--- PASS: TestAccAWSSpotFleetRequest_lowestPriceAzInGivenList
 (56.05s)|nPASS|n']
##teamcity[testStdErr name='TestAccAWSSpotFleetRequest_lowestPriceAzInGivenList' out='']
##teamcity[testFinished timestamp='2017-02-08T09:12:34.492' name='TestAccAWSSpotFleetRequest_lowestPriceAzInGivenList']
##teamcity[testStarted timestamp='2017-02-08T09:11:38.361' name='TestAccAWSSpotFleetRequest_withEBSDisk']
##teamcity[testStdOut name='TestAccAWSSpotFleetRequest_withEBSDisk' out='=== RUN   TestAccAWSSpotFleetRequest_withEBSDisk|n--- PASS: TestAccAWSSpotFleetRequest_withEBSDisk (58.02s)|nPASS|n']
##teamcity[testStdErr name='TestAccAWSSpotFleetRequest_withEBSDisk' out='']
##teamcity[testFinished timestamp='2017-02-08T09:12:36.457' name='TestAccAWSSpotFleetRequest_withEBSDisk']
##teamcity[testStarted timestamp='2017-02-08T09:11:38.362' name='TestAccAWSSpotFleetRequest_overriddingSpotPrice']
##teamcity[testStdOut name='TestAccAWSSpotFleetRequest_overriddingSpotPrice' out='=== RUN   TestAccAWSSpotFleetRequest_overriddingSpotPrice|n--- PASS: TestAccAWSSpotFleetRequest_overriddingSpotPrice (58.84s)|nP
ASS|n']
##teamcity[testStdErr name='TestAccAWSSpotFleetRequest_overriddingSpotPrice' out='']
##teamcity[testFinished timestamp='2017-02-08T09:12:37.286' name='TestAccAWSSpotFleetRequest_overriddingSpotPrice']
##teamcity[testStarted timestamp='2017-02-08T09:11:38.362' name='TestAccAWSSpotFleetRequest_lowestPriceSubnetInGivenList']
##teamcity[testStdOut name='TestAccAWSSpotFleetRequest_lowestPriceSubnetInGivenList' out='=== RUN   TestAccAWSSpotFleetRequest_lowestPriceSubnetInGivenList|n--- PASS: TestAccAWSSpotFleetRequest_lowestPriceSubne
tInGivenList (60.75s)|nPASS|n']
##teamcity[testStdErr name='TestAccAWSSpotFleetRequest_lowestPriceSubnetInGivenList' out='']
##teamcity[testFinished timestamp='2017-02-08T09:12:39.206' name='TestAccAWSSpotFleetRequest_lowestPriceSubnetInGivenList']
##teamcity[testStarted timestamp='2017-02-08T09:11:38.362' name='TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameSubnet']
##teamcity[testStdOut name='TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameSubnet' out='=== RUN   TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameSubnet|n--- PASS: TestAccAWSSpotFleetRequest_multip
leInstanceTypesInSameSubnet (61.80s)|nPASS|n']
##teamcity[testStdErr name='TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameSubnet' out='']
##teamcity[testFinished timestamp='2017-02-08T09:12:40.241' name='TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameSubnet']
##teamcity[testStarted timestamp='2017-02-08T09:11:38.361' name='TestAccAWSSpotFleetRequest_changePriceForcesNewRequest']
##teamcity[testStdOut name='TestAccAWSSpotFleetRequest_changePriceForcesNewRequest' out='=== RUN   TestAccAWSSpotFleetRequest_changePriceForcesNewRequest|n--- PASS: TestAccAWSSpotFleetRequest_changePriceForcesN
ewRequest (98.70s)|nPASS|n']
##teamcity[testStdErr name='TestAccAWSSpotFleetRequest_changePriceForcesNewRequest' out='']
##teamcity[testFinished timestamp='2017-02-08T09:13:17.142' name='TestAccAWSSpotFleetRequest_changePriceForcesNewRequest']
##teamcity[testStarted timestamp='2017-02-08T09:11:38.361' name='TestAccAWSSpotFleetRequest_withWeightedCapacity']
##teamcity[testStdOut name='TestAccAWSSpotFleetRequest_withWeightedCapacity' out='=== RUN   TestAccAWSSpotFleetRequest_withWeightedCapacity|n--- PASS: TestAccAWSSpotFleetRequest_withWeightedCapacity (269.12s)|n
PASS|n']
##teamcity[testStdErr name='TestAccAWSSpotFleetRequest_withWeightedCapacity' out='']
##teamcity[testFinished timestamp='2017-02-08T09:16:07.554' name='TestAccAWSSpotFleetRequest_withWeightedCapacity']
##teamcity[testStarted timestamp='2017-02-08T09:11:38.361' name='TestAccAWSSpotFleetRequest_diversifiedAllocation']
##teamcity[testStdOut name='TestAccAWSSpotFleetRequest_diversifiedAllocation' out='=== RUN   TestAccAWSSpotFleetRequest_diversifiedAllocation|n--- PASS: TestAccAWSSpotFleetRequest_diversifiedAllocation (348.36s
)|nPASS|n']
##teamcity[testStdErr name='TestAccAWSSpotFleetRequest_diversifiedAllocation' out='']
##teamcity[testFinished timestamp='2017-02-08T09:17:26.802' name='TestAccAWSSpotFleetRequest_diversifiedAllocation']
```
2017-02-08 09:20:19 -05:00
Jake Champlin e4a36c3d7a
provider/aws: Better handle parallel tests spot-fleet-req
Better handle parallel testing of the `aws_spot_fleet_request` resource. Previously we were catching a lot of errors due to naming the policy_attachment resource the same between tests.
2017-02-02 12:48:52 -05:00
Paddy 24dd4273c7 Add an acceptance test for adding EBS volumes to a spot fleet req
Spot fleet requests can have EBS volumes attached to them, and at
the moment we're getting reports that crashes can be experienced
with them. This adds an acceptance test that exercises creating
a Spot Fleet request that has a non-instance EBS volume attached.
This successfully reproduces the panic.
2016-11-03 16:19:50 -07:00
Clint becdfef87b provider/aws: Wait for Spot Fleet to drain before removing from state (#8938)
* provider/aws: Wait for Spot Fleet to drain before removing from state

Ensures the spot fleet is drained before reporting successful destroy
and moving on

* remove unreachable code

* hack to sleep and test regression/leak

* fix broken english in warning
2016-09-22 15:22:27 -05:00
stack72 4d2b9cb167
provider/aws: `aws_spot_fleet_request` was leaving orphaned instances
running

Each nightly build was leaving multiple instances running. The issue is
that the IAM role we were using didn't have access to Terminate the EC2
instances

The role was missing the ec2 principle
2016-08-31 11:25:08 +01:00
Paul Stack 7949a30a07 provider/aws: Randomize the key_pair used in the (#8472)
`aws_spot_fleet_request` acceptance tests
2016-08-25 14:40:57 +01:00
Paul Stack e524603d3f provider/aws: AWS SpotFleet Requests now works with Subnets and AZs (#8320)
* provider/aws: Change Spot Fleet Request to allow a combination of
subnet_id and availability_zone

Also added a complete set of tests that reflect all of the use cases
that Amazon document
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-fleet-examples.html

It is important to note there that Terraform will be suggesting that
users create multiple launch configurations rather than AWS's version of
combing values into CSV based parameters. This will ensure that we are
able to enforce the correct state

Also note that `associate_public_ip_address` now defaults to `false` - a migration has been
included in this PR to migration users of this functionality. This needs
to be noted in the changelog. The last part of changing functionality
here is waiting for the state of the request to become `active`. Before
we get to this state, we cannot guarantee that Amazon have accepted the
request or it could have failed validation.

```
% make testacc TEST=./builtin/providers/aws
% TESTARGS='-run=TestAccAWSSpotFleetRequest_'
% 2 ↵
==> Checking that code complies with gofmt requirements...
/Users/stacko/Code/go/bin/stringer
go generate $(go list ./... | grep -v /terraform/vendor/)
2016/08/22 15:44:21 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v
-run=TestAccAWSSpotFleetRequest_ -timeout 120m
=== RUN   TestAccAWSSpotFleetRequest_changePriceForcesNewRequest
--- PASS: TestAccAWSSpotFleetRequest_changePriceForcesNewRequest (133.90s)
=== RUN   TestAccAWSSpotFleetRequest_lowestPriceAzOrSubnetInRegion
--- PASS: TestAccAWSSpotFleetRequest_lowestPriceAzOrSubnetInRegion (76.67s)
=== RUN   TestAccAWSSpotFleetRequest_lowestPriceAzInGivenList
--- PASS: TestAccAWSSpotFleetRequest_lowestPriceAzInGivenList (75.22s)
=== RUN   TestAccAWSSpotFleetRequest_lowestPriceSubnetInGivenList
--- PASS: TestAccAWSSpotFleetRequest_lowestPriceSubnetInGivenList (96.95s)
=== RUN   TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameAz
--- PASS: TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameAz (74.44s)
=== RUN   TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameSubnet
--- PASS: TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameSubnet (97.82s)
=== RUN   TestAccAWSSpotFleetRequest_overriddingSpotPrice
--- PASS: TestAccAWSSpotFleetRequest_overriddingSpotPrice (76.22s)
=== RUN   TestAccAWSSpotFleetRequest_diversifiedAllocation
--- PASS: TestAccAWSSpotFleetRequest_diversifiedAllocation (79.81s)
=== RUN   TestAccAWSSpotFleetRequest_withWeightedCapacity
--- PASS: TestAccAWSSpotFleetRequest_withWeightedCapacity (77.15s)
=== RUN   TestAccAWSSpotFleetRequest_CannotUseEmptyKeyName
--- PASS: TestAccAWSSpotFleetRequest_CannotUseEmptyKeyName (0.00s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    788.184s
```

* Update resource_aws_spot_fleet_request.go
2016-08-24 11:08:46 +01:00
Paul Stack 6d2e81dfbe provider/aws: `aws_spot_fleet_request` throws panic on missing subnet_id (#8217)
or availability_zone

Fixes #8000

There was a hard coded panic in the code!!!

```
panic(
				fmt.Sprintf(
					"Must set one of:\navailability_zone %#v\nsubnet_id: %#v",
					m["availability_zone"],
					m["subnet_id"])
			)
```

This was causing issues when we set neither an availability zone or a subnet id.
This has been removed and is now handled with an error rather than a panic.

This was what happened with the new test before the fix:

```
=== RUN   TestAccAWSSpotFleetRequest_brokenLaunchSpecification
panic: Must set one of:
availability_zone ""
subnet_id: ""
goroutine 129 [running]:
panic(0x11377a0, 0xc8202abfc0)
	/opt/boxen/homebrew/Cellar/go/1.6.2/libexec/src/runtime/panic.go:481 +0x3e6
github.com/hashicorp/terraform/builtin/providers/aws.hashLaunchSpecification(0x11361a0, 0xc8202e07e0, 0xc800000001)
	/Users/stacko/Code/go/src/github.com/hashicorp/terraform/builtin/providers/aws/resource_aws_spot_fleet_request.go:953 +0x685
github.com/hashicorp/terraform/helper/schema.(*Set).hash(0xc82005ae00, 0x11361a0, 0xc8202e07e0, 0x0, 0x0)
	/Users/stacko/Code/go/src/github.com/hashicorp/terraform/helper/schema/set.go:180 +0x40
github.com/hashicorp/terraform/helper/schema.(*Set).add(0xc82005ae00, 0x11361a0, 0xc8202e07e0, 0xc820276900, 0x0, 0x0)
```

The test then ran fine after the fix:

```
% make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSSpotFleetRequest_brokenLaunchSpecification'
==> Checking that code complies with gofmt requirements...
/Users/stacko/Code/go/bin/stringer
go generate $(go list ./... | grep -v /terraform/vendor/)
2016/08/16 08:03:18 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSSpotFleetRequest_brokenLaunchSpecification -timeout 120m
=== RUN   TestAccAWSSpotFleetRequest_brokenLaunchSpecification
--- PASS: TestAccAWSSpotFleetRequest_brokenLaunchSpecification (32.37s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/aws	32.384s
```

Full test run looks as follows:

```
% make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSSpotFleetRequest_'                     ✹
==> Checking that code complies with gofmt requirements...
/Users/stacko/Code/go/bin/stringer
go generate $(go list ./... | grep -v /terraform/vendor/)
2016/08/16 08:04:34 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSSpotFleetRequest_ -timeout 120m
=== RUN   TestAccAWSSpotFleetRequest_basic
--- PASS: TestAccAWSSpotFleetRequest_basic (33.78s)
=== RUN   TestAccAWSSpotFleetRequest_brokenLaunchSpecification
--- PASS: TestAccAWSSpotFleetRequest_brokenLaunchSpecification (33.59s)
=== RUN   TestAccAWSSpotFleetRequest_launchConfiguration
--- PASS: TestAccAWSSpotFleetRequest_launchConfiguration (35.26s)
=== RUN   TestAccAWSSpotFleetRequest_CannotUseEmptyKeyName
--- PASS: TestAccAWSSpotFleetRequest_CannotUseEmptyKeyName (0.00s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/aws	102.648s
```
2016-08-16 17:55:06 +01:00
stack72 86fcabc651 provider/aws: Changing test parameters to be us-west-2 based 2016-06-23 08:13:49 +01:00
Keshav Varma 58bd6dfb02 Add an AWS Spot fleet resource 2016-06-21 17:31:30 -07:00