2017-12-19 17:05:32 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
test_description="Test service state import"
|
|
|
|
|
|
|
|
. lib/test-lib.sh
|
|
|
|
|
|
|
|
test_ipfs_init
|
|
|
|
test_cluster_init
|
|
|
|
test_confirm_importState
|
|
|
|
|
|
|
|
# Kill cluster daemon but keep data folder
|
|
|
|
cluster_kill
|
|
|
|
|
|
|
|
test_expect_success IPFS,CLUSTER "state import fails on incorrect format" '
|
|
|
|
sleep 5 &&
|
|
|
|
echo "not exactly json" > badImportFile &&
|
|
|
|
test_expect_code 1 ipfs-cluster-service -f --config "test-config" state import badImportFile
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success IPFS,CLUSTER,IMPORTSTATE "state import succeeds on correct format" '
|
2018-01-16 10:19:39 +00:00
|
|
|
sleep 5
|
2017-12-19 17:05:32 +00:00
|
|
|
cid=`docker exec ipfs sh -c "echo test_53 | ipfs add -q"` &&
|
|
|
|
ipfs-cluster-service -f --debug --config "test-config" state import importState &&
|
|
|
|
cluster_start &&
|
|
|
|
sleep 5 &&
|
|
|
|
ipfs-cluster-ctl pin ls "$cid" | grep -q "$cid" &&
|
|
|
|
ipfs-cluster-ctl status "$cid" | grep -q -i "PINNED"
|
|
|
|
'
|
|
|
|
|
2018-01-09 19:17:21 +00:00
|
|
|
test_clean_ipfs
|
|
|
|
test_clean_cluster
|
|
|
|
|
2017-12-19 17:05:32 +00:00
|
|
|
test_done
|