From e567e91c0aa52850fd0bbccd97b79920c1fa13e8 Mon Sep 17 00:00:00 2001 From: Krystof Stekovic Date: Fri, 6 Mar 2026 09:59:39 +0100 Subject: [PATCH 1/5] Update npm and Maven dependencies to latest versions npm: cypress 15.11.0, eslint 10.0.2, @eslint/js, cpy-cli 7.0.0 Maven: wildfly-bom 39.0.1.Final, maven.compiler.release 17, JDBC drivers (MariaDB 3.5.7, PostgreSQL 42.7.10, MySQL 9.6.0, MSSQL 13.2.1, DB2 12.1.3.0) Co-Authored-By: Claude Opus 4.6 (1M context) --- package.json | 9 +++++---- packages/resources/pom.xml | 13 +++++++------ .../test-configuration-update-channel.cy.ts | 12 ++++++------ 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 1011bde63..49d145a8e 100644 --- a/package.json +++ b/package.json @@ -31,16 +31,17 @@ "license": "ISC", "devDependencies": { "@cypress/xvfb": "1.2.4", + "@eslint/js": "^10.0.1", "@types/command-line-args": "5.2.3", - "@types/mochawesome": "6.2.4", + "@types/mochawesome": "6.2.5", "@types/portscanner": "2.1.4", "@typescript-eslint/eslint-plugin": "^8.46.1", "@typescript-eslint/parser": "^8.46.1", "command-line-args": "^6.0.1", - "cpy-cli": "^6.0.0", + "cpy-cli": "^7.0.0", "cypress-multi-reporters": "^2.0.5", "del-cli": "^7.0.0", - "eslint": "^9.37.0", + "eslint": "^10.0.2", "eslint-config-prettier": "^10.1.8", "mocha-junit-reporter": "2.2.1", "mochawesome": "^7.1.4", @@ -53,7 +54,7 @@ }, "dependencies": { "axios": "^1.12.2", - "cypress": "15.4.0", + "cypress": "15.11.0", "portscanner": "^2.2.0", "testcontainers": "^11.7.1" } diff --git a/packages/resources/pom.xml b/packages/resources/pom.xml index 33a2573af..b2bcc5737 100644 --- a/packages/resources/pom.xml +++ b/packages/resources/pom.xml @@ -9,6 +9,7 @@ UTF-8 + 17 ${project.build.directory}/dependency ${project.build.directory}/modules @@ -18,34 +19,34 @@ org.wildfly.bom wildfly-ee-with-tools - 35.0.0.Final + 39.0.1.Final import pom org.mariadb.jdbc mariadb-java-client - 3.1.0 + 3.5.7 com.microsoft.sqlserver mssql-jdbc - 11.2.1.jre11 + 13.2.1.jre11 com.mysql mysql-connector-j - 8.0.31 + 9.6.0 org.postgresql postgresql - 42.5.1 + 42.7.10 com.ibm.db2 jcc - 11.5.8.0 + 12.1.3.0 diff --git a/packages/testsuite/cypress/e2e/update-manager/test-configuration-update-channel.cy.ts b/packages/testsuite/cypress/e2e/update-manager/test-configuration-update-channel.cy.ts index 6d3626d3b..47ce97588 100644 --- a/packages/testsuite/cypress/e2e/update-manager/test-configuration-update-channel.cy.ts +++ b/packages/testsuite/cypress/e2e/update-manager/test-configuration-update-channel.cy.ts @@ -115,7 +115,7 @@ describe("TESTS: Update Manager => Channels", () => { const isJbossEapChannelPrinted = ($items: JQuery): boolean => { for (let i = 0; i < $items.length; i++) { const text = $items[i].innerText.trim(); - if (text.startsWith('JBoss EAP')) { + if (text.startsWith("JBoss EAP")) { return true; } } @@ -132,11 +132,11 @@ describe("TESTS: Update Manager => Channels", () => { cy.navigateToUpdateManagerPage(managementEndpoint, ["update-manager", "updates"]); // click on last printed revision (first revision in history) - cy.get('#update-manager-update ul li').last().click(); + cy.get("#update-manager-update ul li").last().click(); // try to find EAP channel - cy.contains('li.list-group-item', 'Channel Versions') - .find('.value ul li') + cy.contains("li.list-group-item", "Channel Versions") + .find(".value ul li") .should(($items) => { expect(isJbossEapChannelPrinted($items), '"JBoss EAP" channel not printed').to.equal(true); }); @@ -149,8 +149,8 @@ describe("TESTS: Update Manager => Channels", () => { */ it("Check channel version in runtimes", () => { cy.navigateTo(managementEndpoint, "runtime;path=standalone-server-column~standalone-host-server"); - cy.get('#standalone-server-column ul li').first().click(); - cy.get('#channel-versions li .value').should(($items) => { + cy.get("#standalone-server-column ul li").first().click(); + cy.get("#channel-versions li .value").should(($items) => { expect(isJbossEapChannelPrinted($items), '"JBoss EAP" channel not printed').to.equal(true); }); }); From 3b207b80365b1194787c1993851068ed16298590 Mon Sep 17 00:00:00 2001 From: Krystof Stekovic Date: Fri, 6 Mar 2026 10:29:49 +0100 Subject: [PATCH 2/5] Migrate from Cypress.env() to cy.env() API Replace deprecated Cypress.env() calls with cy.env() which is the secure alternative in Cypress 15. Set allowCypressEnv: false to disable the deprecated API. Co-Authored-By: Claude Opus 4.5 --- cypress.config.ts | 1 + .../e2e/elytron-oidc-client/test-oidc-security.cy.ts | 4 +++- .../update-manager/test-update-custom-patch.cy.ts | 12 ++++++++---- .../update-manager/test-update-offline-archive.cy.ts | 9 +++++---- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/cypress.config.ts b/cypress.config.ts index 40730b855..d960bf8f1 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -61,6 +61,7 @@ export const MANAGEMENT_INTERFACE_ADDRESS = ["core-service", "management", "mana export const LOCALHOST_IP = "127.0.0.1"; export default defineConfig({ + allowCypressEnv: false, defaultCommandTimeout: 16000, reporter: require.resolve("cypress-multi-reporters/index.js"), reporterOptions: { diff --git a/packages/testsuite/cypress/e2e/elytron-oidc-client/test-oidc-security.cy.ts b/packages/testsuite/cypress/e2e/elytron-oidc-client/test-oidc-security.cy.ts index ce56f83b1..00c7a1063 100644 --- a/packages/testsuite/cypress/e2e/elytron-oidc-client/test-oidc-security.cy.ts +++ b/packages/testsuite/cypress/e2e/elytron-oidc-client/test-oidc-security.cy.ts @@ -27,7 +27,9 @@ describe("TESTS: Access secured by Elytron OIDC client", () => { it("Logs in successfully and logs out", () => { logIn("userwithoutrole", "password"); - cy.url().should(`include`, `localhost:${Cypress.env("HAL_CONTAINER_PORT") as string}`); + cy.env(["HAL_CONTAINER_PORT"]).then((env) => { + cy.url().should(`include`, `localhost:${env["HAL_CONTAINER_PORT"] as string}`); + }); cy.verifyUserName("userwithoutrole"); cy.logoutFromWebConsole(); verifyNotLoggedIn(keycloak); diff --git a/packages/testsuite/cypress/e2e/update-manager/test-update-custom-patch.cy.ts b/packages/testsuite/cypress/e2e/update-manager/test-update-custom-patch.cy.ts index c7daaaa10..e0c7046d2 100644 --- a/packages/testsuite/cypress/e2e/update-manager/test-update-custom-patch.cy.ts +++ b/packages/testsuite/cypress/e2e/update-manager/test-update-custom-patch.cy.ts @@ -3,7 +3,6 @@ describe("TESTS: Update Manager => Updates => Custom patches", () => { const timeoutTime = 120000; const address = ["update-manager", "updates"]; - const zipFile = Cypress.env("PATCH_ZIP") as string; const artifactToBeUpdated = "software.amazon.awssdk:aws-core"; before(function () { @@ -21,9 +20,14 @@ describe("TESTS: Update Manager => Updates => Custom patches", () => { cy.navigateToUpdateManagerPage(managementEndpoint, address); cy.get("#update-manager-update-add-actions").click(); cy.get("#update-manager-update-patch").click(); - cy.get("input#update-manager-update-patch-form-custom-patch-file-editing").selectFile(zipFile, { - action: "drag-drop", - force: true, + cy.env(["PATCH_ZIP"]).then((env) => { + cy.get("input#update-manager-update-patch-form-custom-patch-file-editing").selectFile( + env["PATCH_ZIP"] as string, + { + action: "drag-drop", + force: true, + }, + ); }); cy.text("update-manager-update-patch-form", "manifest", "org.jboss.qe.eap:one-off-1"); cy.confirmNextInWizard(); diff --git a/packages/testsuite/cypress/e2e/update-manager/test-update-offline-archive.cy.ts b/packages/testsuite/cypress/e2e/update-manager/test-update-offline-archive.cy.ts index efd51ab84..c62e7af9c 100644 --- a/packages/testsuite/cypress/e2e/update-manager/test-update-offline-archive.cy.ts +++ b/packages/testsuite/cypress/e2e/update-manager/test-update-offline-archive.cy.ts @@ -3,7 +3,6 @@ describe("TESTS: Update Manager => Updates => Offline using archive", () => { const timeoutTime = 120000; const address = ["update-manager", "updates"]; - const zipFile = Cypress.env("UPDATE_ZIP") as string; const artifactToBeUpdated = "software.amazon.awssdk:aws-core"; before(function () { @@ -21,9 +20,11 @@ describe("TESTS: Update Manager => Updates => Offline using archive", () => { cy.navigateToUpdateManagerPage(managementEndpoint, address); cy.get("#update-manager-update-add-actions").click(); cy.get("#update-manager-update-offline").click(); - cy.get("input#upload-file-input").selectFile(zipFile, { - action: "drag-drop", - force: true, + cy.env(["UPDATE_ZIP"]).then((env) => { + cy.get("input#upload-file-input").selectFile(env["UPDATE_ZIP"] as string, { + action: "drag-drop", + force: true, + }); }); cy.confirmNextInWizard(); cy.get("#update-manager-list-updates", { timeout: timeoutTime }).should("be.visible").contains(artifactToBeUpdated); From b6644bc86e5efae519b67e59b8ef9b4359bfa2cc Mon Sep 17 00:00:00 2001 From: Krystof Stekovic Date: Fri, 6 Mar 2026 14:13:02 +0100 Subject: [PATCH 3/5] Update CI workflows with BERG_VERBOSE toggle and new test modules Add BERG_VERBOSE boolean input to workflow_dispatch workflows. Tie DEBUG=testcontainers* to the BERG_VERBOSE toggle so verbose testcontainers output is only shown when explicitly enabled. Add micrometer and opentelemetry to the test matrices. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/manual-test-matrix-workflow.yaml | 10 ++++++++++ .github/workflows/manual-test-worfklow.yaml | 5 +++++ .github/workflows/on-pull-request-workflow.yaml | 2 ++ .../workflows/reusable-build-project-workflow.yaml | 13 +++++++++++++ .../workflows/scheduled-run-all-tests-workflow.yaml | 2 ++ 5 files changed, 32 insertions(+) diff --git a/.github/workflows/manual-test-matrix-workflow.yaml b/.github/workflows/manual-test-matrix-workflow.yaml index 94c18905f..02cdf561a 100644 --- a/.github/workflows/manual-test-matrix-workflow.yaml +++ b/.github/workflows/manual-test-matrix-workflow.yaml @@ -1,5 +1,10 @@ on: workflow_dispatch: + inputs: + verbose: + type: boolean + description: "Enable verbose Berg logging" + default: false name: "Manual matrix test execution" concurrency: group: ${{ github.ref }} @@ -30,6 +35,8 @@ jobs: "mail", "microprofile", "metrics", + "micrometer", + "opentelemetry", "runtime", "security-manager", "system-property", @@ -71,6 +78,9 @@ jobs: - name: "Run compile" run: "npm run compile" - name: "Run test(s)" + env: + BERG_VERBOSE: ${{ inputs.verbose }} + DEBUG: ${{ inputs.verbose && 'testcontainers*' || '' }} run: "npm run test:compiled -- --browser=firefox --specs=packages/testsuite/cypress/e2e/${{ matrix.specs }}" - name: "Archive test report(s) and video(s)" if: ${{ !cancelled() }} diff --git a/.github/workflows/manual-test-worfklow.yaml b/.github/workflows/manual-test-worfklow.yaml index 9efb2f2a9..3db516c95 100644 --- a/.github/workflows/manual-test-worfklow.yaml +++ b/.github/workflows/manual-test-worfklow.yaml @@ -4,9 +4,14 @@ on: spec: type: string description: "Spec to run" + verbose: + type: boolean + description: "Enable verbose Berg logging" + default: false name: "Manual job execution" jobs: call-reusable-workflow: uses: "./.github/workflows/reusable-build-project-workflow.yaml" with: spec: ${{ inputs.spec }} + verbose: ${{ inputs.verbose }} diff --git a/.github/workflows/on-pull-request-workflow.yaml b/.github/workflows/on-pull-request-workflow.yaml index e7c2d6f5d..fb1febd09 100644 --- a/.github/workflows/on-pull-request-workflow.yaml +++ b/.github/workflows/on-pull-request-workflow.yaml @@ -35,6 +35,8 @@ jobs: packages/testsuite/cypress/e2e/**/*.cy.ts - name: "Run tests of modified files" if: steps.changed-files-specific.outputs.any_changed == 'true' + env: + TESTCONTAINERS_RYUK_DISABLED: true run: | SPECS="${{ steps.changed-files-specific.outputs.all_changed_files }}" KEYCLOAK_IMAGE=quay.io/keycloak/keycloak:24.0 npm run test -- --browser=chrome --specs=$SPECS diff --git a/.github/workflows/reusable-build-project-workflow.yaml b/.github/workflows/reusable-build-project-workflow.yaml index e12373873..6ade1c2ef 100644 --- a/.github/workflows/reusable-build-project-workflow.yaml +++ b/.github/workflows/reusable-build-project-workflow.yaml @@ -6,6 +6,11 @@ on: type: string required: false description: "Comma delimited test spec file(s) to run." + verbose: + type: boolean + required: false + default: false + description: "Enable verbose Berg logging" jobs: build_project_job: name: "Build Project" @@ -36,7 +41,15 @@ jobs: run: "npm run compile" - name: "Run all tests" if: "${{ github.event.inputs.spec == '' }}" + env: + TESTCONTAINERS_RYUK_DISABLED: true + BERG_VERBOSE: ${{ inputs.verbose }} + DEBUG: ${{ inputs.verbose && 'testcontainers*' || '' }} run: "npm run test:compiled" - name: "Run specific test" if: "${{ github.event.inputs.spec != '' }}" + env: + TESTCONTAINERS_RYUK_DISABLED: true + BERG_VERBOSE: ${{ inputs.verbose }} + DEBUG: ${{ inputs.verbose && 'testcontainers*' || '' }} run: "npm run test:compiled -- --specs=${{ inputs.spec }}" diff --git a/.github/workflows/scheduled-run-all-tests-workflow.yaml b/.github/workflows/scheduled-run-all-tests-workflow.yaml index e920bdceb..13c1b9e04 100644 --- a/.github/workflows/scheduled-run-all-tests-workflow.yaml +++ b/.github/workflows/scheduled-run-all-tests-workflow.yaml @@ -30,6 +30,8 @@ jobs: "jsf", "mail", "metrics", + "micrometer", + "opentelemetry", "runtime", "security-manager", "system-property", From 361f75c44387dab20a8454d12baeabae726a38f0 Mon Sep 17 00:00:00 2001 From: Krystof Stekovic Date: Tue, 17 Mar 2026 10:59:17 +0100 Subject: [PATCH 4/5] Add structured logging and auto-detect Podman runtime Add a structured logger with BERG_VERBOSE support to replace all console.log calls. Debug messages are hidden by default, shown only when BERG_VERBOSE=true. Auto-detect Podman socket and configure DOCKER_HOST and TESTCONTAINERS_RYUK_DISABLED so users no longer need to set them manually. Compatible with Docker (no-op when Docker is detected). Handle container stop errors gracefully to avoid failing tests on CI cleanup timeouts. Co-Authored-By: Claude Opus 4.6 (1M context) --- README.md | 5 +-- config/containers/database.ts | 4 +- config/containers/wildfly.ts | 8 ++-- config/helpers/error-handler.ts | 4 +- config/helpers/index.ts | 1 + config/helpers/logger.ts | 9 +++++ config/tasks/cli-tasks.ts | 3 +- config/tasks/keycloak-tasks.ts | 4 +- config/tasks/wildfly-tasks.ts | 8 ++-- cypress.config.ts | 11 ++++-- packages/berg/src/berg.ts | 1 + packages/berg/src/container-runtime.ts | 54 ++++++++++++++++++++++++++ 12 files changed, 92 insertions(+), 20 deletions(-) create mode 100644 config/helpers/logger.ts create mode 100644 packages/berg/src/container-runtime.ts diff --git a/README.md b/README.md index 227585d6e..d82723396 100644 --- a/README.md +++ b/README.md @@ -28,11 +28,9 @@ Following tools are required to run the test suite - recommended version is 22. - [Node Version Manager (nvm)](https://github.com/nvm-sh/nvm) is recommended optional tool to install & manage multiple Node environments - [npx](https://github.com/npm/npx) CLI tool used to exeute binaries from project's `node_modules` directly (instead of providing absolute/relative path to the commannds). It is used in multiple build steps. -- [Podman](https://podman.io) | [Docker](https://www.docker.com) as a container runtime used by TestContainers. Note that when using Podman as container runtime you may need to export following environment variables and start podman socket: +- [Podman](https://podman.io) | [Docker](https://www.docker.com) as a container runtime used by TestContainers. Podman is auto-detected: `DOCKER_HOST`, `TESTCONTAINERS_RYUK_DISABLED`, and `podman.socket` are configured automatically. To override, set the environment variables manually before running the test suite: - `export TESTCONTAINERS_RYUK_DISABLED=true` - `export DOCKER_HOST=unix:///run/user/$UID/podman/podman.sock` - - the path can be found by command `podman info --debug` and look for `path` in `remoteSocket` section. - - `systemctl --user start podman.socket` - Java. Yes we'll need Java to write deployments/applications that will be deployed onto the running WildFly container. - [Maven](https://maven.apache.org). Yes, we'll need Maven to ease up the development of the deployed applications & downloading needed JDBC drivers for datasource & drivers UI tests. Maven is mostly used embedded by [node-maven](https://github.com/headcr4sh/node-maven) JS wrapper to execute Maven & Java related tasks into the build automation. @@ -96,6 +94,7 @@ Following is a table of supported environment properties that can be used when r | `MYSQL_IMAGE` | `docker.io/library/mysql:latest` | MySQL image to be used for datasource tests | | `MARIADB_IMAGE` | `docker.io/library/mariadb:latest` | MariaDB image to be used for datasource tests | | `MSSQL_IMAGE` | `mcr.microsoft.com/mssql/server:2022-latest` | Microsoft SQL Server image to be used for datasource tests | +| `BERG_VERBOSE` | `false` | Enable verbose Berg logging (debug messages for container setup, CLI commands, etc.) | ## Custom method documentation diff --git a/config/containers/database.ts b/config/containers/database.ts index c89e4af55..c9c185eb5 100644 --- a/config/containers/database.ts +++ b/config/containers/database.ts @@ -1,6 +1,6 @@ import { PullPolicy, GenericContainer, StartedTestContainer, Wait } from "testcontainers"; import { DatabaseConfig } from "../interfaces"; -import { handleContainerError } from "../helpers"; +import { handleContainerError, logger } from "../helpers"; export function startDatabaseContainer( config: DatabaseConfig, @@ -18,7 +18,7 @@ export function startDatabaseContainer( return containerBuilder .start() .then((container) => { - console.log(config.successMessage); + logger.debug(config.successMessage); startedContainersMap.set(config.containerMapKey, container); return container; }) diff --git a/config/containers/wildfly.ts b/config/containers/wildfly.ts index c98fa9cac..299d7749d 100644 --- a/config/containers/wildfly.ts +++ b/config/containers/wildfly.ts @@ -11,7 +11,7 @@ import { MANAGEMENT_INTERFACE_ADDRESS, } from "../../cypress.config"; import { WildflyManagementResponse } from "../interfaces"; -import { buildLocalhostUrl } from "../helpers"; +import { buildLocalhostUrl, logger } from "../helpers"; export function pollWildflyState(managementApi: string, container: StartedTestContainer): Promise { const startTime = new Date().getTime(); @@ -34,7 +34,7 @@ export function pollWildflyState(managementApi: string, container: StartedTestCo } }) .catch(() => { - console.log("WildFly server is not ready yet"); + logger.debug("WildFly server is not ready yet"); }); }, WILDFLY_POLL_INTERVAL_MS); }); @@ -61,7 +61,7 @@ export function configureWildflyNetworkMode( networkName?: string, ): Promise<{ portOffset: number }> { if (useHostMode) { - console.log("host mode"); + logger.debug("host mode"); return findAPortNotInUse(WILDFLY_PORT_RANGE.min, WILDFLY_PORT_RANGE.max).then((freePort) => { const portOffset = freePort - WILDFLY_PORT_RANGE.min; wildfly @@ -75,7 +75,7 @@ export function configureWildflyNetworkMode( return { portOffset }; }); } else { - console.log(`default network mode, network name: ${networkName}`); + logger.debug(`default network mode, network name: ${networkName}`); wildfly .withNetworkMode(networkName!) .withNetworkAliases("wildfly") diff --git a/config/helpers/error-handler.ts b/config/helpers/error-handler.ts index 41ab2fec0..4563c5296 100644 --- a/config/helpers/error-handler.ts +++ b/config/helpers/error-handler.ts @@ -1,4 +1,6 @@ +import { logger } from "./logger"; + export function handleContainerError(err: unknown): Error { - console.log(err); + logger.error(err); return err instanceof Error ? err : new Error(JSON.stringify(err)); } diff --git a/config/helpers/index.ts b/config/helpers/index.ts index 973ceb0ee..f04bcad09 100644 --- a/config/helpers/index.ts +++ b/config/helpers/index.ts @@ -1,3 +1,4 @@ export * from "./error-handler"; export * from "./url-builder"; export * from "./container-helpers"; +export * from "./logger"; diff --git a/config/helpers/logger.ts b/config/helpers/logger.ts new file mode 100644 index 000000000..151b2d34f --- /dev/null +++ b/config/helpers/logger.ts @@ -0,0 +1,9 @@ +const isVerbose = process.env.BERG_VERBOSE === "true"; + +export const logger = { + error: (...args: unknown[]) => console.error("[berg]", ...args), + info: (...args: unknown[]) => console.log("[berg]", ...args), + debug: (...args: unknown[]) => { + if (isVerbose) console.log("[berg:debug]", ...args); + }, +}; diff --git a/config/tasks/cli-tasks.ts b/config/tasks/cli-tasks.ts index c197bf7df..f81855233 100644 --- a/config/tasks/cli-tasks.ts +++ b/config/tasks/cli-tasks.ts @@ -1,5 +1,6 @@ import axios from "axios"; import { ExecuteCliParams, AxiosErrorResponse } from "../interfaces"; +import { logger } from "../helpers"; export function createExecuteCli() { return ({ managementApi, operation, address, ...args }: ExecuteCliParams) => { @@ -11,7 +12,7 @@ export function createExecuteCli() { }) .then((response) => response.data as unknown) .catch((err: AxiosErrorResponse) => { - console.log(err); + logger.error(err); throw new Error(err.response.data); }); }; diff --git a/config/tasks/keycloak-tasks.ts b/config/tasks/keycloak-tasks.ts index acd23f573..fa4347c94 100644 --- a/config/tasks/keycloak-tasks.ts +++ b/config/tasks/keycloak-tasks.ts @@ -9,7 +9,7 @@ import { FIXTURES_PATH, } from "../../cypress.config"; import { StartKeycloakContainerParams } from "../interfaces"; -import { buildLocalhostUrl, buildKeycloakStartCommand, handleContainerError } from "../helpers"; +import { buildLocalhostUrl, buildKeycloakStartCommand, handleContainerError, logger } from "../helpers"; export function createKeycloakContainer(startedContainers: Map) { return ({ name }: StartKeycloakContainerParams) => { @@ -35,7 +35,7 @@ export function createKeycloakContainer(startedContainers: Map { startedContainers.set(name, keycloakContainer); const keycloakServer = buildLocalhostUrl(freePort); - console.log(`Keycloak is ready: ${keycloakServer}`); + logger.info(`Keycloak is ready: ${keycloakServer}`); return keycloakServer; }) .catch((err: unknown) => { diff --git a/config/tasks/wildfly-tasks.ts b/config/tasks/wildfly-tasks.ts index e8a20fc50..db3335e8e 100644 --- a/config/tasks/wildfly-tasks.ts +++ b/config/tasks/wildfly-tasks.ts @@ -9,7 +9,7 @@ import { JBOSS_CLI_PATH, } from "../../cypress.config"; import { StartWildflyContainerParams, ExecuteInContainerParams, AxiosErrorResponse } from "../interfaces"; -import { getHostnameMapping, handleContainerError, calculateManagementPort } from "../helpers"; +import { getHostnameMapping, handleContainerError, calculateManagementPort, logger } from "../helpers"; import { configureWildflyNetworkMode, configureWildflyPostStart } from "../containers"; export function createWildflyContainer( @@ -53,7 +53,7 @@ export function createWildflyContainer( ); }) .then((wildflyServer) => { - console.log(`WildFly server is ready: ${wildflyServer}`); + logger.info(`WildFly server is ready: ${wildflyServer}`); return wildflyServer; }) .catch((err: unknown) => { @@ -67,7 +67,7 @@ export function createExecuteInContainer( startedContainersManagementPorts: Map, ) { return ({ containerName, command }: ExecuteInContainerParams) => { - console.log(`CLI commands: ${command}`); + logger.debug(`CLI commands: ${command}`); const containerToExec = startedContainers.get(containerName); let managementPort = startedContainersManagementPorts.get(containerName); managementPort = managementPort ?? WILDFLY_MANAGEMENT_PORT; @@ -86,7 +86,7 @@ export function createExecuteInContainer( if (value.exitCode === 0) { return value; } else { - console.log(value); + logger.debug(value); throw new Error(`Command failed with exit code ${value.exitCode}: ${value.output || ""}`); } }) diff --git a/cypress.config.ts b/cypress.config.ts index d960bf8f1..216dc06a2 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -11,6 +11,7 @@ import { createSqlserverContainer, createExecuteCli, } from "./config/tasks"; +import { logger } from "./config/helpers"; // WildFly configuration export const DEFAULT_WILDFLY_CONFIG = "standalone-insecure.xml"; @@ -91,12 +92,16 @@ export default defineConfig({ "execute:in:container": createExecuteInContainer(startedContainers, startedContainersManagementPorts), "execute:cli": createExecuteCli(), "stop:containers": () => { - const promises: Promise[] = []; + const promises: Promise[] = []; startedContainers.forEach((container, key) => { - console.log("Stopping container for test " + key); + logger.info("Stopping container for test " + key); startedContainers.delete(key); startedContainersManagementPorts.delete(key); - promises.push(container.stop()); + promises.push( + container.stop().catch((err: unknown) => { + logger.error(`Failed to stop container ${key}: ${err instanceof Error ? err.message : String(err)}`); + }), + ); }); return Promise.all(promises); }, diff --git a/packages/berg/src/berg.ts b/packages/berg/src/berg.ts index 292e13d7b..675215c13 100644 --- a/packages/berg/src/berg.ts +++ b/packages/berg/src/berg.ts @@ -1,3 +1,4 @@ +import "./container-runtime"; import { PullPolicy, GenericContainer, Network, StartedNetwork, StartedTestContainer } from "testcontainers"; export class Berg { diff --git a/packages/berg/src/container-runtime.ts b/packages/berg/src/container-runtime.ts new file mode 100644 index 000000000..0e6c0ddb7 --- /dev/null +++ b/packages/berg/src/container-runtime.ts @@ -0,0 +1,54 @@ +import { existsSync } from "fs"; +import { execSync } from "child_process"; +import os from "os"; + +function isPodmanHost(dockerHost: string): boolean { + return dockerHost.includes("podman"); +} + +function disableTestcontainersRyuk(): void { + if (!process.env.TESTCONTAINERS_RYUK_DISABLED) { + process.env.TESTCONTAINERS_RYUK_DISABLED = "true"; + } +} + +export function configureContainerRuntime(): void { + if (process.env.DOCKER_HOST) { + if (isPodmanHost(process.env.DOCKER_HOST)) { + disableTestcontainersRyuk(); + console.log( + `[berg] DOCKER_HOST points to Podman (${process.env.DOCKER_HOST}), configured TESTCONTAINERS_RYUK_DISABLED`, + ); + } + return; + } + + const uid = os.userInfo().uid; + const podmanSocketPaths = [`/run/user/${uid}/podman/podman.sock`, "/var/run/podman/podman.sock"]; + + for (const socketPath of podmanSocketPaths) { + if (!existsSync(socketPath)) { + try { + execSync("systemctl --user start podman.socket", { stdio: "ignore" }); + } catch { + continue; + } + } + + if (existsSync(socketPath)) { + process.env.DOCKER_HOST = `unix://${socketPath}`; + disableTestcontainersRyuk(); + console.log( + `[berg] Detected Podman runtime at ${socketPath}, configured DOCKER_HOST and TESTCONTAINERS_RYUK_DISABLED`, + ); + return; + } + } + + // Verify that at least Docker is available as a fallback + if (existsSync("/var/run/docker.sock")) { + return; + } +} + +configureContainerRuntime(); From 70ff10af9f476ba18abb23a6e95b3646b774e4bf Mon Sep 17 00:00:00 2001 From: Krystof Stekovic Date: Tue, 17 Mar 2026 13:28:22 +0100 Subject: [PATCH 5/5] Fix error handling and resolve JDBC driver paths dynamically Fix executeInContainer catch block to check for AxiosErrorResponse first, then re-throw plain Error instances, then handle unknown errors. The previous code crashed with "Cannot read properties of undefined" when CLI commands failed with non-zero exit codes. Add resolve:jdbc:driver Cypress task that scans the fixtures directory and finds the jar matching a given prefix. This decouples test specs from specific driver versions -- only the pom.xml needs updating when bumping JDBC driver versions. Co-Authored-By: Claude Opus 4.6 (1M context) --- README.md | 14 ++++ config/tasks/wildfly-tasks.ts | 11 ++- cypress.config.ts | 11 ++- ...figuration-datasource-mariadb-finder.cy.ts | 76 ++++++++++--------- ...onfiguration-datasource-mysql-finder.cy.ts | 76 ++++++++++--------- ...figuration-datasource-postgre-finder.cy.ts | 76 ++++++++++--------- ...est-configuration-datasource-postgre.cy.ts | 76 ++++++++++--------- ...guration-datasource-sqlserver-finder.cy.ts | 18 +++-- 8 files changed, 202 insertions(+), 156 deletions(-) diff --git a/README.md b/README.md index d82723396..10cebeab8 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,20 @@ Following is a table of supported environment properties that can be used when r | `MSSQL_IMAGE` | `mcr.microsoft.com/mssql/server:2022-latest` | Microsoft SQL Server image to be used for datasource tests | | `BERG_VERBOSE` | `false` | Enable verbose Berg logging (debug messages for container setup, CLI commands, etc.) | +## JDBC drivers + +JDBC driver jars are used in datasource tests. They are downloaded automatically by Maven during `npm install` (via `npm run resources`) and placed into `packages/testsuite/cypress/fixtures/jdbc-drivers/`. These jars are `.gitignore`d and built fresh each time. + +### Where versions are defined + +Driver versions are managed in [`packages/resources/pom.xml`](packages/resources/pom.xml) under ``. The download is configured in [`packages/resources/modules/jdbc-drivers/pom.xml`](packages/resources/modules/jdbc-drivers/pom.xml). + +### How to update + +1. Update the version in `packages/resources/pom.xml` under `` +2. Run `npm install` or `npm run resources` to download the new jars +3. No test spec changes needed -- driver paths are resolved automatically at runtime by the `resolve:jdbc:driver` Cypress task using the artifact prefix (e.g., `postgresql`, `mysql-connector-j`) + ## Custom method documentation Documentation can be generated by following command in root of this repository diff --git a/config/tasks/wildfly-tasks.ts b/config/tasks/wildfly-tasks.ts index db3335e8e..54c9bcb9c 100644 --- a/config/tasks/wildfly-tasks.ts +++ b/config/tasks/wildfly-tasks.ts @@ -8,7 +8,7 @@ import { WILDFLY_MANAGEMENT_PORT, JBOSS_CLI_PATH, } from "../../cypress.config"; -import { StartWildflyContainerParams, ExecuteInContainerParams, AxiosErrorResponse } from "../interfaces"; +import { StartWildflyContainerParams, ExecuteInContainerParams } from "../interfaces"; import { getHostnameMapping, handleContainerError, calculateManagementPort, logger } from "../helpers"; import { configureWildflyNetworkMode, configureWildflyPostStart } from "../containers"; @@ -90,8 +90,13 @@ export function createExecuteInContainer( throw new Error(`Command failed with exit code ${value.exitCode}: ${value.output || ""}`); } }) - .catch((err: AxiosErrorResponse) => { - throw new Error(err.response.data); + // Only container.exec() errors and plain Errors from the .then() block can reach here. + // AxiosErrorResponse is not possible — Axios is not used in this function. + .catch((err: unknown) => { + if (err instanceof Error) { + throw err; + } + throw new Error(String(err)); }); }; } diff --git a/cypress.config.ts b/cypress.config.ts index 216dc06a2..7cf9426a0 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -1,6 +1,6 @@ import { defineConfig } from "cypress"; import { StartedTestContainer, StoppedTestContainer } from "testcontainers"; -import { existsSync, unlinkSync } from "fs"; +import { existsSync, unlinkSync, readdirSync } from "fs"; import { createWildflyContainer, createExecuteInContainer, @@ -91,6 +91,15 @@ export default defineConfig({ "start:sqlserver:container": createSqlserverContainer(startedContainers, config.env.NETWORK_NAME as string), "execute:in:container": createExecuteInContainer(startedContainers, startedContainersManagementPorts), "execute:cli": createExecuteCli(), + "resolve:jdbc:driver": (prefix: string) => { + const jdbcDir = FIXTURES_PATH + "/jdbc-drivers"; + const files = readdirSync(jdbcDir); + const match = files.find((f) => f.startsWith(prefix) && f.endsWith(".jar")); + if (!match) { + throw new Error(`No JDBC driver jar found matching prefix "${prefix}" in ${jdbcDir}`); + } + return `/home/fixtures/jdbc-drivers/${match}`; + }, "stop:containers": () => { const promises: Promise[] = []; startedContainers.forEach((container, key) => { diff --git a/packages/testsuite/cypress/e2e/datasource/test-configuration-datasource-mariadb-finder.cy.ts b/packages/testsuite/cypress/e2e/datasource/test-configuration-datasource-mariadb-finder.cy.ts index e2738f224..3b01bb9b1 100644 --- a/packages/testsuite/cypress/e2e/datasource/test-configuration-datasource-mariadb-finder.cy.ts +++ b/packages/testsuite/cypress/e2e/datasource/test-configuration-datasource-mariadb-finder.cy.ts @@ -52,47 +52,51 @@ describe("TESTS: Configuration => Datasource => MariaDB (Finder)", () => { ); cy.startWildflyContainer().then((result) => { managementEndpoint = result as string; - cy.executeInWildflyContainer( - new AddModuleCommandBuilder() - .withName(mariadbDriverModuleName) - .withResource("/home/fixtures/jdbc-drivers/mariadb-java-client-3.1.0.jar") - .withDependencies(["javax.api"]) - .build() - .toCLICommand(), - ).then(() => { - cy.task("execute:cli", { - managementApi: managementEndpoint + "/management", - operation: "add", - address: ["subsystem", "datasources", "jdbc-driver", mariadbDriver], - "driver-module-name": mariadbDriverModuleName, - "driver-xa-datasource-class-name": "org.mariadb.jdbc.MariaDbDataSource", - }).then(() => { + cy.task("resolve:jdbc:driver", "mariadb-java-client") + .then((driverPath) => { cy.executeInWildflyContainer( - new AddDataSourceBuilder() - .withName(mariadbDSToAdd.name) - .withJndiName(mariadbDSToAdd.jndiName) - .withConnectionUrl(mariadbDSToAdd.connectionUrl) - .withDriverName(mariadbDriver) - .withUsername(mariadbUser) - .withPassword(mariadbPassword) - .build() - .toCLICommand(), - ); - cy.executeInWildflyContainer( - new AddXADataSourceBuilder() - .withName(xaMariaDBToAdd.name) - .withJndiName(xaMariaDBToAdd.jndiName) - .withUsername(mariadbUser) - .withPassword(mariadbPassword) - .withDriverName(mariadbDriver) - .withXaDataSourceClass("org.mariadb.jdbc.MariaDbDataSource") - .withXaDataSourceProperty("serverName", mariadbContainerName) - .withXaDataSourceProperty("databaseName", mariadbDatabaseName) + new AddModuleCommandBuilder() + .withName(mariadbDriverModuleName) + .withResource(driverPath as string) + .withDependencies(["javax.api"]) .build() .toCLICommand(), ); + }) + .then(() => { + cy.task("execute:cli", { + managementApi: managementEndpoint + "/management", + operation: "add", + address: ["subsystem", "datasources", "jdbc-driver", mariadbDriver], + "driver-module-name": mariadbDriverModuleName, + "driver-xa-datasource-class-name": "org.mariadb.jdbc.MariaDbDataSource", + }).then(() => { + cy.executeInWildflyContainer( + new AddDataSourceBuilder() + .withName(mariadbDSToAdd.name) + .withJndiName(mariadbDSToAdd.jndiName) + .withConnectionUrl(mariadbDSToAdd.connectionUrl) + .withDriverName(mariadbDriver) + .withUsername(mariadbUser) + .withPassword(mariadbPassword) + .build() + .toCLICommand(), + ); + cy.executeInWildflyContainer( + new AddXADataSourceBuilder() + .withName(xaMariaDBToAdd.name) + .withJndiName(xaMariaDBToAdd.jndiName) + .withUsername(mariadbUser) + .withPassword(mariadbPassword) + .withDriverName(mariadbDriver) + .withXaDataSourceClass("org.mariadb.jdbc.MariaDbDataSource") + .withXaDataSourceProperty("serverName", mariadbContainerName) + .withXaDataSourceProperty("databaseName", mariadbDatabaseName) + .build() + .toCLICommand(), + ); + }); }); - }); }); }); diff --git a/packages/testsuite/cypress/e2e/datasource/test-configuration-datasource-mysql-finder.cy.ts b/packages/testsuite/cypress/e2e/datasource/test-configuration-datasource-mysql-finder.cy.ts index 0eec512fb..4b679f77d 100644 --- a/packages/testsuite/cypress/e2e/datasource/test-configuration-datasource-mysql-finder.cy.ts +++ b/packages/testsuite/cypress/e2e/datasource/test-configuration-datasource-mysql-finder.cy.ts @@ -53,47 +53,51 @@ describe("TESTS: Configuration => Datasource => MySQL (Finder)", () => { ); cy.startWildflyContainer().then((result) => { managementEndpoint = result as string; - cy.executeInWildflyContainer( - new AddModuleCommandBuilder() - .withName(mysqlDriverModuleName) - .withResource("/home/fixtures/jdbc-drivers/mysql-connector-j-8.0.31.jar") - .withDependencies(["javax.api"]) - .build() - .toCLICommand(), - ).then(() => { - cy.task("execute:cli", { - managementApi: managementEndpoint + "/management", - operation: "add", - address: ["subsystem", "datasources", "jdbc-driver", mysqlDriver], - "driver-module-name": mysqlDriverModuleName, - "driver-xa-datasource-class-name": "com.mysql.cj.jdbc.MysqlXADataSource", - }).then(() => { + cy.task("resolve:jdbc:driver", "mysql-connector-j") + .then((driverPath) => { cy.executeInWildflyContainer( - new AddDataSourceBuilder() - .withName(mysqlDSToAdd.name) - .withJndiName(mysqlDSToAdd.jndiName) - .withConnectionUrl(mysqlDSToAdd.connectionUrl) - .withDriverName(mysqlDriver) - .withUsername(mysqlUser) - .withPassword(mysqlPassword) - .build() - .toCLICommand(), - ); - cy.executeInWildflyContainer( - new AddXADataSourceBuilder() - .withName(xaMySQLDSToAdd.name) - .withJndiName(xaMySQLDSToAdd.jndiName) - .withUsername(mysqlUser) - .withPassword(mysqlPassword) - .withDriverName(mysqlDriver) - .withXaDataSourceClass("com.mysql.cj.jdbc.MysqlXADataSource") - .withXaDataSourceProperty("serverName", mysqlContainerName) - .withXaDataSourceProperty("databaseName", mysqlDatabaseName) + new AddModuleCommandBuilder() + .withName(mysqlDriverModuleName) + .withResource(driverPath as string) + .withDependencies(["javax.api"]) .build() .toCLICommand(), ); + }) + .then(() => { + cy.task("execute:cli", { + managementApi: managementEndpoint + "/management", + operation: "add", + address: ["subsystem", "datasources", "jdbc-driver", mysqlDriver], + "driver-module-name": mysqlDriverModuleName, + "driver-xa-datasource-class-name": "com.mysql.cj.jdbc.MysqlXADataSource", + }).then(() => { + cy.executeInWildflyContainer( + new AddDataSourceBuilder() + .withName(mysqlDSToAdd.name) + .withJndiName(mysqlDSToAdd.jndiName) + .withConnectionUrl(mysqlDSToAdd.connectionUrl) + .withDriverName(mysqlDriver) + .withUsername(mysqlUser) + .withPassword(mysqlPassword) + .build() + .toCLICommand(), + ); + cy.executeInWildflyContainer( + new AddXADataSourceBuilder() + .withName(xaMySQLDSToAdd.name) + .withJndiName(xaMySQLDSToAdd.jndiName) + .withUsername(mysqlUser) + .withPassword(mysqlPassword) + .withDriverName(mysqlDriver) + .withXaDataSourceClass("com.mysql.cj.jdbc.MysqlXADataSource") + .withXaDataSourceProperty("serverName", mysqlContainerName) + .withXaDataSourceProperty("databaseName", mysqlDatabaseName) + .build() + .toCLICommand(), + ); + }); }); - }); }); }); diff --git a/packages/testsuite/cypress/e2e/datasource/test-configuration-datasource-postgre-finder.cy.ts b/packages/testsuite/cypress/e2e/datasource/test-configuration-datasource-postgre-finder.cy.ts index ad21d0757..1c04072d7 100644 --- a/packages/testsuite/cypress/e2e/datasource/test-configuration-datasource-postgre-finder.cy.ts +++ b/packages/testsuite/cypress/e2e/datasource/test-configuration-datasource-postgre-finder.cy.ts @@ -52,47 +52,51 @@ describe("TESTS: Configuration => Datasource => PostgreSQL (Finder)", () => { ); cy.startWildflyContainer().then((result) => { managementEndpoint = result as string; - cy.executeInWildflyContainer( - new AddModuleCommandBuilder() - .withName(postgresDriverModuleName) - .withResource("/home/fixtures/jdbc-drivers/postgresql-42.5.1.jar") - .withDependencies(["javax.api"]) - .build() - .toCLICommand(), - ).then(() => { - cy.task("execute:cli", { - managementApi: managementEndpoint + "/management", - operation: "add", - address: ["subsystem", "datasources", "jdbc-driver", postgresDriverName], - "driver-module-name": postgresDriverModuleName, - "driver-xa-datasource-class-name": "org.postgresql.xa.PGXADataSource", - }).then(() => { + cy.task("resolve:jdbc:driver", "postgresql") + .then((driverPath) => { cy.executeInWildflyContainer( - new AddDataSourceBuilder() - .withName(postgresDSToAdd.name) - .withJndiName(postgresDSToAdd.jndiName) - .withConnectionUrl(postgresDSToAdd.connectionUrl) - .withDriverName(postgresDriverName) - .withUsername(postgresUser) - .withPassword(postgresPassword) - .build() - .toCLICommand(), - ); - cy.executeInWildflyContainer( - new AddXADataSourceBuilder() - .withName(xaPostgreDSToAdd.name) - .withJndiName(xaPostgreDSToAdd.jndiName) - .withUsername(postgresUser) - .withPassword(postgresPassword) - .withDriverName(postgresDriverName) - .withXaDataSourceClass("org.postgresql.xa.PGXADataSource") - .withXaDataSourceProperty("serverName", postgresContainerName) - .withXaDataSourceProperty("databaseName", postgresDatabaseName) + new AddModuleCommandBuilder() + .withName(postgresDriverModuleName) + .withResource(driverPath as string) + .withDependencies(["javax.api"]) .build() .toCLICommand(), ); + }) + .then(() => { + cy.task("execute:cli", { + managementApi: managementEndpoint + "/management", + operation: "add", + address: ["subsystem", "datasources", "jdbc-driver", postgresDriverName], + "driver-module-name": postgresDriverModuleName, + "driver-xa-datasource-class-name": "org.postgresql.xa.PGXADataSource", + }).then(() => { + cy.executeInWildflyContainer( + new AddDataSourceBuilder() + .withName(postgresDSToAdd.name) + .withJndiName(postgresDSToAdd.jndiName) + .withConnectionUrl(postgresDSToAdd.connectionUrl) + .withDriverName(postgresDriverName) + .withUsername(postgresUser) + .withPassword(postgresPassword) + .build() + .toCLICommand(), + ); + cy.executeInWildflyContainer( + new AddXADataSourceBuilder() + .withName(xaPostgreDSToAdd.name) + .withJndiName(xaPostgreDSToAdd.jndiName) + .withUsername(postgresUser) + .withPassword(postgresPassword) + .withDriverName(postgresDriverName) + .withXaDataSourceClass("org.postgresql.xa.PGXADataSource") + .withXaDataSourceProperty("serverName", postgresContainerName) + .withXaDataSourceProperty("databaseName", postgresDatabaseName) + .build() + .toCLICommand(), + ); + }); }); - }); }); }); diff --git a/packages/testsuite/cypress/e2e/datasource/test-configuration-datasource-postgre.cy.ts b/packages/testsuite/cypress/e2e/datasource/test-configuration-datasource-postgre.cy.ts index 4e0529d40..5c6a06a2f 100644 --- a/packages/testsuite/cypress/e2e/datasource/test-configuration-datasource-postgre.cy.ts +++ b/packages/testsuite/cypress/e2e/datasource/test-configuration-datasource-postgre.cy.ts @@ -36,47 +36,51 @@ describe("TESTS: Configuration => Datasource => PostgreSQL", () => { ); cy.startWildflyContainer().then((result) => { managementEndpoint = result as string; - cy.executeInWildflyContainer( - new AddModuleCommandBuilder() - .withName("org.postgres") - .withResource("/home/fixtures/jdbc-drivers/postgresql-42.5.1.jar") - .withDependencies(["javax.api"]) - .build() - .toCLICommand(), - ).then(() => { - cy.task("execute:cli", { - managementApi: managementEndpoint + "/management", - operation: "add", - address: ["subsystem", "datasources", "jdbc-driver", postgresDriverName], - "driver-module-name": "org.postgres", - "driver-xa-datasource-class-name": "org.postgresql.xa.PGXADataSource", - }).then(() => { + cy.task("resolve:jdbc:driver", "postgresql") + .then((driverPath) => { cy.executeInWildflyContainer( - new AddDataSourceBuilder() - .withName(postgresDSToAdd.name) - .withJndiName(postgresDSToAdd.jndiName) - .withConnectionUrl(postgresDSToAdd.connectionUrl) - .withDriverName(postgresDriverName) - .withUsername(postgresUser) - .withPassword(postgresPassword) - .build() - .toCLICommand(), - ); - cy.executeInWildflyContainer( - new AddXADataSourceBuilder() - .withName(xaPostgreDSToAdd.name) - .withJndiName(xaPostgreDSToAdd.jndiName) - .withUsername(postgresUser) - .withPassword(postgresPassword) - .withDriverName(postgresDriverName) - .withXaDataSourceClass("org.postgresql.xa.PGXADataSource") - .withXaDataSourceProperty("serverName", postgresContainerName) - .withXaDataSourceProperty("databaseName", postgresDatabaseName) + new AddModuleCommandBuilder() + .withName("org.postgres") + .withResource(driverPath as string) + .withDependencies(["javax.api"]) .build() .toCLICommand(), ); + }) + .then(() => { + cy.task("execute:cli", { + managementApi: managementEndpoint + "/management", + operation: "add", + address: ["subsystem", "datasources", "jdbc-driver", postgresDriverName], + "driver-module-name": "org.postgres", + "driver-xa-datasource-class-name": "org.postgresql.xa.PGXADataSource", + }).then(() => { + cy.executeInWildflyContainer( + new AddDataSourceBuilder() + .withName(postgresDSToAdd.name) + .withJndiName(postgresDSToAdd.jndiName) + .withConnectionUrl(postgresDSToAdd.connectionUrl) + .withDriverName(postgresDriverName) + .withUsername(postgresUser) + .withPassword(postgresPassword) + .build() + .toCLICommand(), + ); + cy.executeInWildflyContainer( + new AddXADataSourceBuilder() + .withName(xaPostgreDSToAdd.name) + .withJndiName(xaPostgreDSToAdd.jndiName) + .withUsername(postgresUser) + .withPassword(postgresPassword) + .withDriverName(postgresDriverName) + .withXaDataSourceClass("org.postgresql.xa.PGXADataSource") + .withXaDataSourceProperty("serverName", postgresContainerName) + .withXaDataSourceProperty("databaseName", postgresDatabaseName) + .build() + .toCLICommand(), + ); + }); }); - }); }); }); diff --git a/packages/testsuite/cypress/e2e/datasource/test-configuration-datasource-sqlserver-finder.cy.ts b/packages/testsuite/cypress/e2e/datasource/test-configuration-datasource-sqlserver-finder.cy.ts index 262dfe297..3b7856c18 100644 --- a/packages/testsuite/cypress/e2e/datasource/test-configuration-datasource-sqlserver-finder.cy.ts +++ b/packages/testsuite/cypress/e2e/datasource/test-configuration-datasource-sqlserver-finder.cy.ts @@ -70,14 +70,16 @@ describe("TESTS: Configuration => Datasource => SQL Server (Finder)", () => { managementEndpoint = result as string; }) .then(() => { - cy.executeInWildflyContainer( - new AddModuleCommandBuilder() - .withName(sqlserverDriverModuleName) - .withResource("/home/fixtures/jdbc-drivers/mssql-jdbc-11.2.1.jre11.jar") - .withDependencies(["javax.api"]) - .build() - .toCLICommand(), - ); + cy.task("resolve:jdbc:driver", "mssql-jdbc").then((driverPath) => { + cy.executeInWildflyContainer( + new AddModuleCommandBuilder() + .withName(sqlserverDriverModuleName) + .withResource(driverPath as string) + .withDependencies(["javax.api"]) + .build() + .toCLICommand(), + ); + }); }) .then(() => { cy.task("execute:cli", {