2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-23 05:12:10 +00:00
restic/internal/archiver/testing.go

20 lines
444 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"
"time"
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)
sn, _, err := arch.Snapshot(context.TODO(), nil, []string{path}, []string{"test"}, "localhost", parent, time.Now())
2016-09-04 10:52:43 +00:00
if err != nil {
t.Fatal(err)
}
return sn
}