restic/internal/archiver/testing.go

19 lines
424 B
Go
Raw Normal View History

2016-09-04 10:52:43 +00:00
package archiver
import (
2017-06-04 09:16:55 +00:00
"context"
2016-09-04 10:52:43 +00:00
"testing"
2017-07-23 12:21:03 +00:00
2017-07-24 15:42:25 +00:00
"github.com/restic/restic/internal/restic"
2016-09-04 10:52:43 +00:00
)
// TestSnapshot creates a new snapshot of path.
func TestSnapshot(t testing.TB, repo restic.Repository, path string, parent *restic.ID) *restic.Snapshot {
arch := New(repo)
2017-06-04 09:16:55 +00:00
sn, _, err := arch.Snapshot(context.TODO(), nil, []string{path}, []string{"test"}, "localhost", parent)
2016-09-04 10:52:43 +00:00
if err != nil {
t.Fatal(err)
}
return sn
}