-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nsqd: move cluster test/don't rely on external scaffold
- Loading branch information
1 parent
06e054c
commit 5adf12b
Showing
4 changed files
with
97 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,15 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# build and run nsqlookupd | ||
LOOKUP_LOGFILE=$(mktemp -t nsqlookupd.XXXXXXX) | ||
cmd="apps/nsqlookupd/nsqlookupd --broadcast-address=127.0.0.1" | ||
echo "building and starting $cmd" | ||
echo " logging to $LOOKUP_LOGFILE" | ||
go build -o apps/nsqlookupd/nsqlookupd ./apps/nsqlookupd/ | ||
$cmd >$LOOKUP_LOGFILE 2>&1 & | ||
LOOKUPD_PID=$! | ||
|
||
# build and run nsqd configured to use our lookupd above | ||
NSQD_LOGFILE=$(mktemp -t nsqd.XXXXXXX) | ||
cmd="apps/nsqd/nsqd --data-path=/tmp --broadcast-address=127.0.0.1 --lookupd-tcp-address=127.0.0.1:4160 --tls-cert=nsqd/test/certs/cert.pem --tls-key=nsqd/test/certs/key.pem --tls-min-version=tls1.0" | ||
echo "building and starting $cmd" | ||
echo " logging to $NSQD_LOGFILE" | ||
go build -o apps/nsqd/nsqd ./apps/nsqd | ||
$cmd >$NSQD_LOGFILE 2>&1 & | ||
NSQD_PID=$! | ||
|
||
sleep 0.3 | ||
|
||
cleanup() { | ||
echo "killing nsqd PID $NSQD_PID" | ||
kill -s TERM $NSQD_PID || cat $NSQD_LOGFILE | ||
echo "killing nsqlookupd PID $LOOKUPD_PID" | ||
kill -s TERM $LOOKUPD_PID || cat $LOOKUP_LOGFILE | ||
} | ||
trap cleanup INT TERM EXIT | ||
|
||
go test -timeout 60s ./... | ||
GOMAXPROCS=4 go test -timeout 60s -race ./... | ||
GOMAXPROCS=1 go test -timeout 90s ./... | ||
GOMAXPROCS=4 go test -timeout 90s -race ./... | ||
|
||
# no tests, but a build is something | ||
for dir in $(find apps bench -maxdepth 1 -type d) nsqadmin; do | ||
if grep -q '^package main$' $dir/*.go ; then | ||
if grep -q '^package main$' $dir/*.go 2>/dev/null; then | ||
echo "building $dir" | ||
go build -o $dir/$(basename $dir) ./$dir | ||
else | ||
echo "WARNING: skipping go build in $dir" | ||
echo "(skipped $dir)" | ||
fi | ||
done |