From 2e566a7de32b5875a4780eb68a5313cd1a2280cd Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Tue, 18 Nov 2014 22:44:28 +0100 Subject: [PATCH] Add sharness tests to document existing mount bugs This uses test_expect_failure to document some bugs related to 'ipfs mount'. License: MIT Signed-off-by: Christian Couder --- test/lib/test-lib.sh | 23 ++++++++++++++--------- test/t0030-mount.sh | 17 +++++++++++++++++ 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/test/lib/test-lib.sh b/test/lib/test-lib.sh index b052554f6..54bdd6821 100644 --- a/test/lib/test-lib.sh +++ b/test/lib/test-lib.sh @@ -51,6 +51,19 @@ test_wait_output_n_lines_60_sec() { test_cmp "expected_waitn" "actual_waitn" } +test_launch_ipfs_daemon() { + + test_expect_success FUSE "'ipfs daemon' succeeds" ' + ipfs daemon >actual & + ' + + test_expect_success FUSE "'ipfs daemon' output looks good" ' + IPFS_PID=$! && + echo "daemon listening on /ip4/127.0.0.1/tcp/5001" >expected && + test_cmp_repeat_10_sec expected actual + ' +} + test_launch_ipfs_mount() { test_expect_success "ipfs init succeeds" ' @@ -64,15 +77,7 @@ test_launch_ipfs_mount() { ipfs config Mounts.IPNS "$(pwd)/ipns" ' - test_expect_success FUSE "'ipfs daemon' succeeds" ' - ipfs daemon >actual & - ' - - test_expect_success FUSE "'ipfs daemon' output looks good" ' - IPFS_PID=$! && - echo "daemon listening on /ip4/127.0.0.1/tcp/5001" >expected && - test_cmp_repeat_10_sec expected actual - ' + test_launch_ipfs_daemon test_expect_success FUSE "'ipfs mount' succeeds" ' ipfs mount >actual diff --git a/test/t0030-mount.sh b/test/t0030-mount.sh index 7cc46938d..503335001 100755 --- a/test/t0030-mount.sh +++ b/test/t0030-mount.sh @@ -19,4 +19,21 @@ test_launch_ipfs_mount test_kill_ipfs_mount +test_expect_success "mount directories can be removed" ' + rmdir ipfs ipns +' + +test_launch_ipfs_daemon + +test_expect_failure "'ipfs mount' fails when no mount dir" ' + test_must_fail ipfs mount >actual +' + +test_expect_failure "'ipfs mount' looks good when it fails" ' + ! grep "IPFS mounted at" actual && + ! grep "IPNS mounted at" actual +' + +test_kill_ipfs_mount + test_done