mirror of
https://github.com/kopia/kopia.git
synced 2025-12-23 22:57:50 -05:00
* fixup for ticket #3624 * skip, now broken, test * lint fixup. how did this get into the repository in the first place?! * elide shadow copy tests until fixup. do not allow release * fixup for shadow copy mode from @small * Update cli/command_policy_set_os_snapshot_test.go * restore old tests * fixup typo --------- Co-authored-by: Shikhar Mall <mall.shikhar.in@gmail.com>
50 lines
1.7 KiB
Go
50 lines
1.7 KiB
Go
package cli_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/kopia/kopia/internal/testutil"
|
|
"github.com/kopia/kopia/tests/testenv"
|
|
)
|
|
|
|
func TestSetOSSnapshotPolicy(t *testing.T) {
|
|
e := testenv.NewCLITest(t, testenv.RepoFormatNotImportant, testenv.NewInProcRunner(t))
|
|
defer e.RunAndExpectSuccess(t, "repo", "disconnect")
|
|
|
|
e.RunAndExpectSuccess(t, "repo", "create", "filesystem", "--path", e.RepoDir)
|
|
|
|
lines := e.RunAndExpectSuccess(t, "policy", "show", "--global")
|
|
lines = compressSpaces(lines)
|
|
require.Contains(t, lines, " Volume Shadow Copy: never (defined for this target)")
|
|
|
|
e.RunAndExpectSuccess(t, "policy", "set", "--global", "--enable-volume-shadow-copy=when-available")
|
|
|
|
lines = e.RunAndExpectSuccess(t, "policy", "show", "--global")
|
|
lines = compressSpaces(lines)
|
|
|
|
require.Contains(t, lines, " Volume Shadow Copy: when-available (defined for this target)")
|
|
|
|
// make some directory we'll be setting policy on
|
|
td := testutil.TempDirectory(t)
|
|
|
|
lines = e.RunAndExpectSuccess(t, "policy", "show", td)
|
|
lines = compressSpaces(lines)
|
|
require.Contains(t, lines, " Volume Shadow Copy: when-available inherited from (global)")
|
|
|
|
e.RunAndExpectSuccess(t, "policy", "set", "--global", "--enable-volume-shadow-copy=always")
|
|
|
|
lines = e.RunAndExpectSuccess(t, "policy", "show", td)
|
|
lines = compressSpaces(lines)
|
|
|
|
require.Contains(t, lines, " Volume Shadow Copy: always inherited from (global)")
|
|
|
|
e.RunAndExpectSuccess(t, "policy", "set", "--enable-volume-shadow-copy=never", td)
|
|
|
|
lines = e.RunAndExpectSuccess(t, "policy", "show", td)
|
|
lines = compressSpaces(lines)
|
|
|
|
require.Contains(t, lines, " Volume Shadow Copy: never (defined for this target)")
|
|
}
|