mirror of
https://github.com/octoleo/restic.git
synced 2024-11-23 21:27:34 +00:00
34d90aecf9
The migration modifies repository internals and thus should live within the repository package.
32 lines
521 B
Go
32 lines
521 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)
|
|
}
|
|
}
|