mirror of
https://github.com/kopia/kopia.git
synced 2026-05-05 21:33:57 -04:00
test(general): Use new kopia upgrade cli in robustness upgrade tests (#2355)
* Use new kopia upgrade cli * Clean up environement variable * Clean up environement variable * Clean up debugging change * Fix lint errors * Fix lint errors
This commit is contained in:
@@ -70,6 +70,9 @@ func TestMain(m *testing.M) {
|
||||
|
||||
curr := rs.ContentFormat.MutableParameters.Version
|
||||
log.Println("Upgraded repository format:", curr)
|
||||
|
||||
// Reset the env variable.
|
||||
os.Setenv("KOPIA_UPGRADE_LOCK_ENABLED", "")
|
||||
}
|
||||
|
||||
// run the tests
|
||||
@@ -216,6 +219,8 @@ func (th *kopiaRobustnessTestHarness) getEngine() bool {
|
||||
}
|
||||
|
||||
func (th *kopiaRobustnessTestHarness) cleanup(ctx context.Context) (retErr error) {
|
||||
os.Setenv("KOPIA_UPGRADE_LOCK_ENABLED", "")
|
||||
|
||||
if th.engine != nil {
|
||||
retErr = th.engine.Shutdown(ctx)
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"encoding/json"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
|
||||
@@ -200,7 +201,17 @@ func (ks *KopiaSnapshotter) GetRepositoryStatus() (cli.RepositoryStatus, error)
|
||||
// UpgradeRepository upgrades the given kopia repository
|
||||
// from current format version to latest stable format version.
|
||||
func (ks *KopiaSnapshotter) UpgradeRepository() error {
|
||||
_, _, err := ks.snap.Run("repository", "set-parameters", "--upgrade")
|
||||
// This variable is also reset in cleanup function
|
||||
// in case the test fails
|
||||
os.Setenv("KOPIA_UPGRADE_LOCK_ENABLED", "1")
|
||||
|
||||
_, _, err := ks.snap.Run("repository", "upgrade",
|
||||
"--upgrade-owner-id", "robustness-tests",
|
||||
"--io-drain-timeout", "30s", "--allow-unsafe-upgrade",
|
||||
"--status-poll-interval", "1s")
|
||||
|
||||
// cleanup
|
||||
os.Setenv("KOPIA_UPGRADE_LOCK_ENABLED", "")
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user