Skip to content

Instantly share code, notes, and snippets.

@tleyden
Last active December 21, 2015 23:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tleyden/6386249 to your computer and use it in GitHub Desktop.
Save tleyden/6386249 to your computer and use it in GitHub Desktop.
# start sync gateway if not already
# push pull on device1
http POST localhost:8080/_replicate source="cblite-test" target="http://10.0.2.2:4984/db" continuous:=true
http POST localhost:8080/_replicate target="cblite-test" source="http://10.0.2.2:4984/db" continuous:=true
# push pull on device2
http POST localhost:8081/_replicate source="cblite-test" target="http://10.0.2.2:4984/db" continuous:=true
http POST localhost:8081/_replicate target="cblite-test" source="http://10.0.2.2:4984/db" continuous:=true
# 150 docs on device1
seq 1 150 | xargs -I '{}' echo http PUT localhost:8080/cblite-test/hello'{}' _id=hello'{}' checked:=true > docs.sh
chmod +x docs.sh
./docs.sh
# verify sync on both devices by checking doc_count
# stop sync gateway
# on device1 do an _all_docs to get revs and update some values from checked=true to false (REVS WLL BE DIFFERENT)
http localhost:8080/cblite-test/_all_docs
http POST localhost:8080/cblite-test checked:=false _id=hello99 _rev="1-e1f67a13-fa2a-4ede-a5e7-26a693a0e35e"
http POST localhost:8080/cblite-test checked:=false _id=hello98 _rev="1-c8643cb5-a8fe-4ebc-a9a0-f9753ff81eef"
http POST localhost:8080/cblite-test checked:=false _id=hello97 _rev="1-9e67db16-32f8-45e2-a957-3da80c1a25c4"
http POST localhost:8080/cblite-test checked:=false _id=hello96 _rev="1-bf5a3473-5bdc-435c-b96a-0e05e08d9181"
# do the same for some docs on device2 (changing checked from true to false)
# add some more docs on both device1 with checked = true
seq 151 225 | xargs -I '{}' echo http PUT localhost:8080/cblite-test/hello'{}' _id=hello'{}' checked:=true > docs.sh
chmod +x docs.sh
./docs.sh
# add similar set to device2 with checked = false
seq 151 225 | xargs -I '{}' echo http PUT localhost:8081/cblite-test/hello'{}' _id=hello'{}' checked:=false > docs.sh
chmod +x docs.sh
./docs.sh
# add some new non existing docs to device1
seq 320 340 | xargs -I '{}' echo http PUT localhost:8080/cblite-test/hello'{}' _id=hello'{}' something=else > docs.sh
chmod +x docs.sh
./docs.sh
# restart sync gateway
# redo push/pull replication on both devices
# push pull on device1
http POST localhost:8080/_replicate source="cblite-test" target="http://10.0.2.2:4984/db" continuous:=true
http POST localhost:8080/_replicate target="cblite-test" source="http://10.0.2.2:4984/db" continuous:=true
# push pull on device2
http POST localhost:8081/_replicate source="cblite-test" target="http://10.0.2.2:4984/db" continuous:=true
http POST localhost:8081/_replicate target="cblite-test" source="http://10.0.2.2:4984/db" continuous:=true
# CRASHED HERE FOR ME #
# check that both devices have checked=false on docs that were updated
http localhost:8080/cblite-test/hello99
http localhost:8080/cblite-test/hello98
http localhost:8081/cblite-test/hello99
http localhost:8081/cblite-test/hello98
# also check that total num of docs on both devices should be 246
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment