2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-22 10:58:55 +00:00

Merge pull request #2621 from greatroar/fixes

Some small fixes
This commit is contained in:
MichaelEischer 2020-04-18 18:07:08 +02:00 committed by GitHub
commit 4f00564574
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 9 deletions

View File

@ -412,13 +412,11 @@ func (s *Suite) TestListCancel(t *testing.T) {
}) })
t.Run("Timeout", func(t *testing.T) { t.Run("Timeout", func(t *testing.T) {
ctx, cancel := context.WithCancel(context.TODO())
defer cancel()
// rather large timeout, let's try to get at least one item // rather large timeout, let's try to get at least one item
timeout := time.Second timeout := time.Second
ctxTimeout, _ := context.WithTimeout(ctx, timeout) ctxTimeout, cancel := context.WithTimeout(context.TODO(), timeout)
defer cancel()
i := 0 i := 0
// pass in a context with a timeout // pass in a context with a timeout

View File

@ -164,7 +164,7 @@ func TestCrypto(t *testing.T) {
} }
} }
func TestNonceVadlid(t *testing.T) { func TestNonceValid(t *testing.T) {
nonce := make([]byte, ivSize) nonce := make([]byte, ivSize)
if validNonce(nonce) { if validNonce(nonce) {

View File

@ -109,7 +109,7 @@ func newDirFromSnapshot(ctx context.Context, root *Root, inode uint64, snapshot
} }
func (d *dir) Attr(ctx context.Context, a *fuse.Attr) error { func (d *dir) Attr(ctx context.Context, a *fuse.Attr) error {
debug.Log("called") debug.Log("Attr()")
a.Inode = d.inode a.Inode = d.inode
a.Mode = os.ModeDir | d.node.Mode a.Mode = os.ModeDir | d.node.Mode
a.Uid = d.root.uid a.Uid = d.root.uid
@ -137,7 +137,7 @@ func (d *dir) calcNumberOfLinks() uint32 {
} }
func (d *dir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) { func (d *dir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
debug.Log("called") debug.Log("ReadDirAll()")
ret := make([]fuse.Dirent, 0, len(d.items)+2) ret := make([]fuse.Dirent, 0, len(d.items)+2)
ret = append(ret, fuse.Dirent{ ret = append(ret, fuse.Dirent{

View File

@ -15,7 +15,7 @@ import (
) )
// fakeFile returns a reader which yields deterministic pseudo-random data. // fakeFile returns a reader which yields deterministic pseudo-random data.
func fakeFile(t testing.TB, seed, size int64) io.Reader { func fakeFile(seed, size int64) io.Reader {
return io.LimitReader(rand.New(rand.NewSource(seed)), size) return io.LimitReader(rand.New(rand.NewSource(seed)), size)
} }
@ -138,7 +138,7 @@ func (fs *fakeFileSystem) saveTree(ctx context.Context, seed int64, depth int) I
Size: uint64(fileSize), Size: uint64(fileSize),
} }
node.Content = fs.saveFile(ctx, fakeFile(fs.t, fileSeed, fileSize)) node.Content = fs.saveFile(ctx, fakeFile(fileSeed, fileSize))
tree.Nodes = append(tree.Nodes, node) tree.Nodes = append(tree.Nodes, node)
} }