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
|
2017-07-03 18:02:27 +00:00
|
|
|
cleanup test_clean_ipfs
|
2017-05-04 22:33:12 +00:00
|
|
|
test_cluster_init
|
2017-07-03 18:02:27 +00:00
|
|
|
cleanup test_clean_cluster
|
|
|
|
|
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-07-03 18:02:27 +00:00
|
|
|
ipfs-cluster-ctl pin add "$cid" &> test4 &&
|
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
|
|
|
|
|
|
|
test_done
|