Enhance tests and fix tests copyright for files API root best-effort pin.
License: MIT Signed-off-by: <k@kevina.org>
Kevin Atkinson committed
Jun 20, 2016 at 21:11 UTC
466d70993fdb7c4043f243fed7a95d6b9e938ee5
1 file changed
+15
-6
test/sharness/t0252-files-gc.sh
+15
-6
@@ -1,6 +1,6 @@
1
#!/bin/sh
2
#
3
-# Copyright (c) 2016 Jeromy Johnson
3
+# Copyright (c) 2016 Kevin Atkinson
4
# MIT Licensed; see the LICENSE file in this repository.
5
#
6
@@ -16,21 +16,30 @@ test_expect_success "object not removed after gc" '
16
ipfs cat QmVib14uvPnCP73XaCDpwugRuwfTsVbGyWbatHAmLSdZUS
17
'
18
19
+test_expect_success "/hello.txt still accessible after gc" '
20
+ ipfs files read /hello.txt
21
+'
22
+
23
+ADIR_HASH=QmbCgoMYVuZq8m1vK31JQx9DorwQdLMF1M3sJ7kygLLqnW
24
+FILE1_HASH=QmX4eaSJz39mNhdu5ACUwTDpyA6y24HmrQNnAape6u3buS
25
+
26
test_expect_success "gc okay after adding incomplete node -- prep" '
27
ipfs files mkdir /adir &&
28
echo "file1" | ipfs files write --create /adir/file1 &&
29
echo "file2" | ipfs files write --create /adir/file2 &&
23
- ipfs pin add --recursive=false QmbCgoMYVuZq8m1vK31JQx9DorwQdLMF1M3sJ7kygLLqnW &&
30
+ ipfs cat $FILE1_HASH &&
31
+ ipfs pin add --recursive=false $ADIR_HASH &&
32
ipfs files rm -r /adir &&
33
ipfs repo gc && # will remove /adir/file1 and /adir/file2 but not /adir
26
- ipfs files cp /ipfs/QmbCgoMYVuZq8m1vK31JQx9DorwQdLMF1M3sJ7kygLLqnW /adir &&
27
- ipfs pin rm QmbCgoMYVuZq8m1vK31JQx9DorwQdLMF1M3sJ7kygLLqnW
34
+ test_must_fail ipfs cat $FILE1_HASH &&
35
+ ipfs files cp /ipfs/$ADIR_HASH /adir &&
36
+ ipfs pin rm $ADIR_HASH
37
'
38
39
test_expect_success "gc okay after adding incomplete node" '
31
- ipfs refs QmbCgoMYVuZq8m1vK31JQx9DorwQdLMF1M3sJ7kygLLqnW &&
40
+ ipfs refs $ADIR_HASH &&
41
ipfs repo gc &&
33
- ipfs refs QmbCgoMYVuZq8m1vK31JQx9DorwQdLMF1M3sJ7kygLLqnW
42
+ ipfs refs $ADIR_HASH
43
'
44
45
test_done