mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-01 19:24:14 +08:00
tests: use ipfs
but with the right tool
Addresses comments in: 7e14f1737d
This commit is contained in:
@ -13,7 +13,7 @@ test_expect_success "current dir is writable" '
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "ipfs version succeeds" '
|
test_expect_success "ipfs version succeeds" '
|
||||||
$ipfs version >version.txt
|
ipfs version >version.txt
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "ipfs version output looks good" '
|
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" '
|
test_expect_success "ipfs help succeeds" '
|
||||||
$ipfs help >help.txt
|
ipfs help >help.txt
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "ipfs help output looks good" '
|
test_expect_success "ipfs help output looks good" '
|
||||||
|
@ -10,7 +10,7 @@ test_description="Test init command"
|
|||||||
|
|
||||||
test_expect_success "ipfs init succeeds" '
|
test_expect_success "ipfs init succeeds" '
|
||||||
export IPFS_DIR="$(pwd)/.go-ipfs" &&
|
export IPFS_DIR="$(pwd)/.go-ipfs" &&
|
||||||
$ipfs init
|
ipfs init
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success ".go-ipfs/ has been created" '
|
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" '
|
test_expect_success "ipfs config succeeds" '
|
||||||
echo leveldb >expected &&
|
echo leveldb >expected &&
|
||||||
$ipfs config Datastore.Type >actual &&
|
ipfs config Datastore.Type >actual &&
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ test_launch_ipfs_mount
|
|||||||
|
|
||||||
test_expect_success "ipfs add succeeds" '
|
test_expect_success "ipfs add succeeds" '
|
||||||
echo "Hello Worlds!" >mountdir/hello.txt &&
|
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" '
|
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" '
|
test_expect_success "ipfs cat succeeds" '
|
||||||
$ipfs cat $HASH >actual
|
ipfs cat $HASH >actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "ipfs cat output looks good" '
|
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" '
|
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" '
|
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" '
|
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" '
|
test_expect_success "ipfs cat output looks good" '
|
||||||
|
@ -6,11 +6,19 @@
|
|||||||
# We are using sharness (https://github.com/mlafeldt/sharness)
|
# We are using sharness (https://github.com/mlafeldt/sharness)
|
||||||
# which was extracted from the Git test framework.
|
# 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
|
# add current directory to path, for ipfs tool.
|
||||||
# ../ipfs because it will be one level above during test exec
|
PATH=$(pwd):${PATH}
|
||||||
ipfs="../ipfs"
|
|
||||||
|
# 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" || {
|
. "$SHARNESS_LIB" || {
|
||||||
echo >&2 "Cannot source: $SHARNESS_LIB"
|
echo >&2 "Cannot source: $SHARNESS_LIB"
|
||||||
@ -35,17 +43,17 @@ test_launch_ipfs_mount() {
|
|||||||
|
|
||||||
test_expect_success "ipfs init succeeds" '
|
test_expect_success "ipfs init succeeds" '
|
||||||
export IPFS_DIR="$(pwd)/.go-ipfs" &&
|
export IPFS_DIR="$(pwd)/.go-ipfs" &&
|
||||||
$ipfs init -b=2048
|
ipfs init -b=2048
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "prepare config" '
|
test_expect_success "prepare config" '
|
||||||
mkdir mountdir ipfs ipns &&
|
mkdir mountdir ipfs ipns &&
|
||||||
$ipfs config Mounts.IPFS "$(pwd)/ipfs" &&
|
ipfs config Mounts.IPFS "$(pwd)/ipfs" &&
|
||||||
$ipfs config Mounts.IPNS "$(pwd)/ipns"
|
ipfs config Mounts.IPNS "$(pwd)/ipns"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success FUSE "ipfs mount succeeds" '
|
test_expect_success FUSE "ipfs mount succeeds" '
|
||||||
$ipfs mount mountdir >actual &
|
ipfs mount mountdir >actual &
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success FUSE "ipfs mount output looks good" '
|
test_expect_success FUSE "ipfs mount output looks good" '
|
||||||
|
Reference in New Issue
Block a user