2752: arv-put displays progress quickly after resuming.
[arvados.git] / sdk / go / src / arvados.org / keepclient / keepclient_test.go
index 395603d5ad3b5c3f92363763c2be719fd723d494..8eedadd64b8a87d79a1a7f9dfe0fc9eb478138e1 100644 (file)
@@ -44,8 +44,12 @@ func (s *ServerRequiredSuite) SetUpSuite(c *C) {
                c.Skip("Skipping tests that require server")
        } else {
                os.Chdir(pythonDir())
-               exec.Command("python", "run_test_server.py", "start").Run()
-               exec.Command("python", "run_test_server.py", "start_keep").Run()
+               if err := exec.Command("python", "run_test_server.py", "start").Run(); err != nil {
+                       panic("'python run_test_server.py start' returned error")
+               }
+               if err := exec.Command("python", "run_test_server.py", "start_keep").Run(); err != nil {
+                       panic("'python run_test_server.py start_keep' returned error")
+               }
        }
 }
 
@@ -159,7 +163,7 @@ func (s *StandaloneSuite) TestUploadToStubKeepServer(c *C) {
 
                        <-st.handled
                        status := <-upload_status
-                       c.Check(status, DeepEquals, uploadStatus{nil, fmt.Sprintf("%s/%s", url, st.expectPath), 200, 1})
+                       c.Check(status, DeepEquals, uploadStatus{nil, fmt.Sprintf("%s/%s", url, st.expectPath), 200, 1, ""})
                })
 
        log.Printf("TestUploadToStubKeepServer done")
@@ -192,7 +196,7 @@ func (s *StandaloneSuite) TestUploadToStubKeepServerBufferReader(c *C) {
                        <-st.handled
 
                        status := <-upload_status
-                       c.Check(status, DeepEquals, uploadStatus{nil, fmt.Sprintf("%s/%s", url, st.expectPath), 200, 1})
+                       c.Check(status, DeepEquals, uploadStatus{nil, fmt.Sprintf("%s/%s", url, st.expectPath), 200, 1, ""})
                })
 
        log.Printf("TestUploadToStubKeepServerBufferReader done")
@@ -382,7 +386,7 @@ func (s *StandaloneSuite) TestPutWithFail(c *C) {
        <-fh.handled
 
        c.Check(err, Equals, nil)
-       c.Check(phash, Equals, hash)
+       c.Check(phash, Equals, "")
        c.Check(replicas, Equals, 2)
        c.Check(<-st.handled, Equals, shuff[1])
        c.Check(<-st.handled, Equals, shuff[2])
@@ -594,7 +598,7 @@ func (s *ServerRequiredSuite) TestPutGetHead(c *C) {
        }
        {
                hash2, replicas, err := kc.PutB([]byte("foo"))
-               c.Check(hash2, Equals, hash)
+               c.Check(hash2, Equals, fmt.Sprintf("%s+%v", hash, 3))
                c.Check(replicas, Equals, 2)
                c.Check(err, Equals, nil)
        }
@@ -683,3 +687,12 @@ func (s *StandaloneSuite) TestPutProxyInsufficientReplicas(c *C) {
 
        log.Printf("TestPutProxy done")
 }
+
+func (s *StandaloneSuite) TestMakeLocator(c *C) {
+       l := MakeLocator("91f372a266fe2bf2823cb8ec7fda31ce+3+Aabcde@12345678")
+
+       c.Check(l.Hash, Equals, "91f372a266fe2bf2823cb8ec7fda31ce")
+       c.Check(l.Size, Equals, 3)
+       c.Check(l.Signature, Equals, "abcde")
+       c.Check(l.Timestamp, Equals, "12345678")
+}