mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-29 17:36:38 +08:00
t0081: use 'ipfs pin ls <arg>' in test_pin_flagi()
License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
This commit is contained in:
@ -8,30 +8,23 @@ test_description="Test ipfs repo pinning"
|
|||||||
|
|
||||||
. lib/test-lib.sh
|
. lib/test-lib.sh
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
test_pin_flag() {
|
test_pin_flag() {
|
||||||
object=$1
|
object=$1
|
||||||
ptype=$2
|
ptype=$2
|
||||||
expect=$3
|
expect=$3
|
||||||
|
|
||||||
echo "test_pin_flag" $@
|
echo "test_pin_flag" "$@"
|
||||||
|
|
||||||
ipfs-pin-stat "$object" | egrep "\b$ptype\b"
|
if ipfs pin ls --type="$ptype" "$object" >actual
|
||||||
actual=$?
|
then
|
||||||
|
test "$expect" = "true" && return
|
||||||
if [ "$expect" = "true" ]; then
|
test_fsh cat actual
|
||||||
if [ "$actual" != "0" ]; then
|
return
|
||||||
echo "$object should be pinned $ptype ($actual)"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
if [ "$actual" != "1" ]; then
|
test "$expect" = "false" && return
|
||||||
echo "$object should NOT be pinned $ptype ($actual)"
|
test_fsh cat actual
|
||||||
return 1
|
return
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
test_pin() {
|
test_pin() {
|
||||||
|
Reference in New Issue
Block a user