2022-06-12 12:43:43 +00:00
|
|
|
package index
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/restic/restic/internal/restic"
|
|
|
|
"github.com/restic/restic/internal/test"
|
|
|
|
)
|
|
|
|
|
2023-06-02 18:27:47 +00:00
|
|
|
func TestMergeIndex(t testing.TB, mi *MasterIndex) ([]*Index, int, restic.IDSet) {
|
2022-06-12 12:43:43 +00:00
|
|
|
finalIndexes := mi.finalizeNotFinalIndexes()
|
2023-06-02 18:27:47 +00:00
|
|
|
ids := restic.NewIDSet()
|
2022-06-12 12:43:43 +00:00
|
|
|
for _, idx := range finalIndexes {
|
2023-06-02 18:27:47 +00:00
|
|
|
id := restic.NewRandomID()
|
|
|
|
ids.Insert(id)
|
|
|
|
test.OK(t, idx.SetID(id))
|
2022-06-12 12:43:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
test.OK(t, mi.MergeFinalIndexes())
|
2023-06-02 18:27:47 +00:00
|
|
|
return finalIndexes, len(mi.idx), ids
|
2022-06-12 12:43:43 +00:00
|
|
|
}
|