X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/a8749c6b2c7d339c3355dd130ca37c9c876f72a5..891d6b276f1e37d85d1a66496e045cd7ab6807e1:/services/keep/src/arvados.org/keepproxy/keepproxy_test.go diff --git a/services/keep/src/arvados.org/keepproxy/keepproxy_test.go b/services/keep/src/arvados.org/keepproxy/keepproxy_test.go index cedc61fbcc..47c33b4e1b 100644 --- a/services/keep/src/arvados.org/keepproxy/keepproxy_test.go +++ b/services/keep/src/arvados.org/keepproxy/keepproxy_test.go @@ -31,7 +31,7 @@ type ServerRequiredSuite struct{} func pythonDir() string { gopath := os.Getenv("GOPATH") - return fmt.Sprintf("%s/../../sdk/python", strings.Split(gopath, ":")[0]) + return fmt.Sprintf("%s/../../sdk/python/tests", strings.Split(gopath, ":")[0]) } func (s *ServerRequiredSuite) SetUpSuite(c *C) { @@ -141,6 +141,7 @@ func (s *ServerRequiredSuite) TestPutAskGet(c *C) { defer listener.Close() hash := fmt.Sprintf("%x", md5.Sum([]byte("foo"))) + var hash2 string { _, _, err := kc.Ask(hash) @@ -149,22 +150,24 @@ func (s *ServerRequiredSuite) TestPutAskGet(c *C) { } { - hash2, rep, err := kc.PutB([]byte("foo")) - c.Check(hash2, Equals, hash) + var rep int + var err error + hash2, rep, err = kc.PutB([]byte("foo")) + c.Check(hash2, Equals, fmt.Sprintf("%s+3", hash)) c.Check(rep, Equals, 2) c.Check(err, Equals, nil) log.Print("PutB") } { - blocklen, _, err := kc.Ask(hash) + blocklen, _, err := kc.Ask(hash2) c.Assert(err, Equals, nil) c.Check(blocklen, Equals, int64(3)) log.Print("Ask 2") } { - reader, blocklen, _, err := kc.Get(hash) + reader, blocklen, _, err := kc.Get(hash2) c.Assert(err, Equals, nil) all, err := ioutil.ReadAll(reader) c.Check(all, DeepEquals, []byte("foo")) @@ -193,7 +196,7 @@ func (s *ServerRequiredSuite) TestPutAskGetForbidden(c *C) { { hash2, rep, err := kc.PutB([]byte("bar")) - c.Check(hash2, Equals, hash) + c.Check(hash2, Equals, "") c.Check(rep, Equals, 0) c.Check(err, Equals, keepclient.InsufficientReplicasError) log.Print("PutB") @@ -232,7 +235,7 @@ func (s *ServerRequiredSuite) TestGetDisabled(c *C) { { hash2, rep, err := kc.PutB([]byte("baz")) - c.Check(hash2, Equals, hash) + c.Check(hash2, Equals, fmt.Sprintf("%s+3", hash)) c.Check(rep, Equals, 2) c.Check(err, Equals, nil) log.Print("PutB") @@ -261,11 +264,9 @@ func (s *ServerRequiredSuite) TestPutDisabled(c *C) { kc := runProxy(c, []string{"keepproxy", "-no-put"}, "4axaw8zxe0qm22wa6urpp5nskcne8z88cvbupv653y1njyi05h", 29953) defer listener.Close() - hash := fmt.Sprintf("%x", md5.Sum([]byte("quux"))) - { hash2, rep, err := kc.PutB([]byte("quux")) - c.Check(hash2, Equals, hash) + c.Check(hash2, Equals, "") c.Check(rep, Equals, 0) c.Check(err, Equals, keepclient.InsufficientReplicasError) log.Print("PutB")