add more timeout provider tests

This commit is contained in:
James Bardin 2019-06-19 22:43:40 -04:00
parent 2448d1d38b
commit c4874aa5b3

View File

@ -28,6 +28,52 @@ resource "test_resource_timeout" "foo" {
})
}
// start with the default, then modify it
func TestResourceTimeout_defaults(t *testing.T) {
resource.UnitTest(t, resource.TestCase{
Providers: testAccProviders,
CheckDestroy: testAccCheckResourceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: strings.TrimSpace(`
resource "test_resource_timeout" "foo" {
update_delay = "1ms"
}
`),
},
resource.TestStep{
Config: strings.TrimSpace(`
resource "test_resource_timeout" "foo" {
update_delay = "2ms"
timeouts {
update = "3s"
}
}
`),
},
resource.TestStep{
Config: strings.TrimSpace(`
resource "test_resource_timeout" "foo" {
update_delay = "2s"
delete_delay = "2s"
timeouts {
delete = "3s"
update = "3s"
}
}
`),
},
// delete "foo"
resource.TestStep{
Config: strings.TrimSpace(`
resource "test_resource_timeout" "bar" {
}
`),
},
},
})
}
func TestResourceTimeout_delete(t *testing.T) {
// If the delete timeout isn't saved until destroy, the cleanup here will
// fail because the default is only 20m.