mirror of
https://github.com/octoleo/restic.git
synced 2024-12-22 10:58:55 +00:00
Address issues reported by golint
This commit is contained in:
parent
f867e65bcd
commit
04ca69cc78
@ -489,7 +489,7 @@ func TestCheckerBlobTypeConfusion(t *testing.T) {
|
|||||||
Nodes: []*restic.Node{malNode, dirNode},
|
Nodes: []*restic.Node{malNode, dirNode},
|
||||||
}
|
}
|
||||||
|
|
||||||
rootId, err := repo.SaveTree(ctx, rootTree)
|
rootID, err := repo.SaveTree(ctx, rootTree)
|
||||||
test.OK(t, err)
|
test.OK(t, err)
|
||||||
|
|
||||||
test.OK(t, repo.Flush(ctx))
|
test.OK(t, repo.Flush(ctx))
|
||||||
@ -498,12 +498,12 @@ func TestCheckerBlobTypeConfusion(t *testing.T) {
|
|||||||
snapshot, err := restic.NewSnapshot([]string{"/damaged"}, []string{"test"}, "foo", time.Now())
|
snapshot, err := restic.NewSnapshot([]string{"/damaged"}, []string{"test"}, "foo", time.Now())
|
||||||
test.OK(t, err)
|
test.OK(t, err)
|
||||||
|
|
||||||
snapshot.Tree = &rootId
|
snapshot.Tree = &rootID
|
||||||
|
|
||||||
snapId, err := repo.SaveJSONUnpacked(ctx, restic.SnapshotFile, snapshot)
|
snapID, err := repo.SaveJSONUnpacked(ctx, restic.SnapshotFile, snapshot)
|
||||||
test.OK(t, err)
|
test.OK(t, err)
|
||||||
|
|
||||||
t.Logf("saved snapshot %v", snapId.Str())
|
t.Logf("saved snapshot %v", snapID.Str())
|
||||||
|
|
||||||
delayRepo := &delayRepository{
|
delayRepo := &delayRepository{
|
||||||
Repository: repo,
|
Repository: repo,
|
||||||
|
@ -219,17 +219,17 @@ func TestFuseDir(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Test top-level directories for their UID and GID.
|
// Test top-level directories for their UID and GID.
|
||||||
func TestTopUidGid(t *testing.T) {
|
func TestTopUIDGID(t *testing.T) {
|
||||||
repo, cleanup := repository.TestRepository(t)
|
repo, cleanup := repository.TestRepository(t)
|
||||||
defer cleanup()
|
defer cleanup()
|
||||||
|
|
||||||
restic.TestCreateSnapshot(t, repo, time.Unix(1460289341, 207401672), 0, 0)
|
restic.TestCreateSnapshot(t, repo, time.Unix(1460289341, 207401672), 0, 0)
|
||||||
|
|
||||||
testTopUidGid(t, Config{}, repo, uint32(os.Getuid()), uint32(os.Getgid()))
|
testTopUIDGID(t, Config{}, repo, uint32(os.Getuid()), uint32(os.Getgid()))
|
||||||
testTopUidGid(t, Config{OwnerIsRoot: true}, repo, 0, 0)
|
testTopUIDGID(t, Config{OwnerIsRoot: true}, repo, 0, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testTopUidGid(t *testing.T, cfg Config, repo restic.Repository, uid, gid uint32) {
|
func testTopUIDGID(t *testing.T, cfg Config, repo restic.Repository, uid, gid uint32) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
@ -157,7 +157,7 @@ var (
|
|||||||
const (
|
const (
|
||||||
// size of the header-length field at the end of the file; it is a uint32
|
// size of the header-length field at the end of the file; it is a uint32
|
||||||
headerLengthSize = 4
|
headerLengthSize = 4
|
||||||
// constant overhead of the header independent of #entries
|
// HeaderSize is the header's constant overhead (independent of #entries)
|
||||||
HeaderSize = headerLengthSize + crypto.Extension
|
HeaderSize = headerLengthSize + crypto.Extension
|
||||||
|
|
||||||
maxHeaderSize = 16 * 1024 * 1024
|
maxHeaderSize = 16 * 1024 * 1024
|
||||||
|
@ -44,14 +44,6 @@ func (i *TestRepo) Lookup(bh restic.BlobHandle) []restic.PackedBlob {
|
|||||||
return packs
|
return packs
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *TestRepo) packName(pack *packInfo) string {
|
|
||||||
return i.packsIDToName[pack.id]
|
|
||||||
}
|
|
||||||
|
|
||||||
func (i *TestRepo) packID(name string) restic.ID {
|
|
||||||
return i.packsNameToID[name]
|
|
||||||
}
|
|
||||||
|
|
||||||
func (i *TestRepo) fileContent(file *fileInfo) string {
|
func (i *TestRepo) fileContent(file *fileInfo) string {
|
||||||
return i.filesPathToContent[file.location]
|
return i.filesPathToContent[file.location]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user