diff --git a/.gitea/workflows/run-tests.yaml b/.gitea/workflows/run-tests.yaml index 68c459d..aaeca83 100644 --- a/.gitea/workflows/run-tests.yaml +++ b/.gitea/workflows/run-tests.yaml @@ -42,6 +42,40 @@ jobs: cache: 'npm' cache-dependency-path: Development/server/package-lock.json + - name: Install MongoDB runtime compatibility libraries + run: | + set -e + + if command -v ldconfig >/dev/null 2>&1 && ldconfig -p | grep -q 'libcrypto.so.1.1'; then + echo "OpenSSL 1.1 compatibility already present" + exit 0 + fi + + if ! command -v apt-get >/dev/null 2>&1; then + echo "apt-get is not available on this runner; cannot install libssl1.1 automatically" + exit 1 + fi + + if command -v sudo >/dev/null 2>&1; then + SUDO=sudo + else + SUDO= + fi + + . /etc/os-release + + if [ "${ID:-}" = "ubuntu" ]; then + echo "deb http://security.ubuntu.com/ubuntu focal-security main" | $SUDO tee /etc/apt/sources.list.d/focal-security.list >/dev/null + elif [ "${ID:-}" = "debian" ]; then + echo "deb http://deb.debian.org/debian bullseye main" | $SUDO tee /etc/apt/sources.list.d/bullseye.list >/dev/null + else + echo "Unsupported distro for automatic libssl1.1 install: ${ID:-unknown}" + exit 1 + fi + + $SUDO apt-get update + $SUDO apt-get install -y libssl1.1 + - name: Install dependencies env: NPM_CONFIG_CACHE: /tmp/npm-cache diff --git a/Development/server/tests/integration/jest.setup.js b/Development/server/tests/integration/jest.setup.js index 3dbfc3f..7b182f1 100644 --- a/Development/server/tests/integration/jest.setup.js +++ b/Development/server/tests/integration/jest.setup.js @@ -34,8 +34,11 @@ async function connectDB() { binary: { version: MONGOMS_VERSION }, }); } catch (error) { - error.message = `${error.message}\nFailed to start mongodb-memory-server with MongoDB ${MONGOMS_VERSION}. ` + - 'If this runner lacks AVX support, keep MONGOMS_VERSION pinned to a 4.4.x release.'; + const runtimeHint = String(error.message).includes('libcrypto.so.1.1') || String(error.message).includes('libssl.so.1.1') + ? 'This runner is missing OpenSSL 1.1 compatibility libraries required by MongoDB 4.4.' + : 'If this runner lacks AVX support, keep MONGOMS_VERSION pinned to a 4.4.x release.'; + + error.message = `${error.message}\nFailed to start mongodb-memory-server with MongoDB ${MONGOMS_VERSION}. ${runtimeHint}`; throw error; } const uri = mongod.getUri();