[ARVADOS] updated: 25ab66cd863615df2fb347139fc4ef368d91dc11

git at public.curoverse.com git at public.curoverse.com
Wed Dec 16 14:30:53 EST 2015


Summary of changes:
 services/keepstore/azure_blob_volume_test.go | 47 +++++++++++++++++++++++++++-
 1 file changed, 46 insertions(+), 1 deletion(-)

       via  25ab66cd863615df2fb347139fc4ef368d91dc11 (commit)
      from  49fa621b6ea36479a0581df9f258ad032bc046d3 (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 25ab66cd863615df2fb347139fc4ef368d91dc11
Author: Tom Clegg <tom at curoverse.com>
Date:   Wed Dec 16 14:30:41 2015 -0500

    7888: Better tests for fencepost errors.

diff --git a/services/keepstore/azure_blob_volume_test.go b/services/keepstore/azure_blob_volume_test.go
index eacfff5..e424911 100644
--- a/services/keepstore/azure_blob_volume_test.go
+++ b/services/keepstore/azure_blob_volume_test.go
@@ -2,6 +2,7 @@ package main
 
 import (
 	"bytes"
+	"crypto/md5"
 	"encoding/base64"
 	"encoding/xml"
 	"flag"
@@ -374,7 +375,8 @@ func TestAzureBlobVolumeConcurrentRanges(t *testing.T) {
 	}
 	azureWriteRaceInterval = time.Millisecond
 	azureWriteRacePollTime = time.Nanosecond
-	for _, azureMaxGetBytes = range []int{2 << 22, 2<<22 - 1, 2<<22 + 1} {
+	// Test (BlockSize mod azureMaxGetBytes)==0 and !=0 cases
+	for _, azureMaxGetBytes = range []int{2 << 22, 2<<22 - 1} {
 		DoGenericVolumeTests(t, func(t TB) TestableVolume {
 			return NewTestableAzureBlobVolume(t, false, azureStorageReplication)
 		})
@@ -395,6 +397,49 @@ func TestReadonlyAzureBlobVolumeWithGeneric(t *testing.T) {
 	})
 }
 
+func TestAzureBlobVolumeRangeFenceposts(t *testing.T) {
+	defer func(t http.RoundTripper) {
+		http.DefaultTransport = t
+	}(http.DefaultTransport)
+	http.DefaultTransport = &http.Transport{
+		Dial: (&azStubDialer{}).Dial,
+	}
+
+	v := NewTestableAzureBlobVolume(t, false, 3)
+	defer v.Teardown()
+
+	for _, size := range []int{
+		2<<22 - 1, // one <max read
+		2 << 22,   // one =max read
+		2<<22 + 1, // one =max read, one <max
+		2 << 23,   // two =max reads
+		BlockSize - 1,
+		BlockSize,
+	} {
+		data := make([]byte, size)
+		for i := range data {
+			data[i] = byte((i + 7) & 0xff)
+		}
+		hash := fmt.Sprintf("%x", md5.Sum(data))
+		err := v.Put(hash, data)
+		if err != nil {
+			t.Error(err)
+		}
+		gotData, err := v.Get(hash)
+		if err != nil {
+			t.Error(err)
+		}
+		gotHash := fmt.Sprintf("%x", md5.Sum(gotData))
+		bufs.Put(gotData)
+		if len(gotData) != len(data) {
+			t.Error("length mismatch: got %d != %d", len(gotData), len(data))
+		}
+		if hash != gotHash {
+			t.Error("hash mismatch: got %s != %s", gotHash, hash)
+		}
+	}
+}
+
 func TestAzureBlobVolumeReplication(t *testing.T) {
 	for r := 1; r <= 4; r++ {
 		v := NewTestableAzureBlobVolume(t, false, r)

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list