github.com/mckael/restic@v0.8.3/internal/archiver/testing.go (about)

     1  package archiver
     2  
     3  import (
     4  	"context"
     5  	"testing"
     6  	"time"
     7  
     8  	"github.com/restic/restic/internal/restic"
     9  )
    10  
    11  // TestSnapshot creates a new snapshot of path.
    12  func TestSnapshot(t testing.TB, repo restic.Repository, path string, parent *restic.ID) *restic.Snapshot {
    13  	arch := New(repo)
    14  	sn, _, err := arch.Snapshot(context.TODO(), nil, []string{path}, []string{"test"}, "localhost", parent, time.Now())
    15  	if err != nil {
    16  		t.Fatal(err)
    17  	}
    18  	return sn
    19  }