MCPcopy
hub / github.com/kopia/kopia / TestCacheClearSync

Function TestCacheClearSync

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

Source from the content-addressed store, hash-verified

10)
11
12func TestCacheClearSync(t *testing.T) {
13 env := testenv.NewCLITest(t, testenv.RepoFormatNotImportant, testenv.NewInProcRunner(t))
14
15 emptyDir := testutil.TempDirectory(t)
16
17 env.RunAndExpectSuccess(t, "repo", "create", "filesystem", "--path", env.RepoDir)
18 env.RunAndExpectSuccess(t, "snapshot", "create", emptyDir)
19 env.RunAndExpectSuccess(t, "snapshot", "create", emptyDir)
20 env.RunAndExpectSuccess(t, "snapshot", "create", emptyDir)
21 env.RunAndExpectSuccess(t, "snapshot", "create", emptyDir)
22 env.RunAndExpectSuccess(t, "snapshot", "create", emptyDir)
23
24 oldMetadataLine := mustGetLineContaining(t, env.RunAndExpectSuccess(t, "cache", "info"), "metadata")
25 oldMetadataLine2 := mustGetLineContaining(t, env.RunAndExpectSuccess(t, "cache", "info"), "metadata")
26 require.Equal(t, oldMetadataLine, oldMetadataLine2)
27
28 env.RunAndExpectSuccess(t, "cache", "clear")
29
30 newMetadataLine := mustGetLineContaining(t, env.RunAndExpectSuccess(t, "cache", "info"), "metadata")
31 require.NotEqual(t, oldMetadataLine, newMetadataLine)
32
33 env.RunAndExpectSuccess(t, "cache", "sync")
34 newerMetadataLine := mustGetLineContaining(t, env.RunAndExpectSuccess(t, "cache", "info"), "metadata")
35
36 env.RunAndExpectSuccess(t, "cache", "sync")
37 newerMetadataLine2 := mustGetLineContaining(t, env.RunAndExpectSuccess(t, "cache", "info"), "metadata")
38
39 require.NotEqual(t, newerMetadataLine, newMetadataLine)
40 require.Equal(t, newerMetadataLine, newerMetadataLine2)
41}

Callers

nothing calls this directly

Calls 6

RunAndExpectSuccessMethod · 0.95
NewCLITestFunction · 0.92
NewInProcRunnerFunction · 0.92
TempDirectoryFunction · 0.92
mustGetLineContainingFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected