freebsd-ports/databases/mongodb70/files/make.test.sh
Ronald Klop 8b702c041f
databases/mongodb70: add do-test and update to 7.0.12
Changes:
https://www.mongodb.com/docs/manual/release-notes/7.0/#7.0.12---jun-28--2024

The port has had situations in which the code compiled, but the
executables did not work. Try to catch this early with make test.

- new mozjs version
- autoconf is unused now
- pet portclippy, portfmt, portlint
- pkg-message: use default mongo portnr instead of portnr used by unifi.
2024-07-07 12:50:08 +02:00

31 lines
604 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
# 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"