chord/test.bash
2025-03-14 23:09:08 -04:00

24 lines
434 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.
# Test leaving.
./chord-node leave -n 127.0.0.1:3000
kill $FIRST $SECOND $THIRD