[ARVADOS] updated: 7da85b85af2dd9b22186bfd48190de7b68f75837

git at public.curoverse.com git at public.curoverse.com
Thu Jul 16 09:53:32 EDT 2015


Summary of changes:
 services/datamanager/summary/trash_list_test.go | 76 +++++++++++++++++++++++++
 1 file changed, 76 insertions(+)
 create mode 100644 services/datamanager/summary/trash_list_test.go

       via  7da85b85af2dd9b22186bfd48190de7b68f75837 (commit)
      from  036140f305fc34fdefe0ae393b1011f4c3f840de (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 7da85b85af2dd9b22186bfd48190de7b68f75837
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Jul 16 09:54:13 2015 -0400

    6221: Add trash_list_test.go

diff --git a/services/datamanager/summary/trash_list_test.go b/services/datamanager/summary/trash_list_test.go
new file mode 100644
index 0000000..b6f9582
--- /dev/null
+++ b/services/datamanager/summary/trash_list_test.go
@@ -0,0 +1,76 @@
+package summary
+
+import (
+	"git.curoverse.com/arvados.git/sdk/go/blockdigest"
+	"git.curoverse.com/arvados.git/services/datamanager/keep"
+	. "gopkg.in/check.v1"
+	"testing"
+)
+
+// Gocheck boilerplate
+func TrashTest(t *testing.T) {
+	TestingT(t)
+}
+
+type TrashSuite struct{}
+
+var _ = Suite(&TrashSuite{})
+
+func (s *TrashSuite) TestBuildTrashLists(c *C) {
+	var sv0 = keep.ServerAddress{Host: "keep0.example.com", Port: 80}
+	var sv1 = keep.ServerAddress{Host: "keep1.example.com", Port: 80}
+
+	var block0 = blockdigest.MakeTestDigestWithSize(0xdeadbeef)
+	var block1 = blockdigest.MakeTestDigestWithSize(0xfedbeef)
+
+	var keepServerInfo = keep.ReadServers{
+		KeepServerIndexToAddress: []keep.ServerAddress{sv0, sv1},
+		BlockToServers: map[blockdigest.DigestWithSize][]keep.BlockServerInfo{
+			block0: []keep.BlockServerInfo{
+				keep.BlockServerInfo{0, 99},
+				keep.BlockServerInfo{1, 101}},
+			block1: []keep.BlockServerInfo{
+				keep.BlockServerInfo{0, 99},
+				keep.BlockServerInfo{1, 101}}}}
+
+	// only block0 is in delete set
+	var bs BlockSet = make(BlockSet)
+	bs[block0] = struct{}{}
+
+	// Test trash list where only sv0 is on writable list.
+	c.Check(BuildTrashListsInternal(
+		map[string]struct{}{
+			sv0.URL(): struct{}{}},
+		&keepServerInfo,
+		110,
+		bs),
+		DeepEquals,
+		map[string]keep.TrashList{
+			"http://keep0.example.com:80": keep.TrashList{keep.TrashRequest{"000000000000000000000000deadbeef", 99}}})
+
+	// Test trash list where both sv0 and sv1 are on writable list.
+	c.Check(BuildTrashListsInternal(
+		map[string]struct{}{
+			sv0.URL(): struct{}{},
+			sv1.URL(): struct{}{}},
+		&keepServerInfo,
+		110,
+		bs),
+		DeepEquals,
+		map[string]keep.TrashList{
+			"http://keep0.example.com:80": keep.TrashList{keep.TrashRequest{"000000000000000000000000deadbeef", 99}},
+			"http://keep1.example.com:80": keep.TrashList{keep.TrashRequest{"000000000000000000000000deadbeef", 101}}})
+
+	// Test trash list where only block on sv0 is expired
+	c.Check(BuildTrashListsInternal(
+		map[string]struct{}{
+			sv0.URL(): struct{}{},
+			sv1.URL(): struct{}{}},
+		&keepServerInfo,
+		100,
+		bs),
+		DeepEquals,
+		map[string]keep.TrashList{
+			"http://keep0.example.com:80": keep.TrashList{keep.TrashRequest{"000000000000000000000000deadbeef", 99}}})
+
+}

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list