[ARVADOS] created: bee1bf42b29780bcb28fd26edd78d384e1b578ac

Git user git at public.curoverse.com
Tue Jan 3 16:37:13 EST 2017


        at  bee1bf42b29780bcb28fd26edd78d384e1b578ac (commit)


commit bee1bf42b29780bcb28fd26edd78d384e1b578ac
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Jan 3 16:35:58 2017 -0500

    10795: For md5(""), skip the request and just return an empty reader.

diff --git a/sdk/go/keepclient/keepclient.go b/sdk/go/keepclient/keepclient.go
index 79a8715..baf4bac 100644
--- a/sdk/go/keepclient/keepclient.go
+++ b/sdk/go/keepclient/keepclient.go
@@ -167,6 +167,10 @@ func (kc *KeepClient) PutR(r io.Reader) (locator string, replicas int, err error
 }
 
 func (kc *KeepClient) getOrHead(method string, locator string) (io.ReadCloser, int64, string, error) {
+	if strings.HasPrefix(locator, "d41d8cd98f00b204e9800998ecf8427e+0") {
+		return ioutil.NopCloser(bytes.NewReader(nil)), 0, "", nil
+	}
+
 	var errs []string
 
 	tries_remaining := 1 + kc.Retries
diff --git a/sdk/go/keepclient/keepclient_test.go b/sdk/go/keepclient/keepclient_test.go
index 2c89be1..f0da600 100644
--- a/sdk/go/keepclient/keepclient_test.go
+++ b/sdk/go/keepclient/keepclient_test.go
@@ -505,6 +505,27 @@ func (s *StandaloneSuite) TestGet404(c *C) {
 	c.Check(r, Equals, nil)
 }
 
+func (s *StandaloneSuite) TestGetEmptyBlock(c *C) {
+	st := Error404Handler{make(chan string, 1)}
+
+	ks := RunFakeKeepServer(st)
+	defer ks.listener.Close()
+
+	arv, err := arvadosclient.MakeArvadosClient()
+	kc, _ := MakeKeepClient(arv)
+	arv.ApiToken = "abc123"
+	kc.SetServiceRoots(map[string]string{"x": ks.url}, nil, nil)
+
+	r, n, url2, err := kc.Get("d41d8cd98f00b204e9800998ecf8427e+0")
+	c.Check(err, IsNil)
+	c.Check(n, Equals, int64(0))
+	c.Check(url2, Equals, "")
+	c.Assert(r, NotNil)
+	buf, err := ioutil.ReadAll(r)
+	c.Check(err, IsNil)
+	c.Check(buf, DeepEquals, []byte{})
+}
+
 func (s *StandaloneSuite) TestGetFail(c *C) {
 	hash := fmt.Sprintf("%x", md5.Sum([]byte("foo")))
 

commit 3fa0560c1c4892636c8c06c70b0f16190fac59b1
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Jan 3 16:33:19 2017 -0500

    10795: Remove test-selector code (use -check.f instead).

diff --git a/sdk/go/keepclient/keepclient_test.go b/sdk/go/keepclient/keepclient_test.go
index bd36d9d..2c89be1 100644
--- a/sdk/go/keepclient/keepclient_test.go
+++ b/sdk/go/keepclient/keepclient_test.go
@@ -2,7 +2,6 @@ package keepclient
 
 import (
 	"crypto/md5"
-	"flag"
 	"fmt"
 	"git.curoverse.com/arvados.git/sdk/go/arvadosclient"
 	"git.curoverse.com/arvados.git/sdk/go/arvadostest"
@@ -28,8 +27,6 @@ func Test(t *testing.T) {
 var _ = Suite(&ServerRequiredSuite{})
 var _ = Suite(&StandaloneSuite{})
 
-var no_server = flag.Bool("no-server", false, "Skip 'ServerRequireSuite'")
-
 // Tests that require the Keep server running
 type ServerRequiredSuite struct{}
 
@@ -42,18 +39,11 @@ func pythonDir() string {
 }
 
 func (s *ServerRequiredSuite) SetUpSuite(c *C) {
-	if *no_server {
-		c.Skip("Skipping tests that require server")
-		return
-	}
 	arvadostest.StartAPI()
 	arvadostest.StartKeep(2, false)
 }
 
 func (s *ServerRequiredSuite) TearDownSuite(c *C) {
-	if *no_server {
-		return
-	}
 	arvadostest.StopKeep(2)
 	arvadostest.StopAPI()
 }

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list