@@ -8,6 +8,17 @@ test_description="Test out the filestore nocopy functionality"
8
8
9
9
. lib/test-lib.sh
10
10
11
+ test_init_filestore () {
12
+ test_expect_success " clean up old node" '
13
+ rm -rf "$IPFS_PATH" mountdir ipfs ipns
14
+ '
15
+
16
+ test_init_ipfs
17
+
18
+ test_expect_success " enable filestore config setting" '
19
+ ipfs config --json Experimental.FilestoreEnabled true
20
+ '
21
+ }
11
22
12
23
test_init_dataset () {
13
24
test_expect_success " create a dataset" '
@@ -19,6 +30,11 @@ test_init_dataset() {
19
30
'
20
31
}
21
32
33
+ test_init () {
34
+ test_init_filestore
35
+ test_init_dataset
36
+ }
37
+
22
38
EXPHASH=" QmRueCuPMYYvdxWz1vWncF7wzCScEx4qasZXo5aVBb1R4V"
23
39
24
40
cat << EOF > ls_expect
@@ -68,11 +84,16 @@ test_filestore_adds() {
68
84
'
69
85
}
70
86
71
- test_filestore_verify () {
87
+ # check that the filestore is in a clean state
88
+ test_filestore_state () {
72
89
test_expect_success " ipfs filestore verify' output looks good'" '
73
90
ipfs filestore verify | LC_ALL=C sort > verify_actual
74
91
test_cmp verify_expect verify_actual
75
92
'
93
+ }
94
+
95
+ test_filestore_verify () {
96
+ test_filestore_state
76
97
77
98
test_expect_success " 'ipfs filestore verify HASH' works" '
78
99
ipfs filestore verify $FILE1_HASH > verify_actual &&
@@ -113,16 +134,19 @@ test_filestore_verify() {
113
134
ipfs filestore verify > verify_actual &&
114
135
grep changed verify_actual | grep -q somedir/file3
115
136
'
137
+
138
+ # reset the state for the next test
139
+ test_init_dataset
116
140
}
117
141
118
- cat << EOF > dups_expect
119
- $FILE1_HASH
120
- EOF
142
+ test_filestore_dups_and_rm () {
143
+ # make sure the filestore is in a clean state
144
+ test_filestore_state
121
145
122
- test_filestore_dups_rm () {
123
146
test_expect_success " 'ipfs filestore dups'" '
124
147
ipfs add --raw-leaves somedir/file1 &&
125
148
ipfs filestore dups > dups_actual &&
149
+ echo "$FILE1_HASH" > dups_expect
126
150
test_cmp dups_expect dups_actual
127
151
'
128
152
@@ -149,36 +173,23 @@ test_filestore_dups_rm() {
149
173
'
150
174
}
151
175
152
- init_ipfs_filestore () {
153
- test_expect_success " clean up old node" '
154
- rm -rf "$IPFS_PATH" mountdir ipfs ipns
155
- '
156
-
157
- test_init_ipfs
158
-
159
- test_expect_success " enable filestore config setting" '
160
- ipfs config --json Experimental.FilestoreEnabled true
161
- '
162
- }
163
-
164
- test_init_dataset
176
+ #
177
+ # No daemon
178
+ #
165
179
166
- init_ipfs_filestore
180
+ test_init
167
181
168
182
test_filestore_adds
169
183
170
184
test_filestore_verify
171
185
172
- test_filestore_dups_rm
186
+ test_filestore_dups_and_rm
173
187
174
- echo " WORKING DIR"
175
- echo " IPFS PATH = " $IPFS_PATH
176
- pwd
177
-
178
-
179
- test_init_dataset
188
+ #
189
+ # With daemon
190
+ #
180
191
181
- init_ipfs_filestore
192
+ test_init
182
193
183
194
# must be in offline mode so tests of retrieving non-exist blocks
184
195
# don't hang
@@ -188,7 +199,7 @@ test_filestore_adds
188
199
189
200
test_filestore_verify
190
201
191
- test_filestore_dups_rm
202
+ test_filestore_dups_and_rm
192
203
193
204
test_kill_ipfs_daemon
194
205
0 commit comments