diff --git a/tests/robustness/robustness_test/main_test.go b/tests/robustness/robustness_test/main_test.go index 35bcc089d..320d809cf 100644 --- a/tests/robustness/robustness_test/main_test.go +++ b/tests/robustness/robustness_test/main_test.go @@ -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) } diff --git a/tests/robustness/snapmeta/kopia_snapshotter.go b/tests/robustness/snapmeta/kopia_snapshotter.go index f84443298..1ea2a290d 100644 --- a/tests/robustness/snapmeta/kopia_snapshotter.go +++ b/tests/robustness/snapmeta/kopia_snapshotter.go @@ -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 }