simplify test check
This commit is contained in:
parent
6f7e1ff8eb
commit
fa92e69e17
|
@ -59,16 +59,6 @@ resource "test_resource_nested_set" "foo" {
|
||||||
|
|
||||||
// the empty type_list must be passed to the provider with 1 nil element
|
// the empty type_list must be passed to the provider with 1 nil element
|
||||||
func TestResourceNestedSet_emptyBlock(t *testing.T) {
|
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{
|
resource.UnitTest(t, resource.TestCase{
|
||||||
Providers: testAccProviders,
|
Providers: testAccProviders,
|
||||||
CheckDestroy: testAccCheckResourceDestroy,
|
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"),
|
||||||
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue