tests updated

This commit is contained in:
Tobias Klein 2017-09-02 19:28:09 +02:00
parent 43ff971dfd
commit 087c3fe1dc
4 changed files with 7 additions and 5 deletions

View file

@ -108,7 +108,7 @@ func archiveDirectory(b testing.TB) {
arch := archiver.New(repo) arch := archiver.New(repo)
_, id, err := arch.Snapshot(context.TODO(), nil, []string{BenchArchiveDirectory}, nil, "localhost", nil) _, id, err := arch.Snapshot(context.TODO(), nil, []string{BenchArchiveDirectory}, nil, "localhost", nil, time.Now())
OK(b, err) OK(b, err)
b.Logf("snapshot archived as %v", id) b.Logf("snapshot archived as %v", id)
@ -302,7 +302,7 @@ func TestArchiveEmptySnapshot(t *testing.T) {
arch := archiver.New(repo) arch := archiver.New(repo)
sn, id, err := arch.Snapshot(context.TODO(), nil, []string{"file-does-not-exist-123123213123", "file2-does-not-exist-too-123123123"}, nil, "localhost", nil) sn, id, err := arch.Snapshot(context.TODO(), nil, []string{"file-does-not-exist-123123213123", "file2-does-not-exist-too-123123123"}, nil, "localhost", nil, time.Now())
if err == nil { if err == nil {
t.Errorf("expected error for empty snapshot, got nil") t.Errorf("expected error for empty snapshot, got nil")
} }

View file

@ -7,6 +7,7 @@ import (
"path/filepath" "path/filepath"
"sort" "sort"
"testing" "testing"
"time"
"github.com/restic/restic/internal/archiver" "github.com/restic/restic/internal/archiver"
"github.com/restic/restic/internal/checker" "github.com/restic/restic/internal/checker"
@ -305,7 +306,7 @@ func TestCheckerModifiedData(t *testing.T) {
defer cleanup() defer cleanup()
arch := archiver.New(repo) arch := archiver.New(repo)
_, id, err := arch.Snapshot(context.TODO(), nil, []string{"."}, nil, "localhost", nil) _, id, err := arch.Snapshot(context.TODO(), nil, []string{"."}, nil, "localhost", nil, time.Now())
test.OK(t, err) test.OK(t, err)
t.Logf("archived as %v", id.Str()) t.Logf("archived as %v", id.Str())

View file

@ -2,6 +2,7 @@ package restic_test
import ( import (
"testing" "testing"
"time"
"github.com/restic/restic/internal/restic" "github.com/restic/restic/internal/restic"
. "github.com/restic/restic/internal/test" . "github.com/restic/restic/internal/test"
@ -10,6 +11,6 @@ import (
func TestNewSnapshot(t *testing.T) { func TestNewSnapshot(t *testing.T) {
paths := []string{"/home/foobar"} paths := []string{"/home/foobar"}
_, err := restic.NewSnapshot(paths, nil, "foo") _, err := restic.NewSnapshot(paths, nil, "foo", time.Now())
OK(t, err) OK(t, err)
} }

View file

@ -25,7 +25,7 @@ func TestWalkTree(t *testing.T) {
// archive a few files // archive a few files
arch := archiver.New(repo) arch := archiver.New(repo)
sn, _, err := arch.Snapshot(context.TODO(), nil, dirs, nil, "localhost", nil) sn, _, err := arch.Snapshot(context.TODO(), nil, dirs, nil, "localhost", nil, time.Now())
OK(t, err) OK(t, err)
// flush repo, write all packs // flush repo, write all packs