1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
10 "github.com/ghodss/yaml"
11 check "gopkg.in/check.v1"
14 var _ = check.Suite(&mainSuite{})
16 type mainSuite struct{}
18 func (s *mainSuite) TestExampleJSON(c *check.C) {
20 c.Check(yaml.Unmarshal(exampleConfigFile, &config), check.IsNil)
21 c.Check(config.KeepServiceTypes, check.DeepEquals, []string{"disk"})
22 c.Check(config.Client.AuthToken, check.Equals, "xyzzy")
23 c.Check(time.Duration(config.RunPeriod), check.Equals, 600*time.Second)
26 func (s *mainSuite) TestConfigJSONWithKeepServiceList(c *check.C) {
28 c.Check(yaml.Unmarshal([]byte(`{
30 "APIHost": "zzzzz.arvadosapi.com:443",
36 {"uuid":"zzzzz-bi64l-abcdefghijklmno", "service_type":"disk", "service_host":"a.zzzzz.arvadosapi.com", "service_port":12345},
37 {"uuid":"zzzzz-bi64l-bcdefghijklmnop", "service_type":"blob", "service_host":"b.zzzzz.arvadosapi.com", "service_port":12345}
41 }`), &config), check.IsNil)
42 c.Assert(len(config.KeepServiceList.Items), check.Equals, 2)
43 c.Check(config.KeepServiceList.Items[0].UUID, check.Equals, "zzzzz-bi64l-abcdefghijklmno")
44 c.Check(config.KeepServiceList.Items[0].ServicePort, check.Equals, 12345)
45 c.Check(config.Client.AuthToken, check.Equals, "xyzzy")