#!/bin/bash set -ex go build -o ./chord-node # Test create and join. ./chord-node join -ip 127.0.0.1:3000 & FIRST=$! sleep 3 ./chord-node join -ip 127.0.0.1:3001 -c 127.0.0.1:3000 & SECOND=$! ./chord-node join -ip 127.0.0.1:3002 -c 127.0.0.1:3000 & THIRD=$! sleep 5 # Each node logs its predecessor and successors. At this point, we see the ring. # Test lookup. # First check that the lookup is independent of the node we ask. ./chord-node lookup -k key1 -n 127.0.0.1:3000 ./chord-node lookup -k key1 -n 127.0.0.1:3001 ./chord-node lookup -k key1 -n 127.0.0.1:3002 # Now check that we get some different nodes for different keys. ./chord-node lookup -k key2 -n 127.0.0.1:3000 ./chord-node lookup -k key3 -n 127.0.0.1:3000 # Test leaving. ./chord-node leave -n 127.0.0.1:3000 kill $FIRST $SECOND $THIRD