2017-04-28 18:01:48 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-04-18 22:22:05 +00:00
|
|
|
test_description="Test cluster-ctl's pinning and unpinning functionality"
|
|
|
|
|
2017-04-19 00:54:08 +00:00
|
|
|
. lib/test-lib.sh
|
2017-04-18 22:22:05 +00:00
|
|
|
|
2017-05-04 22:33:12 +00:00
|
|
|
test_ipfs_init
|
|
|
|
test_cluster_init
|
2017-07-03 18:02:27 +00:00
|
|
|
|
2017-05-04 22:33:12 +00:00
|
|
|
test_expect_success IPFS,CLUSTER "pin data to cluster with ctl" '
|
2017-10-11 19:51:17 +00:00
|
|
|
cid=`docker exec ipfs sh -c "echo test | ipfs add -q"`
|
2017-11-28 22:45:10 +00:00
|
|
|
ipfs-cluster-ctl pin add "$cid" &&
|
2017-05-02 20:32:42 +00:00
|
|
|
ipfs-cluster-ctl pin ls "$cid" | grep -q "$cid" &&
|
|
|
|
ipfs-cluster-ctl status "$cid" | grep -q -i "PINNED"
|
2017-04-19 00:54:08 +00:00
|
|
|
'
|
2017-04-18 22:22:05 +00:00
|
|
|
|
2017-05-04 22:33:12 +00:00
|
|
|
test_expect_success IPFS,CLUSTER "unpin data from cluster with ctl" '
|
2017-07-03 18:02:27 +00:00
|
|
|
cid=`ipfs-cluster-ctl --enc=json pin ls | jq -r ".[] | .cid" | head -1`
|
2017-05-02 20:32:42 +00:00
|
|
|
ipfs-cluster-ctl pin rm "$cid" &&
|
|
|
|
!(ipfs-cluster-ctl pin ls "$cid" | grep -q "$cid") &&
|
2017-05-05 16:09:36 +00:00
|
|
|
ipfs-cluster-ctl status "$cid" | grep -q -i "UNPINNED"
|
2017-04-19 00:54:08 +00:00
|
|
|
'
|
2017-04-18 22:22:05 +00:00
|
|
|
|
2018-03-14 08:49:49 +00:00
|
|
|
test_expect_success IPFS,CLUSTER "wait for data to pin to cluster with ctl" '
|
|
|
|
cid=`docker exec ipfs sh -c "dd if=/dev/urandom bs=1024 count=2048 | ipfs add -q"`
|
|
|
|
ipfs-cluster-ctl pin add --wait "$cid" | grep -q -i "PINNED" &&
|
|
|
|
ipfs-cluster-ctl pin ls "$cid" | grep -q "$cid" &&
|
|
|
|
ipfs-cluster-ctl status "$cid" | grep -q -i "PINNED"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success IPFS,CLUSTER "wait for data to unpin from cluster with ctl" '
|
|
|
|
cid=`ipfs-cluster-ctl --enc=json pin ls | jq -r ".[] | .cid" | head -1`
|
|
|
|
ipfs-cluster-ctl pin rm --wait "$cid" | grep -q -i "UNPINNED" &&
|
|
|
|
!(ipfs-cluster-ctl pin ls "$cid" | grep -q "$cid") &&
|
|
|
|
ipfs-cluster-ctl status "$cid" | grep -q -i "UNPINNED"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success IPFS,CLUSTER "wait for data to pin to cluster with ctl with timeout" '
|
|
|
|
cid=`docker exec ipfs sh -c "dd if=/dev/urandom bs=1024 count=2048 | ipfs add -q"`
|
|
|
|
ipfs-cluster-ctl pin add --wait --wait-timeout 2s "$cid" | grep -q -i "PINNED" &&
|
|
|
|
ipfs-cluster-ctl pin ls "$cid" | grep -q "$cid" &&
|
|
|
|
ipfs-cluster-ctl status "$cid" | grep -q -i "PINNED"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success IPFS,CLUSTER "wait for data to unpin from cluster with ctl with timeout" '
|
|
|
|
cid=`ipfs-cluster-ctl --enc=json pin ls | jq -r ".[] | .cid" | head -1`
|
|
|
|
ipfs-cluster-ctl pin rm --wait --wait-timeout 2s "$cid" | grep -q -i "UNPINNED" &&
|
|
|
|
!(ipfs-cluster-ctl pin ls "$cid" | grep -q "$cid") &&
|
|
|
|
ipfs-cluster-ctl status "$cid" | grep -q -i "UNPINNED"
|
|
|
|
'
|
|
|
|
|
2018-01-09 19:17:21 +00:00
|
|
|
test_clean_ipfs
|
|
|
|
test_clean_cluster
|
|
|
|
|
2017-04-18 22:22:05 +00:00
|
|
|
test_done
|