git: 05637021054d - main - databases/mongodb60: add do-test target
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 04 Jul 2024 21:29:10 UTC
The branch main has been updated by ronald: URL: https://cgit.FreeBSD.org/ports/commit/?id=05637021054d6121cfdd14716298a0809dc15bfc commit 05637021054d6121cfdd14716298a0809dc15bfc Author: Ronald Klop <ronald@FreeBSD.org> AuthorDate: 2024-07-03 19:27:07 +0000 Commit: Ronald Klop <ronald@FreeBSD.org> CommitDate: 2024-07-04 21:28:55 +0000 databases/mongodb60: add do-test target The port has had situation in which the code compiled, but the executables did not work. Try to catch this early. - pkg-message: use default mongo portnr instead of portnr used by unifi. --- databases/mongodb60/Makefile | 3 +++ databases/mongodb60/files/make.test.sh | 31 +++++++++++++++++++++++++++++++ databases/mongodb60/pkg-message | 2 +- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/databases/mongodb60/Makefile b/databases/mongodb60/Makefile index 654d6a78fb94..159813d1747f 100644 --- a/databases/mongodb60/Makefile +++ b/databases/mongodb60/Makefile @@ -145,4 +145,7 @@ do-install: .endfor ${RM} ${STAGEDIR}${PREFIX}/bin/resmoke.py +do-test: + ${SH} ${FILESDIR}/make.test.sh "${STAGEDIR}${PREFIX}/bin" + .include <bsd.port.post.mk> diff --git a/databases/mongodb60/files/make.test.sh b/databases/mongodb60/files/make.test.sh new file mode 100755 index 000000000000..3d74258a446a --- /dev/null +++ b/databases/mongodb60/files/make.test.sh @@ -0,0 +1,31 @@ +#! /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" diff --git a/databases/mongodb60/pkg-message b/databases/mongodb60/pkg-message index 047b46f2ccb1..90e9481de3d1 100644 --- a/databases/mongodb60/pkg-message +++ b/databases/mongodb60/pkg-message @@ -9,7 +9,7 @@ MongoDB 6.0 and up do not include the 'mongo' CLI shell anymore. You can use the MongoDB Shell (https://github.com/mongodb-js/mongosh). # pkg install npm $ npm install mongosh -$ npx mongosh mongodb://127.0.0.1:27117/ +$ npx mongosh mongodb://127.0.0.1:27017/ EOM }