add a test for issue repro
Jeromy committed
Jun 3, 2015 at 08:41 UTC
db98e77de9301f3d4f4a927ae9f90d36d579a6ce
1 file changed
+40
test/sharness/x0045-add-cat-iptb.sh
new
+40
@@ -0,0 +1,40 @@
1
+#!/bin/sh
2
+#
3
+# Copyright (c) 2015 Jeromy Johnson
4
+# MIT Licensed; see the LICENSE file in this repository.
5
+#
6
+
7
+test_description="test two nodes transferring a large file"
8
+
9
+. lib/test-lib.sh
10
+
11
+export IPTB_ROOT="`pwd`/.iptb"
12
+
13
+test_expect_success "set up two nodes" '
14
+ IPTB_PORT=$((RANDOM % 10000 + 22000)) &&
15
+ iptb -n=2 "-p=$IPTB_PORT" init &&
16
+ iptb -wait start
17
+'
18
+
19
+test_expect_success "add a file on node1" '
20
+ export IPFS_PATH="$IPTB_ROOT/0" &&
21
+ random 400000000 > filea &&
22
+ FILEA_HASH=$(ipfs add -q filea)
23
+'
24
+
25
+test_expect_success "cat that file on node2" '
26
+ export IPFS_PATH="$IPTB_ROOT/1" &&
27
+ ipfs cat $FILEA_HASH >fileb
28
+'
29
+
30
+test_expect_success "verify files match" '
31
+ multihash filea > expected1 &&
32
+ multihash fileb > actual1 &&
33
+ test_cmp actual1 expected1
34
+'
35
+
36
+test_expect_success "shut down nodes" '
37
+ iptb stop
38
+'
39
+
40
+test_done