mirror of
https://github.com/octoleo/restic.git
synced 2024-11-02 19:49:44 +00:00
Make TestCreateSnapshot return the snapshot itself
This commit is contained in:
parent
5c32ae15c2
commit
fe79177b40
@ -100,7 +100,7 @@ func saveTree(t testing.TB, repo *repository.Repository, seed int64, depth int)
|
|||||||
// fake data is generated deterministically from the timestamp `at`, which is
|
// fake data is generated deterministically from the timestamp `at`, which is
|
||||||
// also used as the snapshot's timestamp. The tree's depth can be specified
|
// also used as the snapshot's timestamp. The tree's depth can be specified
|
||||||
// with the parameter depth.
|
// with the parameter depth.
|
||||||
func TestCreateSnapshot(t testing.TB, repo *repository.Repository, at time.Time, depth int) backend.ID {
|
func TestCreateSnapshot(t testing.TB, repo *repository.Repository, at time.Time, depth int) *Snapshot {
|
||||||
seed := at.Unix()
|
seed := at.Unix()
|
||||||
t.Logf("create fake snapshot at %s with seed %d", at, seed)
|
t.Logf("create fake snapshot at %s with seed %d", at, seed)
|
||||||
|
|
||||||
@ -119,6 +119,8 @@ func TestCreateSnapshot(t testing.TB, repo *repository.Repository, at time.Time,
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snapshot.id = &id
|
||||||
|
|
||||||
t.Logf("saved snapshot %v", id.Str())
|
t.Logf("saved snapshot %v", id.Str())
|
||||||
|
|
||||||
err = repo.Flush()
|
err = repo.Flush()
|
||||||
@ -131,5 +133,5 @@ func TestCreateSnapshot(t testing.TB, repo *repository.Repository, at time.Time,
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return id
|
return snapshot
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user