6188d6ff52
It has a few implications to launch a raft peer when you wanted to do crdt and vice-versa. Same when exporting and exporting states. Users starting cluster peers should be explicit about their consensus choice. Also, if we ever want to make `crdt` the default, we can't do that before making `raft` non-default first. I don't like to break things but otherwise the experience for new users wanting to try crdts might be aweful.
34 lines
916 B
Bash
Executable File
34 lines
916 B
Bash
Executable File
#!/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 --config "test-config" state import --consensus crdt -f badImportFile
|
|
'
|
|
|
|
test_expect_success IPFS,CLUSTER,IMPORTSTATE "state import succeeds on correct format" '
|
|
sleep 5
|
|
cid=`docker exec ipfs sh -c "echo test_53 | ipfs add -q"` &&
|
|
ipfs-cluster-service --debug --config "test-config" state import --consensus crdt -f importState &&
|
|
cluster_start &&
|
|
sleep 5 &&
|
|
ipfs-cluster-ctl pin ls "$cid" | grep -q "$cid" &&
|
|
ipfs-cluster-ctl status "$cid" | grep -q -i "PINNED"
|
|
'
|
|
|
|
test_clean_ipfs
|
|
test_clean_cluster
|
|
|
|
test_done
|