063c5f1b78
Fixes #865. This makes the necessary changes so that consensu is selected on "init" with a flag set, by default, to "crdt". This generates only a "crdt" or a "raft" section, not both. If the configuration file has a "raft" section, "raft" will be used to start the daemon. If it has a "crdt" section, "crdt" will be used. If it has none or both sections, an error will happen. This also affects "state *" commands, which will now autoselect how to work from the existing configuration.
38 lines
1.0 KiB
Bash
Executable File
38 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
test_description="Test service state export"
|
|
|
|
. lib/test-lib.sh
|
|
|
|
test_ipfs_init
|
|
test_cluster_init "" crdt
|
|
|
|
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"` &&
|
|
ipfs-cluster-ctl pin add "$cid" &&
|
|
sleep 5 &&
|
|
cluster_kill && sleep 5 &&
|
|
ipfs-cluster-service --debug --config "test-config" state export -f export.json &&
|
|
[ -f export.json ] &&
|
|
jq -r ".cid | .[\"/\"]" export.json | grep -q "$cid"
|
|
'
|
|
|
|
cluster_kill
|
|
sleep 5
|
|
test_cluster_init "" raft
|
|
|
|
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 &&
|
|
ipfs-cluster-service --debug --config "test-config" state export -f export.json &&
|
|
[ -f export.json ] &&
|
|
jq -r ".cid | .[\"/\"]" export.json | grep -q "$cid"
|
|
'
|
|
|
|
test_clean_ipfs
|
|
test_clean_cluster
|
|
|
|
test_done
|