Skip to content

Commit 7de4dfe

Browse files
authored
Merge pull request #140 from kstekovi/main
Improve developer experience: auto-detect Podman, structured logging, and dependency updates
2 parents e20c725 + 70ff10a commit 7de4dfe

27 files changed

Lines changed: 355 additions & 195 deletions

.github/workflows/manual-test-matrix-workflow.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
on:
22
workflow_dispatch:
3+
inputs:
4+
verbose:
5+
type: boolean
6+
description: "Enable verbose Berg logging"
7+
default: false
38
name: "Manual matrix test execution"
49
concurrency:
510
group: ${{ github.ref }}
@@ -30,6 +35,8 @@ jobs:
3035
"mail",
3136
"microprofile",
3237
"metrics",
38+
"micrometer",
39+
"opentelemetry",
3340
"runtime",
3441
"security-manager",
3542
"system-property",
@@ -71,6 +78,9 @@ jobs:
7178
- name: "Run compile"
7279
run: "npm run compile"
7380
- name: "Run test(s)"
81+
env:
82+
BERG_VERBOSE: ${{ inputs.verbose }}
83+
DEBUG: ${{ inputs.verbose && 'testcontainers*' || '' }}
7484
run: "npm run test:compiled -- --browser=firefox --specs=packages/testsuite/cypress/e2e/${{ matrix.specs }}"
7585
- name: "Archive test report(s) and video(s)"
7686
if: ${{ !cancelled() }}

.github/workflows/manual-test-worfklow.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ on:
44
spec:
55
type: string
66
description: "Spec to run"
7+
verbose:
8+
type: boolean
9+
description: "Enable verbose Berg logging"
10+
default: false
711
name: "Manual job execution"
812
jobs:
913
call-reusable-workflow:
1014
uses: "./.github/workflows/reusable-build-project-workflow.yaml"
1115
with:
1216
spec: ${{ inputs.spec }}
17+
verbose: ${{ inputs.verbose }}

.github/workflows/on-pull-request-workflow.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ jobs:
3535
packages/testsuite/cypress/e2e/**/*.cy.ts
3636
- name: "Run tests of modified files"
3737
if: steps.changed-files-specific.outputs.any_changed == 'true'
38+
env:
39+
TESTCONTAINERS_RYUK_DISABLED: true
3840
run: |
3941
SPECS="${{ steps.changed-files-specific.outputs.all_changed_files }}"
4042
KEYCLOAK_IMAGE=quay.io/keycloak/keycloak:24.0 npm run test -- --browser=chrome --specs=$SPECS

.github/workflows/reusable-build-project-workflow.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ on:
66
type: string
77
required: false
88
description: "Comma delimited test spec file(s) to run."
9+
verbose:
10+
type: boolean
11+
required: false
12+
default: false
13+
description: "Enable verbose Berg logging"
914
jobs:
1015
build_project_job:
1116
name: "Build Project"
@@ -36,7 +41,15 @@ jobs:
3641
run: "npm run compile"
3742
- name: "Run all tests"
3843
if: "${{ github.event.inputs.spec == '' }}"
44+
env:
45+
TESTCONTAINERS_RYUK_DISABLED: true
46+
BERG_VERBOSE: ${{ inputs.verbose }}
47+
DEBUG: ${{ inputs.verbose && 'testcontainers*' || '' }}
3948
run: "npm run test:compiled"
4049
- name: "Run specific test"
4150
if: "${{ github.event.inputs.spec != '' }}"
51+
env:
52+
TESTCONTAINERS_RYUK_DISABLED: true
53+
BERG_VERBOSE: ${{ inputs.verbose }}
54+
DEBUG: ${{ inputs.verbose && 'testcontainers*' || '' }}
4255
run: "npm run test:compiled -- --specs=${{ inputs.spec }}"

.github/workflows/scheduled-run-all-tests-workflow.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ jobs:
3030
"jsf",
3131
"mail",
3232
"metrics",
33+
"micrometer",
34+
"opentelemetry",
3335
"runtime",
3436
"security-manager",
3537
"system-property",

