[ARVADOS] updated: b2614cf7b8ada31ae003e0ce27c87d38b42ee567
git at public.curoverse.com
git at public.curoverse.com
Thu Sep 10 11:18:05 EDT 2015
Summary of changes:
services/datamanager/datamanager_test.go | 44 +++++++++++++-------------------
1 file changed, 18 insertions(+), 26 deletions(-)
via b2614cf7b8ada31ae003e0ce27c87d38b42ee567 (commit)
from e244b9411becb2fe3bce44aba4fe94c1f14e1f17 (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 b2614cf7b8ada31ae003e0ce27c87d38b42ee567
Author: Tom Clegg <tom at curoverse.com>
Date: Thu Sep 10 11:17:36 2015 -0400
6260: Reduced-replication test requires replication>=desired, not replication==len(keepServers).
diff --git a/services/datamanager/datamanager_test.go b/services/datamanager/datamanager_test.go
index faf9347..1d4e171 100644
--- a/services/datamanager/datamanager_test.go
+++ b/services/datamanager/datamanager_test.go
@@ -206,7 +206,7 @@ func getBlockIndexes(t *testing.T) [][]string {
return indexes
}
-func verifyBlocks(t *testing.T, notExpected []string, expected []string) {
+func verifyBlocks(t *testing.T, notExpected []string, expected []string, minReplication int) {
blocks := getBlockIndexes(t)
for _, block := range notExpected {
@@ -224,8 +224,8 @@ func verifyBlocks(t *testing.T, notExpected []string, expected []string) {
nFound++
}
}
- if nFound < 2 {
- t.Fatalf("Found %d replicas of block %s, expected >= 2", nFound, block)
+ if nFound < minReplication {
+ t.Fatalf("Found %d replicas of block %s, expected >= %d", nFound, block, minReplication)
}
}
}
@@ -398,13 +398,13 @@ func TestPutAndGetBlocks(t *testing.T) {
expected = append(expected, oneOfTwoWithSameDataLocator)
expected = append(expected, secondOfTwoWithSameDataLocator)
- verifyBlocks(t, nil, expected)
+ verifyBlocks(t, nil, expected, 2)
// Run datamanager in singlerun mode
dataManagerSingleRun(t)
waitUntilQueuesFinishWork(t)
- verifyBlocks(t, nil, expected)
+ verifyBlocks(t, nil, expected, 2)
// Backdate the to-be old blocks and delete the collections
backdateBlocks(t, oldUnusedBlockLocators)
@@ -420,43 +420,35 @@ func TestPutAndGetBlocks(t *testing.T) {
expected = append(expected, oldUsedBlockLocator)
expected = append(expected, newBlockLocators...)
expected = append(expected, toBeDeletedCollectionLocator)
- expected = append(expected, replicationCollectionLocator)
expected = append(expected, oneOfTwoWithSameDataLocator)
expected = append(expected, secondOfTwoWithSameDataLocator)
- verifyBlocks(t, oldUnusedBlockLocators, expected)
-
- // Reduce replication on replicationCollectionUuid collection and verify that the overreplicated blocks are untouched.
+ verifyBlocks(t, oldUnusedBlockLocators, expected, 2)
- // Default replication level is 2; first verify that the replicationCollectionLocator appears in both volumes
- for i := 0; i < len(keepServers); i++ {
- indexes := getBlockIndexesForServer(t, i)
- if !valueInArray(replicationCollectionLocator, indexes) {
- t.Fatalf("Not found block in index %s", replicationCollectionLocator)
- }
- }
+ // Reduce desired replication on replicationCollectionUuid
+ // collection, and verify that Data Manager does not reduce
+ // actual replication any further than that. (It might not
+ // reduce actual replication at all; that's OK for this test.)
- // Now reduce replication level on this collection and verify that it still appears in both volumes
+ // Reduce desired replication level.
updateCollection(t, replicationCollectionUuid, "replication_desired", "1")
collection := getCollection(t, replicationCollectionUuid)
if collection["replication_desired"].(interface{}) != float64(1) {
t.Fatalf("After update replication_desired is not 1; instead it is %v", collection["replication_desired"])
}
+ // Verify data is currently overreplicated.
+ verifyBlocks(t, nil, []string{replicationCollectionLocator}, 2)
+
// Run data manager again
dataManagerSingleRun(t)
waitUntilQueuesFinishWork(t)
- for i := 0; i < len(keepServers); i++ {
- indexes := getBlockIndexesForServer(t, i)
- if !valueInArray(replicationCollectionLocator, indexes) {
- t.Fatalf("Not found block in index %s", replicationCollectionLocator)
- }
- }
- // Done testing reduce replication on collection
+ // Verify data is not underreplicated.
+ verifyBlocks(t, nil, []string{replicationCollectionLocator}, 1)
- // Verify blocks one more time
- verifyBlocks(t, oldUnusedBlockLocators, expected)
+ // Verify *other* collections' data is not underreplicated.
+ verifyBlocks(t, oldUnusedBlockLocators, expected, 2)
}
func TestDatamanagerSingleRunRepeatedly(t *testing.T) {
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list