Skip to content

Commit

Permalink
add test about publish offline mode
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Kejie Zhang <601172892@qq.com>
  • Loading branch information
kjzz committed Sep 17, 2018
1 parent 264a9fe commit a53dc16
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/sharness/t0100-name.sh
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,26 @@ test_expect_success "empty request to name publish doesn't panic and returns err

test_kill_ipfs_daemon

# Test daemon in offline mode
test_launch_ipfs_daemon --offline

test_expect_success "'ipfs name publish' fails offline mode" '
PEERID=`ipfs id --format="<id>"` &&
test_check_peerid "${PEERID}" &&
test_expect_code 1 ipfs name publish "/ipfs/$HASH_WELCOME_DOCS/help"
'

test_expect_success "'ipfs name publish --allow-offline ' succeed offline mode" '
PEERID=`ipfs id --format="<id>"` &&
test_check_peerid "${PEERID}" &&
ipfs name publish --allow-offline "/ipfs/$HASH_WELCOME_DOCS/help" >publish_out
'

test_expect_success "publish a path looks good" '
echo "Published to ${PEERID}: /ipfs/$HASH_WELCOME_DOCS/help" >expected3 &&
test_cmp expected3 publish_out
'

test_kill_ipfs_daemon

test_done

0 comments on commit a53dc16

Please sign in to comment.