Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
b9e8c001
Commit
b9e8c001
authored
Nov 17, 2015
by
Juan Benet
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1968 from rht/gc-auto-test
Add gc auto test
parents
3a2ac8f0
54a98918
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
0 deletions
+70
-0
test/sharness/t0082-repo-gc-auto.sh
test/sharness/t0082-repo-gc-auto.sh
+70
-0
No files found.
test/sharness/t0082-repo-gc-auto.sh
0 → 100755
View file @
b9e8c001
#!/bin/sh
#
# MIT Licensed; see the LICENSE file in this repository.
#
test_description
=
"Test ipfs repo auto gc"
.
lib/test-lib.sh
check_ipfs_storage
()
{
ipfs config Datastore.StorageMax
}
test_init_ipfs
test_expect_success
"generate 2 600 kB files and 2 MB file using go-random"
'
random 600k 41 >600k1 &&
random 600k 42 >600k2 &&
random 2M 43 >2M
'
test_expect_success
"set ipfs gc watermark, storage max, and gc timeout"
'
test_config_set Datastore.StorageMax "2MB" &&
test_config_set --json Datastore.StorageGCWatermark 60 &&
test_config_set Datastore.GCPeriod "20ms"
'
test_launch_ipfs_daemon
--enable-gc
test_gc
()
{
test_expect_success
"adding data below watermark doesn't trigger auto gc"
'
ipfs add 600k1 >/dev/null &&
disk_usage "$IPFS_PATH/blocks" >expected &&
go-sleep 40ms &&
disk_usage "$IPFS_PATH/blocks" >actual &&
test_cmp expected actual
'
test_expect_success
"adding data beyond watermark triggers auto gc"
'
HASH=`ipfs add -q 600k2` &&
ipfs pin rm -r $HASH &&
go-sleep 40ms &&
DU=$(disk_usage "$IPFS_PATH/blocks") &&
if test $(uname -s) = "Darwin"; then
test "$DU" -lt 1400 # 60% of 2MB
else
test "$DU" -lt 1000000
fi
'
}
#TODO: conditional GC test is disabled due to files size bug in ipfs add
#test_expect_success "adding data beyond storageMax fails" '
# test_must_fail ipfs add 2M 2>add_fail_out
#'
#test_expect_success "ipfs add not enough space message looks good" '
# echo "Error: file size exceeds slack space allowed by storageMax. Maybe unpin some files?" >add_fail_exp &&
# test_cmp add_fail_exp add_fail_out
#'
test_expect_success
"periodic auto gc stress test"
'
for i in $(test_seq 1 20)
do
test_gc
done
'
test_kill_ipfs_daemon
test_done
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment