tests: use `ipfs` but with the right tool
Addresses comments in: https://github.com/jbenet/go-ipfs/commit/7e14f1737d146cb45f3d788f229dae9fd964e524
Juan Batiz-Benet committed
Nov 7, 2014 at 16:24 UTC
c9ffe1a281088d633c7878909a53fdd63f1a81c5
4 files changed
+24
-16
test/t0010-basic-commands.sh
+2
-2
@@ -13,7 +13,7 @@ test_expect_success "current dir is writable" '
13
'
14
15
test_expect_success "ipfs version succeeds" '
16
- $ipfs version >version.txt
16
+ ipfs version >version.txt
17
'
18
19
test_expect_success "ipfs version output looks good" '
@@ -21,7 +21,7 @@ test_expect_success "ipfs version output looks good" '
21
'
22
23
test_expect_success "ipfs help succeeds" '
24
- $ipfs help >help.txt
24
+ ipfs help >help.txt
25
'
26
27
test_expect_success "ipfs help output looks good" '
test/t0020-init.sh
+2
-2
@@ -10,7 +10,7 @@ test_description="Test init command"
10
11
test_expect_success "ipfs init succeeds" '
12
export IPFS_DIR="$(pwd)/.go-ipfs" &&
13
- $ipfs init
13
+ ipfs init
14
'
15
16
test_expect_success ".go-ipfs/ has been created" '
@@ -21,7 +21,7 @@ test_expect_success ".go-ipfs/ has been created" '
21
22
test_expect_success "ipfs config succeeds" '
23
echo leveldb >expected &&
24
- $ipfs config Datastore.Type >actual &&
24
+ ipfs config Datastore.Type >actual &&
25
test_cmp expected actual
26
'
27
test/t0040-add-and-cat.sh
+4
-4
@@ -12,7 +12,7 @@ test_launch_ipfs_mount
12
13
test_expect_success "ipfs add succeeds" '
14
echo "Hello Worlds!" >mountdir/hello.txt &&
15
- $ipfs add mountdir/hello.txt >actual
15
+ ipfs add mountdir/hello.txt >actual
16
'
17
18
test_expect_success "ipfs add output looks good" '
@@ -22,7 +22,7 @@ test_expect_success "ipfs add output looks good" '
22
'
23
24
test_expect_success "ipfs cat succeeds" '
25
- $ipfs cat $HASH >actual
25
+ ipfs cat $HASH >actual
26
'
27
28
test_expect_success "ipfs cat output looks good" '
@@ -53,7 +53,7 @@ test_expect_success "sha1 of the file looks ok" '
53
'
54
55
test_expect_success "ipfs add bigfile succeeds" '
56
- $ipfs add mountdir/bigfile >actual
56
+ ipfs add mountdir/bigfile >actual
57
'
58
59
test_expect_success "ipfs add bigfile output looks good" '
@@ -63,7 +63,7 @@ test_expect_success "ipfs add bigfile output looks good" '
63
'
64
65
test_expect_success "ipfs cat succeeds" '
66
- $ipfs cat $HASH | shasum >sha1_actual
66
+ ipfs cat $HASH | shasum >sha1_actual
67
'
68
69
test_expect_success "ipfs cat output looks good" '
test/test-lib.sh
+16
-8
@@ -6,11 +6,19 @@
6
# We are using sharness (https://github.com/mlafeldt/sharness)
7
# which was extracted from the Git test framework.
8
9
-SHARNESS_LIB="./sharness.sh"
9
+# use the ipfs tool to test against
10
+
11
+# add current directory to path, for ipfs tool.
12
+PATH=$(pwd):${PATH}
13
11
-# the ipfs tool to test against
12
-# ../ipfs because it will be one level above during test exec
13
-ipfs="../ipfs"
14
+# assert the `ipfs` we're using is the right one.
15
+if test `which ipfs` != $(pwd)/ipfs; then
16
+ echo >&2 "Cannot find the tests' local ipfs tool."
17
+ echo >&2 "Please check test and ipfs tool installation."
18
+ exit 1
19
+fi
20
+
21
+SHARNESS_LIB="./sharness.sh"
22
23
. "$SHARNESS_LIB" || {
24
echo >&2 "Cannot source: $SHARNESS_LIB"
@@ -35,17 +43,17 @@ test_launch_ipfs_mount() {
43
44
test_expect_success "ipfs init succeeds" '
45
export IPFS_DIR="$(pwd)/.go-ipfs" &&
38
- $ipfs init -b=2048
46
+ ipfs init -b=2048
47
'
48
49
test_expect_success "prepare config" '
50
mkdir mountdir ipfs ipns &&
43
- $ipfs config Mounts.IPFS "$(pwd)/ipfs" &&
44
- $ipfs config Mounts.IPNS "$(pwd)/ipns"
51
+ ipfs config Mounts.IPFS "$(pwd)/ipfs" &&
52
+ ipfs config Mounts.IPNS "$(pwd)/ipns"
53
'
54
55
test_expect_success FUSE "ipfs mount succeeds" '
48
- $ipfs mount mountdir >actual &
56
+ ipfs mount mountdir >actual &
57
'
58
59
test_expect_success FUSE "ipfs mount output looks good" '