20 lines
379 B
Bash
Executable File
20 lines
379 B
Bash
Executable File
#!/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.
|
|
kill $FIRST $SECOND $THIRD
|