1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-22 15:57:07 +00:00
restic/internal/migrations/upgrade_repo_v2_test.go
2024-05-18 21:42:51 +02:00

31 lines
524 B
Go

package migrations
import (
"context"
"testing"
"github.com/restic/restic/internal/repository"
)
func TestUpgradeRepoV2(t *testing.T) {
repo, _ := repository.TestRepositoryWithVersion(t, 1)
if repo.Config().Version != 1 {
t.Fatal("test repo has wrong version")
}
m := &UpgradeRepoV2{}
ok, _, err := m.Check(context.Background(), repo)
if err != nil {
t.Fatal(err)
}
if !ok {
t.Fatal("migration check returned false")
}
err = m.Apply(context.Background(), repo)
if err != nil {
t.Fatal(err)
}
}