6 "github.com/ghodss/yaml"
7 check "gopkg.in/check.v1"
10 var _ = check.Suite(&mainSuite{})
12 type mainSuite struct{}
14 func (s *mainSuite) TestExampleJSON(c *check.C) {
16 c.Check(yaml.Unmarshal(exampleConfigFile, &config), check.IsNil)
17 c.Check(config.KeepServiceTypes, check.DeepEquals, []string{"disk"})
18 c.Check(config.Client.AuthToken, check.Equals, "xyzzy")
19 c.Check(time.Duration(config.RunPeriod), check.Equals, 600*time.Second)
22 func (s *mainSuite) TestConfigJSONWithKeepServiceList(c *check.C) {
24 c.Check(yaml.Unmarshal([]byte(`{
26 "APIHost": "zzzzz.arvadosapi.com:443",
32 {"uuid":"zzzzz-bi64l-abcdefghijklmno", "service_type":"disk", "service_host":"a.zzzzz.arvadosapi.com", "service_port":12345},
33 {"uuid":"zzzzz-bi64l-bcdefghijklmnop", "service_type":"blob", "service_host":"b.zzzzz.arvadosapi.com", "service_port":12345}
37 }`), &config), check.IsNil)
38 c.Assert(len(config.KeepServiceList.Items), check.Equals, 2)
39 c.Check(config.KeepServiceList.Items[0].UUID, check.Equals, "zzzzz-bi64l-abcdefghijklmno")
40 c.Check(config.KeepServiceList.Items[0].ServicePort, check.Equals, 12345)
41 c.Check(config.Client.AuthToken, check.Equals, "xyzzy")