func (s *changeSetSuite) TestJSONFormat(c *check.C) { srv := &KeepService{ KeepService: arvados.KeepService{ UUID: "zzzzz-bi6l4-000000000000001", ServiceType: "disk", ServiceSSLFlag: false, ServiceHost: "keep1.zzzzz.arvadosapi.com", ServicePort: 25107}} buf, err := json.Marshal([]Pull{{ SizedDigest: arvados.SizedDigest("acbd18db4cc2f85cedef654fccc4a4d8+3"), Source: srv}}) c.Check(err, check.IsNil) c.Check(string(buf), check.Equals, `[{"locator":"acbd18db4cc2f85cedef654fccc4a4d8","servers":["http://keep1.zzzzz.arvadosapi.com:25107"]}]`) buf, err = json.Marshal([]Trash{{ SizedDigest: arvados.SizedDigest("acbd18db4cc2f85cedef654fccc4a4d8+3"), Mtime: 123456789}}) c.Check(err, check.IsNil) c.Check(string(buf), check.Equals, `[{"locator":"acbd18db4cc2f85cedef654fccc4a4d8","block_mtime":123456789}]`) }
// generate the same data hashes that are tested in // sdk/go/keepclient/root_sorter_test.go func knownBlkid(i int) arvados.SizedDigest { return arvados.SizedDigest(fmt.Sprintf("%x+64", md5.Sum([]byte(fmt.Sprintf("%064x", i))))) }