Added failing aws_route test that shows diff after apply.

This commit is contained in:
Brad Sickles 2016-02-25 08:53:18 -05:00 committed by stack72
parent 13a3387996
commit 16f94ed4b7
1 changed files with 71 additions and 2 deletions

View File

@ -32,7 +32,9 @@ func TestAccAWSRoute_basic(t *testing.T) {
} }
resource.Test(t, resource.TestCase{ resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) }, PreCheck: func() {
testAccPreCheck(t)
},
Providers: testAccProviders, Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRouteDestroy, CheckDestroy: testAccCheckAWSRouteDestroy,
Steps: []resource.TestStep{ Steps: []resource.TestStep{
@ -93,7 +95,9 @@ func TestAccAWSRoute_changeCidr(t *testing.T) {
} }
resource.Test(t, resource.TestCase{ resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) }, PreCheck: func() {
testAccPreCheck(t)
},
Providers: testAccProviders, Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRouteDestroy, CheckDestroy: testAccCheckAWSRouteDestroy,
Steps: []resource.TestStep{ Steps: []resource.TestStep{
@ -116,6 +120,44 @@ func TestAccAWSRoute_changeCidr(t *testing.T) {
}) })
} }
func TestAccAWSRoute_noopdiff(t *testing.T) {
var route ec2.Route
var routeTable ec2.RouteTable
testCheck := func(s *terraform.State) error {
return nil
}
testCheckChange := func(s *terraform.State) error {
return nil
}
resource.Test(t, resource.TestCase{
PreCheck: func() {
testAccPreCheck(t)
},
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRouteDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccAWSRouteNoopChange,
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSRouteExists("aws_route.test", &route),
testCheck,
),
},
resource.TestStep{
Config: testAccAWSRouteNoopChange,
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSRouteExists("aws_route.test", &route),
testAccCheckRouteTableExists("aws_route_table.test", &routeTable),
testCheckChange,
),
},
},
})
}
// Acceptance test if mixed inline and external routes are implemented // Acceptance test if mixed inline and external routes are implemented
/* /*
func TestAccAWSRoute_mix(t *testing.T) { func TestAccAWSRoute_mix(t *testing.T) {
@ -296,3 +338,30 @@ resource "aws_route" "bar" {
gateway_id = "${aws_internet_gateway.foo.id}" gateway_id = "${aws_internet_gateway.foo.id}"
} }
`) `)
var testAccAWSRouteNoopChange = fmt.Sprint(`
resource "aws_vpc" "test" {
cidr_block = "10.10.0.0/16"
}
resource "aws_route_table" "test" {
vpc_id = "${aws_vpc.test.id}"
}
resource "aws_subnet" "test" {
vpc_id = "${aws_vpc.test.id}"
cidr_block = "10.10.10.0/24"
}
resource "aws_route" "test" {
route_table_id = "${aws_route_table.test.id}"
destination_cidr_block = "0.0.0.0/0"
instance_id = "${aws_instance.nat.id}"
}
resource "aws_instance" "nat" {
ami = "ami-9abea4fb"
instance_type = "t2.nano"
subnet_id = "${aws_subnet.test.id}"
}
`)