2017-12-19 17:05:32 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
test_description="Test service state export"
|
|
|
|
|
|
|
|
. lib/test-lib.sh
|
|
|
|
|
|
|
|
test_ipfs_init
|
2019-08-09 14:00:55 +00:00
|
|
|
test_cluster_init "" crdt
|
2017-12-19 17:05:32 +00:00
|
|
|
|
2019-07-30 11:48:48 +00:00
|
|
|
test_expect_success IPFS,CLUSTER,JQ "state export saves the correct state to expected file (crdt)" '
|
|
|
|
cid=`docker exec ipfs sh -c "echo test_52-1 | ipfs add -q"` &&
|
2017-12-19 17:05:32 +00:00
|
|
|
ipfs-cluster-ctl pin add "$cid" &&
|
|
|
|
sleep 5 &&
|
|
|
|
cluster_kill && sleep 5 &&
|
2019-08-09 14:00:55 +00:00
|
|
|
ipfs-cluster-service --debug --config "test-config" state export -f export.json &&
|
2017-12-19 17:05:32 +00:00
|
|
|
[ -f export.json ] &&
|
2022-04-07 11:53:30 +00:00
|
|
|
jq -r ".cid" export.json | grep -q "$cid"
|
2017-12-19 17:05:32 +00:00
|
|
|
'
|
|
|
|
|
2019-07-30 11:48:48 +00:00
|
|
|
cluster_kill
|
2019-08-09 14:00:55 +00:00
|
|
|
sleep 5
|
|
|
|
test_cluster_init "" raft
|
2019-07-30 11:48:48 +00:00
|
|
|
|
|
|
|
test_expect_success IPFS,CLUSTER,JQ "state export saves the correct state to expected file (raft)" '
|
|
|
|
cid=`docker exec ipfs sh -c "echo test_52-2 | ipfs add -q"` &&
|
|
|
|
ipfs-cluster-ctl pin add "$cid" &&
|
|
|
|
sleep 5 &&
|
|
|
|
cluster_kill && sleep 5 &&
|
2019-08-09 14:00:55 +00:00
|
|
|
ipfs-cluster-service --debug --config "test-config" state export -f export.json &&
|
2019-07-30 11:48:48 +00:00
|
|
|
[ -f export.json ] &&
|
2022-04-07 11:53:30 +00:00
|
|
|
jq -r ".cid" export.json | grep -q "$cid"
|
2019-07-30 11:48:48 +00:00
|
|
|
'
|
|
|
|
|
2018-01-09 19:17:21 +00:00
|
|
|
test_clean_ipfs
|
|
|
|
test_clean_cluster
|
|
|
|
|
2017-12-19 17:05:32 +00:00
|
|
|
test_done
|