mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-27 16:07:42 +08:00
Enhance tests and fix tests copyright for files API root best-effort pin.
License: MIT Signed-off-by: <k@kevina.org>
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Copyright (c) 2016 Jeromy Johnson
|
# Copyright (c) 2016 Kevin Atkinson
|
||||||
# MIT Licensed; see the LICENSE file in this repository.
|
# MIT Licensed; see the LICENSE file in this repository.
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -16,21 +16,30 @@ test_expect_success "object not removed after gc" '
|
|||||||
ipfs cat QmVib14uvPnCP73XaCDpwugRuwfTsVbGyWbatHAmLSdZUS
|
ipfs cat QmVib14uvPnCP73XaCDpwugRuwfTsVbGyWbatHAmLSdZUS
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success "/hello.txt still accessible after gc" '
|
||||||
|
ipfs files read /hello.txt
|
||||||
|
'
|
||||||
|
|
||||||
|
ADIR_HASH=QmbCgoMYVuZq8m1vK31JQx9DorwQdLMF1M3sJ7kygLLqnW
|
||||||
|
FILE1_HASH=QmX4eaSJz39mNhdu5ACUwTDpyA6y24HmrQNnAape6u3buS
|
||||||
|
|
||||||
test_expect_success "gc okay after adding incomplete node -- prep" '
|
test_expect_success "gc okay after adding incomplete node -- prep" '
|
||||||
ipfs files mkdir /adir &&
|
ipfs files mkdir /adir &&
|
||||||
echo "file1" | ipfs files write --create /adir/file1 &&
|
echo "file1" | ipfs files write --create /adir/file1 &&
|
||||||
echo "file2" | ipfs files write --create /adir/file2 &&
|
echo "file2" | ipfs files write --create /adir/file2 &&
|
||||||
ipfs pin add --recursive=false QmbCgoMYVuZq8m1vK31JQx9DorwQdLMF1M3sJ7kygLLqnW &&
|
ipfs cat $FILE1_HASH &&
|
||||||
|
ipfs pin add --recursive=false $ADIR_HASH &&
|
||||||
ipfs files rm -r /adir &&
|
ipfs files rm -r /adir &&
|
||||||
ipfs repo gc && # will remove /adir/file1 and /adir/file2 but not /adir
|
ipfs repo gc && # will remove /adir/file1 and /adir/file2 but not /adir
|
||||||
ipfs files cp /ipfs/QmbCgoMYVuZq8m1vK31JQx9DorwQdLMF1M3sJ7kygLLqnW /adir &&
|
test_must_fail ipfs cat $FILE1_HASH &&
|
||||||
ipfs pin rm QmbCgoMYVuZq8m1vK31JQx9DorwQdLMF1M3sJ7kygLLqnW
|
ipfs files cp /ipfs/$ADIR_HASH /adir &&
|
||||||
|
ipfs pin rm $ADIR_HASH
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "gc okay after adding incomplete node" '
|
test_expect_success "gc okay after adding incomplete node" '
|
||||||
ipfs refs QmbCgoMYVuZq8m1vK31JQx9DorwQdLMF1M3sJ7kygLLqnW &&
|
ipfs refs $ADIR_HASH &&
|
||||||
ipfs repo gc &&
|
ipfs repo gc &&
|
||||||
ipfs refs QmbCgoMYVuZq8m1vK31JQx9DorwQdLMF1M3sJ7kygLLqnW
|
ipfs refs $ADIR_HASH
|
||||||
'
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Reference in New Issue
Block a user