X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/f608029e1aec903bc35a4748ef51e6f076dae0aa..6b77f5f193b9c7e931d2e0b0712c1b27cd547fc8:/lib/config/cmd_test.go diff --git a/lib/config/cmd_test.go b/lib/config/cmd_test.go index a5cc28b80c..9503a54d2d 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 := ` @@ -162,7 +217,7 @@ Clusters: code := DumpCommand.RunCommand("arvados config-dump", []string{"-config", "-"}, bytes.NewBufferString(in), &stdout, &stderr) c.Check(code, check.Equals, 0) c.Check(stdout.String(), check.Matches, `(?ms).*TimeoutBooting: 10m\n.*`) - c.Check(stdout.String(), check.Matches, `(?ms).*http://localhost:12345/: {}\n.*`) + c.Check(stdout.String(), check.Matches, `(?ms).*http://localhost:12345/:\n +ListenURL: ""\n.*`) } func (s *CommandSuite) TestDump_UnknownKey(c *check.C) {