mirror of
https://github.com/octoleo/restic.git
synced 2024-12-23 03:18:55 +00:00
Fix test for PackerManager
This commit is contained in:
parent
8e722d8fee
commit
0d95507909
@ -29,6 +29,20 @@ type Packer struct {
|
||||
tmpfile *os.File
|
||||
}
|
||||
|
||||
// Finalize finalizes the pack.Packer and then closes the tempfile.
|
||||
func (p *Packer) Finalize() (uint, error) {
|
||||
n, err := p.Packer.Finalize()
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
|
||||
if err = p.tmpfile.Close(); err != nil {
|
||||
return n, err
|
||||
}
|
||||
|
||||
return n, nil
|
||||
}
|
||||
|
||||
// packerManager keeps a list of open packs and creates new on demand.
|
||||
type packerManager struct {
|
||||
be Saver
|
||||
|
@ -53,17 +53,14 @@ func saveFile(t testing.TB, be Saver, filename string, id restic.ID) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if err := f.Close(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}()
|
||||
|
||||
h := restic.Handle{Type: restic.DataFile, Name: id.String()}
|
||||
t.Logf("save file %v", h)
|
||||
|
||||
err = be.Save(h, f)
|
||||
if err != nil {
|
||||
if err = be.Save(h, f); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if err = f.Close(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user