@@ -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,53 +134,43 @@ test_filestore_verify() {
113
134
ipfs filestore verify > verify_actual &&
114
135
grep changed verify_actual | grep -q somedir/file3
115
136
'
116
- }
117
137
118
- cat << EOF > dups_expect
119
- $FILE1_HASH
120
- EOF
138
+ # reset the state for the next test
139
+ test_init_dataset
140
+ }
121
141
122
142
test_filestore_dups () {
143
+ # make sure the filestore is in a clean state
144
+ test_filestore_state
145
+
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
- '
128
- }
129
-
130
- init_ipfs_filestore () {
131
- test_expect_success " clean up old node" '
132
- rm -rf "$IPFS_PATH" mountdir ipfs ipns
133
- '
134
-
135
- test_init_ipfs
136
-
137
- test_expect_success " enable filestore config setting" '
138
- ipfs config --json Experimental.FilestoreEnabled true
139
151
'
140
152
}
141
153
142
- test_init_dataset
154
+ #
155
+ # No daemon
156
+ #
143
157
144
- init_ipfs_filestore
158
+ test_init
145
159
146
160
test_filestore_adds
147
161
148
162
test_filestore_verify
149
163
150
164
test_filestore_dups
151
165
152
- echo " WORKING DIR"
153
- echo " IPFS PATH = " $IPFS_PATH
154
- pwd
155
-
156
-
157
- test_init_dataset
166
+ #
167
+ # With daemon
168
+ #
158
169
159
- init_ipfs_filestore
170
+ test_init
160
171
161
- # must be in offline mode so tests of retrieving non-exist blocks
162
- # don 't hang
172
+ # must be in offline mode so tests that retrieve non-existent blocks
173
+ # doesn 't hang
163
174
test_launch_ipfs_daemon --offline
164
175
165
176
test_filestore_adds
0 commit comments