ports/databases/mongodb50/files/make.test.sh
Ronald Klop 0d2c09e668
databases/mongodb50: update to 5.0.28 and add do-test
Changes:
https://www.mongodb.com/docs/manual/release-notes/5.0/#5.0.28---jul-09--2024

do-test:
The port has had situations in which the code compiled, but the
executables did not work. Try to catch this early with make test.
2024-07-10 11:47:15 +02:00

32 lines
622 B
Bash
Executable file

#! /bin/sh
set -e
usage() {
echo "Usage: $0 <path>"
echo "<path> path to the executables"
}
test "$#" -eq 1 || ( usage && exit 1 )
set -x
PATH="$1:$PATH"
DBDIR=$( mktemp -d -t tmp.mongodb )
trap 'rm -rf "$DBDIR"' EXIT
# Trivial check if the binaries execute at all.
mongod --version
mongos --version
mongo --version
# Check if an empty database can be created.
mkdir "$DBDIR/db"
tail -F "$DBDIR/log" | ( grep -qFe "Waiting for connections" && kill $(cat "$DBDIR/pid") ) &
script -eF "$DBDIR/log" \
timeout -s TERM -k 30s 60s \
mongod --dbpath "$DBDIR/db" --pidfilepath "$DBDIR/pid"
echo "Test successful"