MCPcopy
hub / github.com/kopia/kopia / TestSetSplitterPolicy

Function TestSetSplitterPolicy

cli/command_policy_set_splitter_test.go:12–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestSetSplitterPolicy(t *testing.T) {
13 e := testenv.NewCLITest(t, testenv.RepoFormatNotImportant, testenv.NewInProcRunner(t))
14 defer e.RunAndExpectSuccess(t, "repo", "disconnect")
15
16 e.RunAndExpectSuccess(t, "repo", "create", "filesystem", "--path", e.RepoDir)
17
18 lines := e.RunAndExpectSuccess(t, "policy", "show", "--global")
19 lines = compressSpaces(lines)
20 require.Contains(t, lines, " Algorithm override: (repository default) (defined for this target)")
21
22 // make some directory we'll be setting policy on
23 td := testutil.TempDirectory(t)
24
25 lines = e.RunAndExpectSuccess(t, "policy", "show", td)
26 lines = compressSpaces(lines)
27 require.Contains(t, lines, " Algorithm override: (repository default) inherited from (global)")
28
29 e.RunAndExpectSuccess(t, "policy", "set", td, "--splitter=FIXED-4M")
30
31 lines = e.RunAndExpectSuccess(t, "policy", "show", td)
32 lines = compressSpaces(lines)
33 require.Contains(t, lines, " Algorithm override: FIXED-4M (defined for this target)")
34
35 e.RunAndExpectSuccess(t, "policy", "set", td, "--splitter=inherit")
36
37 lines = e.RunAndExpectSuccess(t, "policy", "show", td)
38 lines = compressSpaces(lines)
39 require.Contains(t, lines, " Algorithm override: (repository default) inherited from (global)")
40
41 e.RunAndExpectFailure(t, "policy", "set", td, "--splitter=NO-SUCH_SPLITTER")
42}

Callers

nothing calls this directly

Calls 7

RunAndExpectSuccessMethod · 0.95
RunAndExpectFailureMethod · 0.95
NewCLITestFunction · 0.92
NewInProcRunnerFunction · 0.92
TempDirectoryFunction · 0.92
compressSpacesFunction · 0.85
ContainsMethod · 0.45

Tested by

no test coverage detected