@@ -14,8 +14,8 @@ tab=$'\t'
14
14
reset_blockstore () {
15
15
node=$1
16
16
17
- ipfsi $node pin ls --quiet --type=recursive | ipfsi $node pin rm & > /dev/null
18
- ipfsi $node repo gc & > /dev/null
17
+ ipfsi " $node " pin ls --quiet --type=recursive | ipfsi " $node " pin rm & > /dev/null
18
+ ipfsi " $node " repo gc & > /dev/null
19
19
20
20
test_expect_success " pinlist empty" '
21
21
[[ -z "$( ipfsi $node pin ls )" ]]
@@ -27,18 +27,20 @@ reset_blockstore() {
27
27
28
28
# hammer with concurrent gc to ensure nothing clashes
29
29
do_import () {
30
- node=$1 ; shift
30
+ node=" $1 " ; shift
31
+ (
32
+ touch spin.gc
31
33
32
- # for tests below expecting this to be non -z
33
- echo " FIXME: BELOW TEST DISABLED FOR THE TIME BEING " > gc_out
34
+ while [[ -e spin.gc ]] ; do ipfsi " $node " repo gc & > /dev/null ; done &
35
+ while [[ -e spin.gc ]] ; do ipfsi " $node " repo gc & > /dev/null ; done &
34
36
35
- # touch spin.gc
36
- # timeout -s QUIT 30 bash -c "while [[ -e spin.gc ]]; do ipfsi $node repo gc &>>gc_out; done" & gc1_pid=$!
37
- # timeout -s QUIT 25 bash -c "while [[ -e spin.gc ]]; do ipfsi $node repo gc &>>gc_out; done" & gc2_pid=$!
37
+ ipfsi " $node " dag import " $@ " 2>&1 && ipfsi " $node " repo verify & > /dev/null
38
+ result=$?
38
39
39
- timeout -s QUIT 20 bash -c " ipfsi $node dag import $* 2>&1"
40
-
41
- rm -f spin.gc || true
40
+ rm -f spin.gc & > /dev/null
41
+ wait
42
+ exit $result
43
+ )
42
44
}
43
45
44
46
run_online_imp_exp_tests () {
66
68
| sort > basic_import_actual
67
69
'
68
70
69
- # FIXME - positive-test the lack of output when https://github.com/ipfs/go-ipfs/issues/7121 is addressed
70
- test_expect_failure " concurrent GC did not manage to grab anything and remained silent" '
71
- test_cmp /dev/null gc_out
72
- '
73
71
test_expect_success " basic import output as expected" '
74
72
test_cmp basic_import_expected basic_import_actual
75
73
'
@@ -107,37 +105,30 @@ EOE
107
105
mkfifo pipe_testnet
108
106
mkfifo pipe_devnet
109
107
110
- # test that ipfs correctly opens both pipes and deleting them doesn't interfere with cleanup
111
- bash -c '
112
- sleep 1
113
- cat ../t0054-dag-car-import-export-data/lotus_testnet_export_128_shuffled_nulroot.car > pipe_testnet & cat1_pid=$!
114
- cat ../t0054-dag-car-import-export-data/lotus_devnet_genesis_shuffled_nulroot.car > pipe_devnet & cat2_pid=$!
115
-
116
- rm pipe_testnet pipe_devnet
108
+ test_expect_success " fifo import" '
109
+ (
110
+ cat ../t0054-dag-car-import-export-data/lotus_testnet_export_128_shuffled_nulroot.car > pipe_testnet &
111
+ cat ../t0054-dag-car-import-export-data/lotus_devnet_genesis_shuffled_nulroot.car > pipe_devnet &
117
112
118
- # extra safety valve to kill the cat processes in case something goes wrong
119
- bash -c "sleep 60; kill $cat1_pid $cat2_pid 2>/dev/null" &
120
- ' &
113
+ do_import 0 \
114
+ pipe_testnet \
115
+ pipe_devnet \
116
+ ../t0054-dag-car-import-export-data/combined_naked_roots_genesis_and_128.car \
117
+ | sort > basic_fifo_import_actual
118
+ result=$?
121
119
122
- test_expect_success " fifo import" '
123
- do_import 0 \
124
- pipe_testnet \
125
- pipe_devnet \
126
- ../t0054-dag-car-import-export-data/combined_naked_roots_genesis_and_128.car \
127
- | sort > basic_fifo_import_actual
120
+ wait
121
+ exit "$result"
122
+ )
128
123
'
129
- # FIXME - positive-test the lack of output when https://github.com/ipfs/go-ipfs/issues/7121 is addressed
130
- test_expect_failure " concurrent GC did not manage to grab anything and remained silent " '
131
- test_cmp /dev/null gc_out
124
+
125
+ test_expect_success " remove fifos " '
126
+ rm pipe_testnet pipe_devnet
132
127
'
133
128
134
129
test_expect_success " fifo-import output as expected" '
135
130
test_cmp basic_import_expected basic_fifo_import_actual
136
131
'
137
-
138
- test_expect_success " fifos no longer present" '
139
- ! [[ -e pipe_testnet ]] && ! [[ -e pipe_devnet ]]
140
- '
141
132
}
142
133
143
134
0 commit comments