test ipfs cat and ipfs add with a 100MB file
License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Christian Couder committed
Nov 6, 2014 at 23:00 UTC
22ac5997038dd6269eb5ae67e395e314a3dfb9d2
1 file changed
+41
test/t0040-add-and-cat.sh
+41
@@ -38,6 +38,47 @@ test_expect_success "cat ipfs/stuff looks good" '
38
test_cmp expected actual
39
'
40
41
+test_expect_success "go-random is installed" '
42
+ type random
43
+'
44
+
45
+test_expect_success "generate 100MB file using go-random" '
46
+ random 104857600 42 >mountdir/bigfile
47
+'
48
+
49
+test_expect_success "sha1 of the file looks ok" '
50
+ echo "54dc0dbbc353b2ffb745285793f89af0c9d98449 mountdir/bigfile" >sha1_expected &&
51
+ sha1sum mountdir/bigfile >sha1_actual &&
52
+ test_cmp sha1_expected sha1_actual
53
+'
54
+
55
+test_expect_success "ipfs add bigfile succeeds" '
56
+ ipfs add mountdir/bigfile >actual
57
+'
58
+
59
+test_expect_success "ipfs add bigfile output looks good" '
60
+ HASH="QmeZVkWkDu4W1vxWdDgUbqKYba9K3u45hJEdPA4Wr2sHZz" &&
61
+ echo "added $HASH $(pwd)/mountdir/bigfile" >expected &&
62
+ test_cmp expected actual
63
+'
64
+
65
+test_expect_success "ipfs cat succeeds" '
66
+ ipfs cat $HASH | sha1sum >sha1_actual
67
+'
68
+
69
+test_expect_success "ipfs cat output looks good" '
70
+ echo "54dc0dbbc353b2ffb745285793f89af0c9d98449 -" >sha1_expected &&
71
+ test_cmp sha1_expected sha1_actual
72
+'
73
+
74
+test_expect_success "cat ipfs/bigfile succeeds" '
75
+ cat ipfs/$HASH | sha1sum >sha1_actual
76
+'
77
+
78
+test_expect_success "cat ipfs/bigfile looks good" '
79
+ test_cmp sha1_expected sha1_actual
80
+'
81
+
82
test_kill_ipfs_mount
83
84
test_done