diff --git a/check/controls.go b/check/controls.go index dfea0067178a0b1436669852993716d572104ae9..909adb7b4b77706baccf62f566ad22370ba7601f 100644 --- a/check/controls.go +++ b/check/controls.go @@ -24,6 +24,7 @@ import ( // Controls holds all controls to check for master nodes. type Controls struct { ID string `yaml:"id"` + Version string Text string Type NodeType Groups []*Group diff --git a/check/controls_test.go b/check/controls_test.go index ef9b1f4cf2576c12c29cc580f606d24e3a6fd4ed..3cf9b60f221878f9c205bb084a70ef6df3a6ef01 100644 --- a/check/controls_test.go +++ b/check/controls_test.go @@ -11,22 +11,31 @@ const cfgDir = "../cfg/" // validate that the files we're shipping are valid YAML func TestYamlFiles(t *testing.T) { - files, err := ioutil.ReadDir(cfgDir) - if err != nil { - t.Fatalf("error reading %s directory: %v", cfgDir, err) - } - for _, file := range files { - fileName := file.Name() - in, err := ioutil.ReadFile(cfgDir + fileName) + // TODO: make this list dynamic + dirs := []string{"1.6/", "1.7/"} + + for _, dir := range dirs { + dir = cfgDir + dir + + files, err := ioutil.ReadDir(dir) if err != nil { - t.Fatalf("error opening file %s: %v", fileName, err) + t.Fatalf("error reading %s directory: %v", dir, err) } - c := new(Controls) + for _, file := range files { - err = yaml.Unmarshal(in, c) - if err != nil { - t.Fatalf("failed to load YAML from %s: %v", fileName, err) + fileName := file.Name() + in, err := ioutil.ReadFile(dir + fileName) + if err != nil { + t.Fatalf("error opening file %s: %v", fileName, err) + } + + c := new(Controls) + + err = yaml.Unmarshal(in, c) + if err != nil { + t.Fatalf("failed to load YAML from %s: %v", fileName, err) + } } } }