From 6b1526a5acd99231f13d4f582481635f9023bc3d Mon Sep 17 00:00:00 2001 From: Nil Gallego Date: Thu, 28 Nov 2024 13:05:49 +0100 Subject: [PATCH 1/2] initing Check the middleware is working --- .ibm/pipelines/value_files/values_showcase.yaml | 2 ++ e2e-tests/playwright.config.ts | 2 +- e2e-tests/playwright/e2e/plugins/middleware.spec.ts | 10 ++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 e2e-tests/playwright/e2e/plugins/middleware.spec.ts diff --git a/.ibm/pipelines/value_files/values_showcase.yaml b/.ibm/pipelines/value_files/values_showcase.yaml index cb5268bf28..447075dfe4 100644 --- a/.ibm/pipelines/value_files/values_showcase.yaml +++ b/.ibm/pipelines/value_files/values_showcase.yaml @@ -142,6 +142,8 @@ upstream: value: 'true' - name: NODE_OPTIONS value: '--no-node-snapshot' + - name: ENABLE_CORE_ROOTHTTPROUTER_OVERRIDE + value: 'true' extraAppConfig: - configMapRef: app-config-rhdh filename: app-config-rhdh.yaml diff --git a/e2e-tests/playwright.config.ts b/e2e-tests/playwright.config.ts index 971c2dc762..2f259a77c1 100644 --- a/e2e-tests/playwright.config.ts +++ b/e2e-tests/playwright.config.ts @@ -20,7 +20,7 @@ export default defineConfig({ timeout: 22000, testDir: "./playwright", /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, + forbidOnly: false, /* Retry on CI only */ retries: process.env.CI ? 2 : 0, /* Opt out of parallel tests on CI. */ diff --git a/e2e-tests/playwright/e2e/plugins/middleware.spec.ts b/e2e-tests/playwright/e2e/plugins/middleware.spec.ts new file mode 100644 index 0000000000..1534c4a70b --- /dev/null +++ b/e2e-tests/playwright/e2e/plugins/middleware.spec.ts @@ -0,0 +1,10 @@ +// https://github.com/gashcrumb/dynamic-plugins-root-http-middleware/tree/main/plugins/middleware-header-example + +import test, { expect, request } from "@playwright/test"; + +test.only("Check the middleware is working", async () => { + const endpoint = "api/simple-chat"; + const context = await request.newContext({ baseURL: endpoint }); + const r = await context.get(""); + expect(r.headers["X-PROXY-TEST-HEADER"]); +}); From 9b4647da36eeb5615af4933ee56399212052b621 Mon Sep 17 00:00:00 2001 From: Nil Gallego Date: Thu, 28 Nov 2024 17:07:41 +0100 Subject: [PATCH 2/2] fix url on middleware --- e2e-tests/playwright/e2e/plugins/middleware.spec.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/e2e-tests/playwright/e2e/plugins/middleware.spec.ts b/e2e-tests/playwright/e2e/plugins/middleware.spec.ts index 1534c4a70b..fb61c69c3b 100644 --- a/e2e-tests/playwright/e2e/plugins/middleware.spec.ts +++ b/e2e-tests/playwright/e2e/plugins/middleware.spec.ts @@ -1,10 +1,14 @@ // https://github.com/gashcrumb/dynamic-plugins-root-http-middleware/tree/main/plugins/middleware-header-example import test, { expect, request } from "@playwright/test"; +import playwrightConfig from "../../../playwright.config"; test.only("Check the middleware is working", async () => { - const endpoint = "api/simple-chat"; - const context = await request.newContext({ baseURL: endpoint }); + const endpoint = playwrightConfig.use.baseURL + "/api/simple-chat"; + console.log(`middleware endpoint full url: ${endpoint}`); + const context = await request.newContext({ + baseURL: endpoint, + }); const r = await context.get(""); expect(r.headers["X-PROXY-TEST-HEADER"]); });