1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-07-01 02:30:39 +08:00

tests: use ipfs but with the right tool

Addresses comments in: 7e14f1737d
This commit is contained in:
Juan Batiz-Benet
2014-11-07 16:24:40 -08:00
parent 7ab38696f6
commit c9ffe1a281
4 changed files with 24 additions and 16 deletions

View File

@ -13,7 +13,7 @@ test_expect_success "current dir is writable" '
'
test_expect_success "ipfs version succeeds" '
$ipfs version >version.txt
ipfs version >version.txt
'
test_expect_success "ipfs version output looks good" '
@ -21,7 +21,7 @@ test_expect_success "ipfs version output looks good" '
'
test_expect_success "ipfs help succeeds" '
$ipfs help >help.txt
ipfs help >help.txt
'
test_expect_success "ipfs help output looks good" '

View File

@ -10,7 +10,7 @@ test_description="Test init command"
test_expect_success "ipfs init succeeds" '
export IPFS_DIR="$(pwd)/.go-ipfs" &&
$ipfs init
ipfs init
'
test_expect_success ".go-ipfs/ has been created" '
@ -21,7 +21,7 @@ test_expect_success ".go-ipfs/ has been created" '
test_expect_success "ipfs config succeeds" '
echo leveldb >expected &&
$ipfs config Datastore.Type >actual &&
ipfs config Datastore.Type >actual &&
test_cmp expected actual
'

View File

@ -12,7 +12,7 @@ test_launch_ipfs_mount
test_expect_success "ipfs add succeeds" '
echo "Hello Worlds!" >mountdir/hello.txt &&
$ipfs add mountdir/hello.txt >actual
ipfs add mountdir/hello.txt >actual
'
test_expect_success "ipfs add output looks good" '
@ -22,7 +22,7 @@ test_expect_success "ipfs add output looks good" '
'
test_expect_success "ipfs cat succeeds" '
$ipfs cat $HASH >actual
ipfs cat $HASH >actual
'
test_expect_success "ipfs cat output looks good" '
@ -53,7 +53,7 @@ test_expect_success "sha1 of the file looks ok" '
'
test_expect_success "ipfs add bigfile succeeds" '
$ipfs add mountdir/bigfile >actual
ipfs add mountdir/bigfile >actual
'
test_expect_success "ipfs add bigfile output looks good" '
@ -63,7 +63,7 @@ test_expect_success "ipfs add bigfile output looks good" '
'
test_expect_success "ipfs cat succeeds" '
$ipfs cat $HASH | shasum >sha1_actual
ipfs cat $HASH | shasum >sha1_actual
'
test_expect_success "ipfs cat output looks good" '

View File

@ -6,11 +6,19 @@
# We are using sharness (https://github.com/mlafeldt/sharness)
# which was extracted from the Git test framework.
SHARNESS_LIB="./sharness.sh"
# use the ipfs tool to test against
# the ipfs tool to test against
# ../ipfs because it will be one level above during test exec
ipfs="../ipfs"
# add current directory to path, for ipfs tool.
PATH=$(pwd):${PATH}
# assert the `ipfs` we're using is the right one.
if test `which ipfs` != $(pwd)/ipfs; then
echo >&2 "Cannot find the tests' local ipfs tool."
echo >&2 "Please check test and ipfs tool installation."
exit 1
fi
SHARNESS_LIB="./sharness.sh"
. "$SHARNESS_LIB" || {
echo >&2 "Cannot source: $SHARNESS_LIB"
@ -35,17 +43,17 @@ test_launch_ipfs_mount() {
test_expect_success "ipfs init succeeds" '
export IPFS_DIR="$(pwd)/.go-ipfs" &&
$ipfs init -b=2048
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"
ipfs config Mounts.IPFS "$(pwd)/ipfs" &&
ipfs config Mounts.IPNS "$(pwd)/ipns"
'
test_expect_success FUSE "ipfs mount succeeds" '
$ipfs mount mountdir >actual &
ipfs mount mountdir >actual &
'
test_expect_success FUSE "ipfs mount output looks good" '