mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-01 19:24:14 +08:00
gofmt fix and sharness test
gofmt fixes to fsrepo.go The sharness test checks that IPFS_PATHS that are symbolically linked to another directory are returning an appropriate size License: MIT Signed-off-by: John Reed <john@re2d.xyz>
This commit is contained in:
@ -636,13 +636,13 @@ func (r *FSRepo) GetStorageUsage() (uint64, error) {
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
|
||||
pth, err = filepath.EvalSymlinks(pth)
|
||||
if err != nil {
|
||||
log.Debugf("filepath.EvalSymlinks error: %s", err)
|
||||
return 0, err
|
||||
}
|
||||
|
||||
|
||||
var du uint64
|
||||
err = filepath.Walk(pth, func(p string, f os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
|
27
test/sharness/t0088-repo-stat-symlink.sh
Normal file
27
test/sharness/t0088-repo-stat-symlink.sh
Normal file
@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2017 John Reed
|
||||
# MIT Licensed; see the LICENSE file in this repository.
|
||||
#
|
||||
|
||||
test_description="Test 'ipfs repo stat' where IPFS_PATH is a symbolic link"
|
||||
|
||||
. lib/test-lib.sh
|
||||
|
||||
test_expect_success "create symbolic link for IPFS_PATH" '
|
||||
mkdir sym_link_target &&
|
||||
ln -s sym_link_target .ipfs
|
||||
'
|
||||
|
||||
test_init_ipfs
|
||||
|
||||
# compare RepoSize when getting it directly vs via symbolic link
|
||||
test_expect_success "'ipfs repo stat' RepoSize is correct with sym link" '
|
||||
export IPFS_PATH="sym_link_target" &&
|
||||
reposize_direct=$(ipfs repo stat | grep RepoSize | awk '\''{ print $2 }'\'') &&
|
||||
export IPFS_PATH=".ipfs" &&
|
||||
reposize_symlink=$(ipfs repo stat | grep RepoSize | awk '\''{ print $2 }'\'') &&
|
||||
test $reposize_symlink -ge $reposize_direct
|
||||
'
|
||||
|
||||
test_done
|
Reference in New Issue
Block a user