File tree 1 file changed +37
-0
lines changed
1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ #
3
+ # Copyright (c) Jakub Sztandera
4
+ # MIT Licensed; see the LICENSE file in this repository.
5
+ #
6
+
7
+ test_description=" Test ipfs blockstore repo read check."
8
+
9
+ . lib/test-lib.sh
10
+
11
+ rm -rf " $IPF_PATH /*"
12
+
13
+ test_init_ipfs
14
+
15
+
16
+ H_BLOCK1=$( echo " Block 1" | ipfs add -q)
17
+ H_BLOCK2=$( echo " Block 2" | ipfs add -q)
18
+
19
+ BS_BLOCK1=" 1220f18e/1220f18e07ebc69997909358f28b9d2c327eb032b0afab6bbc7fd7f399a7b7590be4.data"
20
+ BS_BLOCK2=" 1220dc58/1220dc582e51f1f98b1f2d1c1baaa9f7b11602239ed42fbdf8f52d67e63cc03df12a.data"
21
+
22
+
23
+ test_expect_success ' blocks are swapped' '
24
+ ipfs cat $H_BLOCK2 > noswap &&
25
+ cp -f "$IPFS_PATH/blocks/$BS_BLOCK1" "$IPFS_PATH/blocks/$BS_BLOCK2" &&
26
+ ipfs cat $H_BLOCK2 > swap &&
27
+ test_must_fail test_cmp noswap swap
28
+ '
29
+
30
+ ipfs config --bool Datastore.HashOnRead true
31
+
32
+ test_expect_success ' getting modified block fails' '
33
+ (test_must_fail ipfs cat $H_BLOCK2 2> err_msg) &&
34
+ grep "block in storage has different hash than requested" err_msg
35
+ '
36
+
37
+ test_done
You can’t perform that action at this time.
0 commit comments