github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/builtin/providers/ignition/resource_ignition_raid_test.go (about) 1 package ignition 2 3 import ( 4 "fmt" 5 "testing" 6 7 "github.com/coreos/ignition/config/types" 8 ) 9 10 func TestIngnitionRaid(t *testing.T) { 11 testIgnition(t, ` 12 data "ignition_raid" "foo" { 13 name = "foo" 14 level = "raid10" 15 devices = ["/foo"] 16 spares = 42 17 } 18 19 data "ignition_config" "test" { 20 arrays = [ 21 "${data.ignition_raid.foo.id}", 22 ] 23 } 24 `, func(c *types.Config) error { 25 if len(c.Storage.Arrays) != 1 { 26 return fmt.Errorf("arrays, found %d", len(c.Storage.Arrays)) 27 } 28 29 a := c.Storage.Arrays[0] 30 if a.Name != "foo" { 31 return fmt.Errorf("name, found %q", a.Name) 32 } 33 34 if len(a.Devices) != 1 || a.Devices[0] != "/foo" { 35 return fmt.Errorf("devices, found %v", a.Devices) 36 } 37 38 if a.Level != "raid10" { 39 return fmt.Errorf("level, found %q", a.Level) 40 } 41 42 if a.Spares != 42 { 43 return fmt.Errorf("spares, found %q", a.Spares) 44 } 45 46 return nil 47 }) 48 }