Skip to content

Commit bbd94f9

Browse files
committed
fix: 🐛 ignore lost+found directories on storage retrieval
#267
1 parent 0298e71 commit bbd94f9

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

helpers/shells/getStorageUsed.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
# Exit when any command fails
1515
set -e
1616

17+
# Ignore "lost+found" directories
18+
GLOBIGNORE="LOST+FOUND:lost+found"
19+
1720
# Load .env if exists
1821
if [[ -f .env ]]; then
1922
source .env

tests/bats/getStorageUsed.bats

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,32 @@ teardown() {
7676
[ "$status" -eq 0 ]
7777
[ "$normalized_output" == "$normalized_expected_output" ]
7878
}
79+
80+
@test "Test getStorageUsed.sh ignores lost+found directory" {
81+
mkdir -p "${home}/repos/lost+found"
82+
dd if=/dev/zero of="${home}/repos/lost+found/file1" bs=1K count=500
83+
84+
run bash /test/scripts/getStorageUsed.sh
85+
86+
# Expected output should NOT include lost+found
87+
expected_output='[
88+
{
89+
"size": 36,
90+
"name": "repo1"
91+
},
92+
{
93+
"size": 1160,
94+
"name": "repo2"
95+
},
96+
{
97+
"size": 116,
98+
"name": "repo3"
99+
}
100+
]'
101+
102+
normalized_output=$(echo "$output" | jq .)
103+
normalized_expected_output=$(echo "$expected_output" | jq .)
104+
105+
[ "$status" -eq 0 ]
106+
[ "$normalized_output" == "$normalized_expected_output" ]
107+
}

0 commit comments

Comments
 (0)