diff --git a/cmd/restic/integration_test.go b/cmd/restic/integration_test.go index d097ada5d..a241bb203 100644 --- a/cmd/restic/integration_test.go +++ b/cmd/restic/integration_test.go @@ -86,6 +86,11 @@ func cmdFsck(t testing.TB) { OK(t, cmd.Execute(nil)) } +func cmdKey(t testing.TB, args ...string) { + cmd := &CmdKey{} + OK(t, cmd.Execute(args)) +} + func TestBackup(t *testing.T) { withTestEnvironment(t, func(env *testEnvironment) { datafile := filepath.Join("testdata", "backup-data.tar.gz") @@ -220,3 +225,19 @@ func TestIncrementalBackup(t *testing.T) { t.Logf("repository grown by %d bytes", stat3.size-stat2.size) }) } + +func TestKeyAddRemove(t *testing.T) { + withTestEnvironment(t, func(env *testEnvironment) { + datafile := filepath.Join("testdata", "backup-data.tar.gz") + fd, err := os.Open(datafile) + if os.IsNotExist(err) { + t.Skipf("unable to find data file %q, skipping", datafile) + return + } + OK(t, err) + OK(t, fd.Close()) + + cmdInit(t) + cmdKey(t, "list") + }) +}