From 0138b5924ff14ef709398bf878dbb9bf2a0b7c33 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Wed, 23 Sep 2026 13:05:17 +0000
Subject: [PATCH] [#1030] Keep the setup log out of the way of start-ds, and say when it is gone (#1032)

---
 .github/workflows/build.yml |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 604e3ff..1e49ed6 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -241,8 +241,17 @@
           --baseDN dc=example,dc=com --sampleData 5000 --cli --acceptLicense --no-prompt \
           --propertiesFilePath /tmp/opendj-setup.properties.bcfks --doNotStart
         
+        # start-ds sweeps the native libraries the BC FIPS loader leaves in tmp/ and nothing
+        # else: the rest of tmp/ belongs to tools that may still be running, setup among them
+        # (issue #1030). Without these two probes a sweep back to "tmp/*" passes every cell.
+        mkdir -p opendj-server-legacy/target/package/opendj/tmp/bc-fips-jni_123
+        touch opendj-server-legacy/target/package/opendj/tmp/keep.me
+        
         opendj-server-legacy/target/package/opendj/bin/start-ds
         
+        test ! -e opendj-server-legacy/target/package/opendj/tmp/bc-fips-jni_123
+        test -e opendj-server-legacy/target/package/opendj/tmp/keep.me
+        
         opendj-server-legacy/target/package/opendj/bin/status --hostname localhost --bindDN "cn=Directory Manager" --bindPassword password --trustAll
         opendj-server-legacy/target/package/opendj/bin/ldapsearch --hostname localhost --port 1636 --bindDN "cn=Directory Manager" --bindPassword password --useSsl --trustAll --baseDN "dc=example,dc=com" --searchScope base "(objectClass=*)" 1.1
         opendj-server-legacy/target/package/opendj/bin/ldapsearch --hostname localhost --port 1636 --bindDN "cn=Directory Manager" --bindPassword password --useSsl --trustAll --baseDN "ou=people,dc=example,dc=com" --searchScope sub "(uid=user.*)" dn | grep ^dn: | wc -l | grep -q 5000
@@ -397,7 +406,14 @@
         opendj-server-legacy\target\package\opendj\upgrade.bat
         opendj-server-legacy\target\package\opendj\bat\import-ldif.bat --offline --ldifFile test.ldif --backendID=example2
         opendj-server-legacy\target\package\opendj\bat\rebuild-index.bat --offline --bindDN "cn=Directory Manager" --bindPassword password  --baseDN "dc=example2,dc=com" --rebuildAll
+        # The same probe as the Unix FIPS step, for start-ds.bat: the sweep takes the BC FIPS
+        # directories and leaves everything else in tmp\ alone (issue #1030). The runner's
+        # install path has no space in it, so this does not settle the quoting of the for /D line.
+        New-Item -ItemType Directory -Force opendj-server-legacy\target\package\opendj\tmp\bc-fips-jni_123 | Out-Null
+        New-Item -ItemType File -Force opendj-server-legacy\target\package\opendj\tmp\keep.me | Out-Null
         opendj-server-legacy\target\package\opendj\bat\start-ds.bat
+        if (Test-Path opendj-server-legacy\target\package\opendj\tmp\bc-fips-jni_123) { throw "start-ds.bat left a bc-fips-jni_* directory behind" }
+        if (-not (Test-Path opendj-server-legacy\target\package\opendj\tmp\keep.me)) { throw "start-ds.bat removed a tmp file that is not its own" }
         opendj-server-legacy\target\package\opendj\bat\rebuild-index.bat --bindDN "cn=Directory Manager" --bindPassword password --baseDN "dc=example2,dc=com" --rebuildAll --trustAll
         opendj-server-legacy\target\package\opendj\bat\ldapsearch.bat --hostname localhost --port 1636 --bindDN "cn=Directory Manager" --bindPassword password --useSsl --trustAll --baseDN "dc=example2,dc=com" --searchScope sub "(uid=user.*)" dn | find /c '"dn:"' | findstr "10000"
         opendj-server-legacy\target\package\opendj\bat\stop-ds.bat
@@ -412,6 +428,19 @@
         if ($LASTEXITCODE -ne 0) { throw "net stop 'OpenDJ Server' failed with exit code $LASTEXITCODE" }
         opendj-server-legacy\target\package\opendj\bat\windows-service.bat --disableService
 
+    # A test step that fails leaves its instances behind. The server-side story of a
+    # failed start lives in logs/server.out and logs/errors, and nothing else prints it
+    # (setup only has the client-side view, see issue #1030).
+    - name: Dump the server logs of a failed test
+      if: failure()
+      shell: bash
+      run: |
+        for f in opendj-server-legacy/target/package/opendj*/logs/server.out opendj-server-legacy/target/package/opendj*/logs/errors; do
+          [ -f "$f" ] || continue
+          echo "===== $f"
+          cat "$f"
+        done
+
     - name: Upload artifacts OpenDJ Server
       uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
       with:

--
Gitblit v1.10.0