Renamed BlockToReplication BlockToDesiredReplication.
[arvados.git] / services / datamanager / collection / testing.go
index 1d3c2e811b8df6d001d2f5e68878886b61231c74..f3c1f47664a039e6b6771c620c41cef3272a8c44 100644 (file)
@@ -44,3 +44,17 @@ func MakeTestReadCollections(specs []TestCollectionSpec) (rc ReadCollections) {
        }
        return
 }
+
+// Returns a slice giving the collection index of each collection that
+// was passed in to MakeTestReadCollections. rc.Summarize() must be
+// called before this method, since Summarize() assigns an index to
+// each collection.
+func (rc ReadCollections) CollectionIndicesForTesting() (indices []int) {
+       // TODO(misha): Assert that rc.Summarize() has been called.
+       numCollections := len(rc.CollectionIndexToUuid)
+       indices = make([]int, numCollections)
+       for i := 0; i < numCollections; i++ {
+               indices[i] = rc.CollectionUuidToIndex[fmt.Sprintf("col%d", i)]
+       }
+       return
+}