summaryrefslogtreecommitdiff
path: root/databases/mongodb60
diff options
context:
space:
mode:
authorRonald Klop <ronald@FreeBSD.org>2024-07-03 21:27:07 +0200
committerRonald Klop <ronald@FreeBSD.org>2024-07-04 23:28:55 +0200
commit05637021054d6121cfdd14716298a0809dc15bfc (patch)
tree2d810a50542e127c8e27de0a1ec156f2eecf2973 /databases/mongodb60
parentemulators/wine-devel: Update to Wine 9.12 (diff)
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.
Diffstat (limited to 'databases/mongodb60')
-rw-r--r--databases/mongodb60/Makefile3
-rwxr-xr-xdatabases/mongodb60/files/make.test.sh31
-rw-r--r--databases/mongodb60/pkg-message2
3 files changed, 35 insertions, 1 deletions
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
}