forked from TrueCloudLab/restic
cleanup prune integration test
This commit is contained in:
parent
7a268e4aba
commit
692f81ede8
1 changed files with 9 additions and 17 deletions
|
@ -1,10 +1,8 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"os"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
@ -77,21 +75,15 @@ func createPrunableRepo(t *testing.T, env *testEnvironment) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testRunForgetJSON(t testing.TB, gopts GlobalOptions, args ...string) {
|
func testRunForgetJSON(t testing.TB, gopts GlobalOptions, args ...string) {
|
||||||
buf := bytes.NewBuffer(nil)
|
buf, err := withCaptureStdout(func() error {
|
||||||
oldJSON := gopts.JSON
|
gopts.JSON = true
|
||||||
gopts.stdout = buf
|
opts := ForgetOptions{
|
||||||
gopts.JSON = true
|
DryRun: true,
|
||||||
defer func() {
|
Last: 1,
|
||||||
gopts.stdout = os.Stdout
|
}
|
||||||
gopts.JSON = oldJSON
|
return runForget(context.TODO(), opts, gopts, args)
|
||||||
}()
|
})
|
||||||
|
rtest.OK(t, err)
|
||||||
opts := ForgetOptions{
|
|
||||||
DryRun: true,
|
|
||||||
Last: 1,
|
|
||||||
}
|
|
||||||
|
|
||||||
rtest.OK(t, runForget(context.TODO(), opts, gopts, args))
|
|
||||||
|
|
||||||
var forgets []*ForgetGroup
|
var forgets []*ForgetGroup
|
||||||
rtest.OK(t, json.Unmarshal(buf.Bytes(), &forgets))
|
rtest.OK(t, json.Unmarshal(buf.Bytes(), &forgets))
|
||||||
|
|
Loading…
Reference in a new issue