From b6a98c10b3eea32016dca8b9342db0ebbde24921 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Fri, 31 Oct 2014 21:25:35 +0100 Subject: [PATCH] Add test for ipfs mount License: MIT Signed-off-by: Christian Couder --- test/t0030-mount.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 test/t0030-mount.sh diff --git a/test/t0030-mount.sh b/test/t0030-mount.sh new file mode 100755 index 000000000..6712922b2 --- /dev/null +++ b/test/t0030-mount.sh @@ -0,0 +1,44 @@ +#!/bin/sh +# +# Copyright (c) 2014 Christian Couder +# MIT Licensed; see the LICENSE file in this repository. +# + +test_description="Test mount command" + +. ./test-lib.sh + +test_expect_success "ipfs init succeeds" ' + export IPFS_DIR="$(pwd)/.go-ipfs" && + ipfs init -b=2048 +' + +test_expect_success "prepare config" ' + mkdir mountdir ipfs ipns && + ipfs config Mounts.IPFS "$(pwd)/ipfs" && + ipfs config Mounts.IPNS "$(pwd)/ipns" +' + +test_expect_success "ipfs mount succeeds" ' + ipfs mount mountdir >actual & +' + +test_expect_success "ipfs mount output looks good" ' + IPFS_PID=$! && + sleep 5 && + echo "mounting ipfs at $(pwd)/ipfs" >expected && + echo "mounting ipns at $(pwd)/ipns" >>expected && + test_cmp expected actual +' + +test_expect_success "ipfs mount is still running" ' + kill -0 $IPFS_PID +' + +test_expect_success "ipfs mount can be killed" ' + kill $IPFS_PID && + sleep 1 && + ! kill -0 $IPFS_PID 2>/dev/null +' + +test_done