From a53dc16adb224d579855e8b726c408f6ebbf3e80 Mon Sep 17 00:00:00 2001 From: Kejie Zhang <601172892@qq.com> Date: Mon, 17 Sep 2018 16:32:04 +0800 Subject: [PATCH] add test about publish offline mode License: MIT Signed-off-by: Kejie Zhang <601172892@qq.com> --- test/sharness/t0100-name.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/sharness/t0100-name.sh b/test/sharness/t0100-name.sh index 7dbaa7f7988b..163320f0752d 100755 --- a/test/sharness/t0100-name.sh +++ b/test/sharness/t0100-name.sh @@ -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=""` && + 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=""` && + 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