[ARVADOS] updated: 40c9b26a39c773e806e0a1430774f1787820376f

git at public.curoverse.com git at public.curoverse.com
Tue Oct 13 11:09:03 EDT 2015


Summary of changes:
 services/keepstore/azure_blob_volume.go   |  8 +-------
 services/keepstore/volume_generic_test.go | 32 +++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 7 deletions(-)

       via  40c9b26a39c773e806e0a1430774f1787820376f (commit)
      from  fb0f0a8eade18142e28e2691d656f262b0cdc01a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 40c9b26a39c773e806e0a1430774f1787820376f
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Oct 13 11:17:49 2015 -0400

    7159: Fix error handling when reading full size block. refs #7159

diff --git a/services/keepstore/azure_blob_volume.go b/services/keepstore/azure_blob_volume.go
index 9531564..d545aad 100644
--- a/services/keepstore/azure_blob_volume.go
+++ b/services/keepstore/azure_blob_volume.go
@@ -161,17 +161,11 @@ func (v *AzureBlobVolume) get(loc string) ([]byte, error) {
 		}
 		return nil, err
 	}
-	switch err := err.(type) {
-	case nil:
-	default:
-		log.Printf("ERROR IN Get(): %T %#v", err, err)
-		return nil, err
-	}
 	defer rdr.Close()
 	buf := bufs.Get(BlockSize)
 	n, err := io.ReadFull(rdr, buf)
 	switch err {
-	case io.EOF, io.ErrUnexpectedEOF:
+	case nil, io.EOF, io.ErrUnexpectedEOF:
 		return buf[:n], nil
 	default:
 		bufs.Put(buf)
diff --git a/services/keepstore/volume_generic_test.go b/services/keepstore/volume_generic_test.go
index 6dca74e..74c5b2a 100644
--- a/services/keepstore/volume_generic_test.go
+++ b/services/keepstore/volume_generic_test.go
@@ -2,6 +2,8 @@ package main
 
 import (
 	"bytes"
+	"crypto/md5"
+	"fmt"
 	"os"
 	"regexp"
 	"sort"
@@ -58,6 +60,8 @@ func DoGenericVolumeTests(t *testing.T, factory TestableVolumeFactory) {
 
 	testGetConcurrent(t, factory)
 	testPutConcurrent(t, factory)
+
+	testPutFullBlock(t, factory)
 }
 
 // Put a test block, get it and verify content
@@ -633,3 +637,31 @@ func testPutConcurrent(t *testing.T, factory TestableVolumeFactory) {
 		t.Errorf("Get #3: expected %s, got %s", string(TestBlock3), string(buf))
 	}
 }
+
+// Write and read back a full size block
+func testPutFullBlock(t *testing.T, factory TestableVolumeFactory) {
+	v := factory(t)
+	defer v.Teardown()
+
+	if !v.Writable() {
+		return
+	}
+
+	wdata := make([]byte, BlockSize)
+	wdata[0] = 'a'
+	wdata[BlockSize-1] = 'z'
+	hash := fmt.Sprintf("%x", md5.Sum(wdata))
+	err := v.Put(hash, wdata)
+	if err != nil {
+		t.Fatal(err)
+	}
+	rdata, err := v.Get(hash)
+	if err != nil {
+		t.Error(err)
+	} else {
+		defer bufs.Put(rdata)
+	}
+	if bytes.Compare(rdata, wdata) != 0 {
+		t.Error("rdata != wdata")
+	}
+}

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list