X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/e6769d20505e2c8c74b2d7e3f9c2f33f2a2db092..8d6c35e4dd68baec1b58d566d32d89feb651deac:/lib/config/cmd_test.go diff --git a/lib/config/cmd_test.go b/lib/config/cmd_test.go index a5cc28b80c..7167982ccd 100644 --- a/lib/config/cmd_test.go +++ b/lib/config/cmd_test.go @@ -53,6 +53,7 @@ Clusters: SystemRootToken: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa API: MaxItemsPerResponse: 1234 + VocabularyPath: /this/path/does/not/exist Collections: BlobSigningKey: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa PostgreSQL: @@ -77,6 +78,60 @@ Clusters: c.Check(stderr.String(), check.Equals, "") } +func (s *CommandSuite) TestCheck_VocabularyErrors(c *check.C) { + tmpFile, err := ioutil.TempFile("", "") + c.Assert(err, check.IsNil) + defer os.Remove(tmpFile.Name()) + _, err = tmpFile.WriteString(` +{ + "tags": { + "IDfoo": { + "labels": [ + {"label": "foo"} + ] + }, + "IDfoo": { + "labels": [ + {"label": "baz"} + ] + } + } +}`) + c.Assert(err, check.IsNil) + tmpFile.Close() + vocPath := tmpFile.Name() + var stdout, stderr bytes.Buffer + in := ` +Clusters: + z1234: + ManagementToken: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + SystemRootToken: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + API: + MaxItemsPerResponse: 1234 + VocabularyPath: ` + vocPath + ` + Collections: + BlobSigningKey: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + PostgreSQL: + Connection: + sslmode: require + Services: + RailsAPI: + InternalURLs: + "http://0.0.0.0:8000": {} + Workbench: + UserProfileFormFields: + color: + Type: select + Options: + fuchsia: {} + ApplicationMimetypesWithViewIcon: + whitespace: {} +` + code := CheckCommand.RunCommand("arvados config-check", []string{"-config", "-"}, bytes.NewBufferString(in), &stdout, &stderr) + c.Check(code, check.Equals, 1) + c.Check(stderr.String(), check.Matches, `(?ms).*Error loading vocabulary file.*for cluster.*duplicate JSON key.*tags.IDfoo.*`) +} + func (s *CommandSuite) TestCheck_DeprecatedKeys(c *check.C) { var stdout, stderr bytes.Buffer in := `