Add a test load of a data source with count

This commit is contained in:
James Bardin 2016-09-02 14:45:21 -04:00 committed by James Nugent
parent a3fc7e2e21
commit 94674fe93c
2 changed files with 20 additions and 0 deletions

View File

@ -552,3 +552,20 @@ func testConfig(t *testing.T, name string) *Config {
return c
}
func TestConfigDataCount(t *testing.T) {
c := testConfig(t, "data-count")
actual, err := c.Resources[0].Count()
if err != nil {
t.Fatalf("err: %s", err)
}
if actual != 5 {
t.Fatalf("bad: %#v", actual)
}
// we need to make sure "count" has been removed from the RawConfig, since
// it's not a real key and won't validate.
if _, ok := c.Resources[0].RawConfig.Raw["count"]; ok {
t.Fatal("count key still exists in RawConfig")
}
}

View File

@ -0,0 +1,3 @@
data "foo" "bar" {
count = 5
}