Skip to content

Add CI test for configurable REST context path (/myidm)#152

Draft
Copilot wants to merge 3 commits intocopilot/make-rest-context-path-configurablefrom
copilot/add-ci-test-custom-context-path
Draft

Add CI test for configurable REST context path (/myidm)#152
Copilot wants to merge 3 commits intocopilot/make-rest-context-path-configurablefrom
copilot/add-ci-test-custom-context-path

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 8, 2026

Validates end-to-end that the openidm.context.path system property (introduced in PR #142) works correctly by running the full Playwright smoke suite against a second OpenIDM instance started with /myidm as the context path.

Changes

e2e/ui-smoke-test.spec.mjs

  • Added CONTEXT_PATH variable driven by OPENIDM_CONTEXT_PATH env (default: /openidm)
  • Replaced hardcoded /openidm in REST test URLs with ${CONTEXT_PATH}:
    const CONTEXT_PATH = process.env.OPENIDM_CONTEXT_PATH || "/openidm";
    // ...
    request.get(`${BASE_URL}${CONTEXT_PATH}/info/ping`, ...)
    request.get(`${BASE_URL}${CONTEXT_PATH}/config/ui/configuration`, ...)

.github/workflows/build.yml

Three new Linux-only steps inserted after the existing "UI Smoke Tests (Playwright)" step:

  • Stop OpenIDM (default context path) — graceful shutdown via openidm/shutdown.sh, waits for PID file removal
  • Start OpenIDM with custom context path /myidm — clears all log files, starts with OPENIDM_OPTS="-Dopenidm.context.path=/myidm", waits for ready state, asserts no ERROR/SEVERE in logs
  • UI Smoke Tests with /myidm context path (Playwright) — reruns the full Playwright suite with OPENIDM_CONTEXT_PATH=/myidm (reuses already-installed packages)
Original prompt

Context

PR #142 makes the REST context path configurable via openidm.context.path system property. We need to add a CI test that validates the custom context path /myidm actually works end-to-end.

Changes required

1. e2e/ui-smoke-test.spec.mjs — parameterize context path

Add a new CONTEXT_PATH variable derived from environment, and use it in REST API tests instead of hardcoded /openidm:

const CONTEXT_PATH = process.env.OPENIDM_CONTEXT_PATH || "/openidm";

Replace all hardcoded /openidm/ in REST test URLs with ${CONTEXT_PATH}/:

  • ${BASE_URL}/openidm/info/ping${BASE_URL}${CONTEXT_PATH}/info/ping
  • ${BASE_URL}/openidm/config/ui/configuration${BASE_URL}${CONTEXT_PATH}/config/ui/configuration

2. .github/workflows/build.yml — add custom context path test steps

After the existing "UI Smoke Tests (Playwright)" step (around line 60-68), add these new steps (all with if: runner.os == 'Linux'):

Step: "Stop OpenIDM (default context path)"

      - name: Stop OpenIDM (default context path)
        if: runner.os == 'Linux'
        run: |
          openidm/shutdown.sh
          timeout 1m bash -c 'while [ -f openidm/.openidm.pid ]; do sleep 2; done' || true

Step: "Start OpenIDM with custom context path /myidm"

      - name: Start OpenIDM with custom context path /myidm
        if: runner.os == 'Linux'
        run: |
          rm -rf openidm/logs/*
          OPENIDM_OPTS="-Dlogback.configurationFile=conf/logging-config.groovy -Dopenidm.context.path=/myidm" openidm/startup.sh &
          timeout 3m bash -c 'until grep -q "OpenIDM ready" openidm/logs/openidm0.log.0 ; do sleep 5; done' || cat openidm/logs/openidm0.log.0
          grep -q "OpenIDM ready" openidm/logs/openidm0.log.0
          ! grep "ERROR"  openidm/logs/openidm0.log.0
          ! grep "SEVERE" openidm/logs/openidm0.log.0

Step: "UI Smoke Tests with /myidm context path (Playwright)"

      - name: UI Smoke Tests with /myidm context path (Playwright)
        if: runner.os == 'Linux'
        run: |
          cd e2e
          npx playwright test --reporter=list
        env:
          OPENIDM_URL: http://localhost:8080
          OPENIDM_CONTEXT_PATH: /myidm

These 3 new steps must be inserted AFTER the existing "UI Smoke Tests (Playwright)" step and BEFORE the existing "Test on Windows" step.

Important notes

  • Do NOT modify any other existing steps
  • Do NOT change the existing "UI Smoke Tests (Playwright)" step — it stays as-is for default /openidm testing
  • The new steps use openidm/shutdown.sh for graceful shutdown (not kill)
  • Use rm -rf openidm/logs/* to clean ALL log files before restart
  • Wait for PID file removal after shutdown: timeout 1m bash -c 'while [ -f openidm/.openidm.pid ]; do sleep 2; done'

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: необходимо предложить тест в build.yml на смену /openidm в /myidm с проверкой "UI Smoke Tests (Playwright)"

Assistant:

Let me research the current build workflow and test structure to understand how to add this test.

Assistant: Now let me look at the PR branch to see what changes have been made to support the configurable context path:

Assistant: Теперь я вижу полную картину. Посмотрю, как именно запускается OpenIDM, чтобы понять, куда передать системное свойство openidm.context.path.

Assistant: Теперь у меня есть полная картина. Вот что нужно:

  1. В build.yml — добавить второй запуск OpenIDM с -Dopenidm.context.path=/myidm и второй прогон Playwright с OPENIDM_CONTEXT_PATH=/myidm
  2. В тесте e2e/ui-smoke-test.spec.mjs — REST API тесты используют хардкод /openidm/..., нужно параметризовать через OPENIDM_CONTEXT_PATH

Вот предложение по изменениям:


Предлагаемые изменения

1. e2e/ui-smoke-test.spec.mjs — параметризовать context path

Добавить переменную CONTEXT_PATH и использовать её в REST-тестах:

const BASE_URL = process.env.OPENIDM_URL || "http://localhost:8080";
const CONTEXT_PATH = process.env.OPENIDM_CONTEXT_PATH || "/openidm";
const ADMIN_USER = process.env.OPENIDM_ADMIN_USER || "openidm-admin";
const ADMIN_PASS = process.env.OPENIDM_ADMIN_PASS || "openidm-admin";

И заменить хардкод в REST-тестах:

    test("REST API ping is accessible", async ({ request }) => {
        const response = await request.get(`${BASE_URL}${CONTEXT_PATH}/info/ping`, {
            headers: {
                "X-OpenIDM-Username": ADMIN_USER,
                "X-OpenIDM-Password": ADMIN_PASS,
            },
        });
        expect(response.status()).toBe(200);
        const body = await response.json();
        expect(body.state).toBe("ACTIVE_READY");
    });

    test("REST API config endpoint is accessible", async ({ request }) => {
        const response = await request.get(`${BASE_URL}${CONTEXT_PATH}/...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

*This pull request was created from Copilot chat.*
>

Copilot AI changed the title [WIP] Add CI test for custom context path validation Add CI test for configurable REST context path (/myidm) Apr 8, 2026
Copilot AI requested a review from vharseko April 8, 2026 14:59
Updated OpenIDM startup process in the build workflow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants