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(json.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(json.Unmarshal([]byte(`
27 "APIHost": "zzzzz.arvadosapi.com:443",
33 {"uuid":"zzzzz-bi64l-abcdefghijklmno", "service_type":"disk", "service_host":"a.zzzzz.arvadosapi.com", "service_port":12345},
34 {"uuid":"zzzzz-bi64l-bcdefghijklmnop", "service_type":"blob", "service_host":"b.zzzzz.arvadosapi.com", "service_port":12345}
38 }`), &config), check.IsNil)
39 c.Assert(len(config.KeepServiceList.Items), check.Equals, 2)
40 c.Check(config.KeepServiceList.Items[0].UUID, check.Equals, "zzzzz-bi64l-abcdefghijklmno")
41 c.Check(config.KeepServiceList.Items[0].ServicePort, check.Equals, 12345)
42 c.Check(config.Client.AuthToken, check.Equals, "xyzzy")