README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,9 @@ Following tools are required to run the test suite
2828
- recommended version is 22.
2929
- [Node Version Manager (nvm)](https://github.com/nvm-sh/nvm) is recommended optional tool to install & manage multiple Node environments
3030
- [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.
31-
- [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:
31+
- [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:
3232
- `export TESTCONTAINERS_RYUK_DISABLED=true`
3333
- `export DOCKER_HOST=unix:///run/user/$UID/podman/podman.sock`
34-
- the path can be found by command `podman info --debug` and look for `path` in `remoteSocket` section.
35-
- `systemctl --user start podman.socket`
3634
- Java. Yes we'll need Java to write deployments/applications that will be deployed onto the running WildFly container.
3735
- [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.
3836

@@ -96,6 +94,21 @@ Following is a table of supported environment properties that can be used when r
9694
| `MYSQL_IMAGE` | `docker.io/library/mysql:latest` | MySQL image to be used for datasource tests |
9795
| `MARIADB_IMAGE` | `docker.io/library/mariadb:latest` | MariaDB image to be used for datasource tests |
9896
| `MSSQL_IMAGE` | `mcr.microsoft.com/mssql/server:2022-latest` | Microsoft SQL Server image to be used for datasource tests |
97+
| `BERG_VERBOSE` | `false` | Enable verbose Berg logging (debug messages for container setup, CLI commands, etc.) |
98+
99+
## JDBC drivers
100+
101+
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.
102+
103+
### Where versions are defined
104+
105+
Driver versions are managed in [`packages/resources/pom.xml`](packages/resources/pom.xml) under `<dependencyManagement>`. The download is configured in [`packages/resources/modules/jdbc-drivers/pom.xml`](packages/resources/modules/jdbc-drivers/pom.xml).
106+
107+
### How to update
108+
109+
1. Update the version in `packages/resources/pom.xml` under `<dependencyManagement>`
110+
2. Run `npm install` or `npm run resources` to download the new jars
111+
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`)
99112

100113
## Custom method documentation
101114

config/containers/database.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { PullPolicy, GenericContainer, StartedTestContainer, Wait } from "testcontainers";
22
import { DatabaseConfig } from "../interfaces";
3-
import { handleContainerError } from "../helpers";
3+
import { handleContainerError, logger } from "../helpers";
44

55
export function startDatabaseContainer(
66
config: DatabaseConfig,
@@ -18,7 +18,7 @@ export function startDatabaseContainer(
1818
return containerBuilder
1919
.start()
2020
.then((container) => {
21-
console.log(config.successMessage);
21+
logger.debug(config.successMessage);
2222
startedContainersMap.set(config.containerMapKey, container);
2323
return container;
2424
})

config/containers/wildfly.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
MANAGEMENT_INTERFACE_ADDRESS,
1212
} from "../../cypress.config";
1313
import { WildflyManagementResponse } from "../interfaces";
14-
import { buildLocalhostUrl } from "../helpers";
14+
import { buildLocalhostUrl, logger } from "../helpers";
1515

1616
export function pollWildflyState(managementApi: string, container: StartedTestContainer): Promise<string> {
1717
const startTime = new Date().getTime();
@@ -34,7 +34,7 @@ export function pollWildflyState(managementApi: string, container: StartedTestCo
3434
}
3535
})
3636
.catch(() => {
37-
console.log("WildFly server is not ready yet");
37+
logger.debug("WildFly server is not ready yet");
3838
});
3939
}, WILDFLY_POLL_INTERVAL_MS);
4040
});
@@ -61,7 +61,7 @@ export function configureWildflyNetworkMode(
6161
networkName?: string,
6262
): Promise<{ portOffset: number }> {
6363
if (useHostMode) {
64-
console.log("host mode");
64+
logger.debug("host mode");
6565
return findAPortNotInUse(WILDFLY_PORT_RANGE.min, WILDFLY_PORT_RANGE.max).then((freePort) => {
6666
const portOffset = freePort - WILDFLY_PORT_RANGE.min;
6767
wildfly
@@ -75,7 +75,7 @@ export function configureWildflyNetworkMode(
7575
return { portOffset };
7676
});
7777
} else {
78-
console.log(`default network mode, network name: ${networkName}`);
78+
logger.debug(`default network mode, network name: ${networkName}`);
7979
wildfly
8080
.withNetworkMode(networkName!)
8181
.withNetworkAliases("wildfly")

config/helpers/error-handler.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
import { logger } from "./logger";
2+
13
export function handleContainerError(err: unknown): Error {
2-
console.log(err);
4+
logger.error(err);
35
return err instanceof Error ? err : new Error(JSON.stringify(err));
46
}

config/helpers/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export * from "./error-handler";
22
export * from "./url-builder";
33
export * from "./container-helpers";
4+
export * from "./logger";

0 commit comments

Comments
 (0)