Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for recursively pinning a dag (i.e. large file). #3691

Merged
merged 1 commit into from
Feb 15, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion test/sharness/t0085-pins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,46 @@ test_pins() {
'
}

test_pin_dag() {
EXTRA_ARGS=$1

test_expect_success "'ipfs add $EXTRA_ARGS --pin=false' 1MB file" '
random 1048576 56 > afile &&
HASH=`ipfs add $EXTRA_ARGS --pin=false -q afile`
'

test_expect_success "'ipfs pin add' file" '
ipfs pin add --recursive=true $HASH
'

test_expect_success "'ipfs pin rm' file" '
ipfs pin rm $HASH
'

test_expect_success "remove part of the dag" '
PART=`ipfs refs $HASH | head -1` &&
ipfs block rm $PART
'

test_expect_success "pin file, should fail" '
test_must_fail ipfs pin add --recursive=true $HASH 2> err &&
cat err &&
grep -q "not found" err
'
}

test_init_ipfs

test_pins
test_pin_dag
test_pin_dag --raw-leaves

test_launch_ipfs_daemon --offline

test_pins

test_pin_dag
test_pin_dag --raw-leaves

test_kill_ipfs_daemon

test_done