@cryptotaxi247 / kubo / commits / d8be35708

add new test to show problem

License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>

Jeromy committed Mar 8, 2016 at 20:28 UTC d8be35708710b51ab92cf5bfc8756fab6cadf3cb
1 file changed +46 -3
test/sharness/t0130-multinode.sh
+46 -3
@@ -22,9 +22,16 @@ check_file_fetch() {
22 '
23 }
24
25 -run_basic_test() {
26 - startup_cluster 5
25 +check_dir_fetch() {
26 + node=$1
27 + ref=$2
28
29 + test_expect_success "node can fetch all refs for dir" '
30 + ipfsi $node refs -r $ref > /dev/null
31 + '
32 +}
33 +
34 +run_single_file_test() {
35 test_expect_success "add a file on node1" '
36 random 1000000 > filea &&
37 FILEA_HASH=$(ipfsi 1 add -q filea)
@@ -35,6 +42,41 @@ run_basic_test() {
42 check_file_fetch 2 $FILEA_HASH filea
43 check_file_fetch 1 $FILEA_HASH filea
44 check_file_fetch 0 $FILEA_HASH filea
45 +}
46 +
47 +run_random_dir_test() {
48 + test_expect_success "create a bunch of random files" '
49 + random-files -depth=4 -dirs=5 -files=8 foobar > /dev/null
50 + '
51 +
52 + test_expect_success "add those on node 2" '
53 + DIR_HASH=$(ipfsi 2 add -r -q foobar | tail -n1)
54 + '
55 +
56 + check_dir_fetch 0 $DIR_HASH
57 + check_dir_fetch 1 $DIR_HASH
58 + check_dir_fetch 2 $DIR_HASH
59 + check_dir_fetch 3 $DIR_HASH
60 + check_dir_fetch 4 $DIR_HASH
61 +}
62 +
63 +
64 +run_basic_test() {
65 + startup_cluster 5
66 +
67 + run_single_file_test
68 +
69 + test_expect_success "shut down nodes" '
70 + iptb stop
71 + '
72 +}
73 +
74 +run_advanced_test() {
75 + startup_cluster 5
76 +
77 + run_single_file_test
78 +
79 + run_random_dir_test
80
81 test_expect_success "shut down nodes" '
82 iptb stop
@@ -45,12 +87,13 @@ test_expect_success "set up tcp testbed" '
87 iptb init -n 5 -p 0 -f --bootstrap=none
88 '
89
48 -run_basic_test
90 +run_advanced_test
91
92 test_expect_success "set up utp testbed" '
93 iptb init -n 5 -p 0 -f --bootstrap=none --utp
94 '
95
96 +# currently have issues with utp running the advanced tests
97 run_basic_test
98
99 test_done