From c4874aa5b36ccc8445d12bb76b2633f8a92bb4e2 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Wed, 19 Jun 2019 22:43:40 -0400 Subject: [PATCH] add more timeout provider tests --- .../providers/test/resource_timeout_test.go | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/builtin/providers/test/resource_timeout_test.go b/builtin/providers/test/resource_timeout_test.go index 8227bfb63..312a37a78 100644 --- a/builtin/providers/test/resource_timeout_test.go +++ b/builtin/providers/test/resource_timeout_test.go @@ -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.