From b1a16ac35c0e83771e5d699f3e7c4eae6696dd62 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Sun, 27 Sep 2026 08:54:22 +0000
Subject: [PATCH] [#1085] Stop the server cleanly on SIGTERM in a container that bootstrapped its instance (#1098)
---
.github/benchmark/compare-opendj.sh | 26 ++++++++++++++++++++++----
1 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/.github/benchmark/compare-opendj.sh b/.github/benchmark/compare-opendj.sh
index 65f03c4..e8321f1 100644
--- a/.github/benchmark/compare-opendj.sh
+++ b/.github/benchmark/compare-opendj.sh
@@ -50,10 +50,19 @@
tar -xzf /tmp/jmeter.tgz -C "$HOME/jmeter"
fi
-wait_dj() { # poll OpenDJ readiness on localhost:1389
- for _ in $(seq 1 90); do
- ldapsearch -x -H ldap://localhost:1389 -D "cn=Directory Manager" -w password \
- -b "$BASEDN" -s base dn >/dev/null 2>&1 && return 0
+# Poll OpenDJ readiness on localhost:1389. An image with a HEALTHCHECK has to report healthy
+# first: on a first start the server the bootstrap started answers, then is stopped and
+# started again, and a request sent in between fails. An older image's health check
+# may pass before the bootstrap is done, so the base entry is searched for in both cases.
+# The wait lasts as long as the start period of the health check, 5 minutes.
+wait_dj() {
+ local health
+ for _ in $(seq 1 150); do
+ health="$(docker inspect -f '{{if .State.Health}}{{.State.Health.Status}}{{end}}' opendj-bench 2>/dev/null || true)"
+ if [ -z "$health" ] || [ "$health" = healthy ]; then
+ ldapsearch -x -H ldap://localhost:1389 -D "cn=Directory Manager" -w password \
+ -b "$BASEDN" -s base dn >/dev/null 2>&1 && return 0
+ fi
sleep 2
done
return 1
@@ -72,6 +81,15 @@
wait_dj || echo "WARN: $image not ready in time" >&2
ldapadd -x -H ldap://localhost:1389 -D "cn=Directory Manager" -w password \
-f "$HERE/people.ldif" >/dev/null 2>&1 || true
+ # without its users JMeter binds as users that do not exist and the numbers mean nothing,
+ # so a seed that missed stops the comparison (A_VER="$(bench_one ...)" under set -e)
+ if ! ldapsearch -x -H ldap://localhost:1389 -D "cn=Directory Manager" -w password \
+ -b "ou=People,$BASEDN" -s base dn >/dev/null 2>&1; then
+ echo "ERROR: $image: ou=People was not seeded" >&2
+ docker logs opendj-bench > "$out.docker.log" 2>&1 || true
+ docker rm -f opendj-bench >/dev/null 2>&1 || true
+ return 1
+ fi
ver="$( { ldapsearch -x -LLL -H ldap://localhost:1389 -D 'cn=Directory Manager' -w password \
-b '' -s base fullVendorVersion 2>/dev/null || true; } | sed -n 's/^fullVendorVersion: //p')"
rm -rf "$out" "$out.jtl"
--
Gitblit v1.10.0