From fa92e69e176fdaea3eda15e2da0c5c40a3ecaf9c Mon Sep 17 00:00:00 2001 From: James Bardin Date: Wed, 30 Jan 2019 12:14:59 -0500 Subject: [PATCH] simplify test check --- builtin/providers/test/resource_nested_set_test.go | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/builtin/providers/test/resource_nested_set_test.go b/builtin/providers/test/resource_nested_set_test.go index 691f74916..744e4c708 100644 --- a/builtin/providers/test/resource_nested_set_test.go +++ b/builtin/providers/test/resource_nested_set_test.go @@ -59,16 +59,6 @@ resource "test_resource_nested_set" "foo" { // the empty type_list must be passed to the provider with 1 nil element func TestResourceNestedSet_emptyBlock(t *testing.T) { - checkFunc := func(s *terraform.State) error { - root := s.ModuleByPath(addrs.RootModuleInstance) - res := root.Resources["test_resource_nested_set.foo"] - for k, v := range res.Primary.Attributes { - if strings.HasPrefix(k, "type_list") && v != "1" { - return fmt.Errorf("unexpected set value: %s:%s", k, v) - } - } - return nil - } resource.UnitTest(t, resource.TestCase{ Providers: testAccProviders, CheckDestroy: testAccCheckResourceDestroy, @@ -80,7 +70,9 @@ resource "test_resource_nested_set" "foo" { } } `), - Check: checkFunc, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("test_resource_nested_set.foo", "type_list.#", "1"), + ), }, }, })