Skip to content

Commit e854d5a

Browse files
Fix compilation issues + add CICD step
1 parent e03ddd5 commit e854d5a

File tree

5 files changed

+52
-15
lines changed

5 files changed

+52
-15
lines changed

.github/workflows/test.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,38 @@ jobs:
7373
WORKSPACE_PATH: ${{ steps.npm-install.outputs.workspace_path }}
7474
run: npm run lint:ci
7575

76+
compile:
77+
if: ${{ needs.detect-modules.outputs.modules_count > 0 }}
78+
name: Compile
79+
needs:
80+
- detect-modules
81+
- lint
82+
strategy:
83+
fail-fast: false
84+
matrix:
85+
module: ${{ fromJSON(needs.detect-modules.outputs.modules) }}
86+
runs-on: ubuntu-22.04
87+
steps:
88+
- name: Code checkout
89+
uses: actions/checkout@v4
90+
- name: Install Node and Dependencies
91+
id: npm-install
92+
uses: ./.github/actions/npm-setup
93+
with:
94+
runner: ubuntu-22.04
95+
node-version: 22.x
96+
workspace: "${{ matrix.module }}"
97+
- name: Code linting
98+
env:
99+
WORKSPACE_PATH: ${{ steps.npm-install.outputs.workspace_path }}
100+
run: npm run build --noEmit
101+
76102
smoke-test:
77103
if: ${{ needs.detect-modules.outputs.modules_count > 0 }}
78104
needs:
79105
- detect-modules
80106
- lint
107+
- compile
81108
name: Smoke tests
82109
strategy:
83110
fail-fast: true
@@ -111,6 +138,7 @@ jobs:
111138
needs:
112139
- detect-modules
113140
- lint
141+
- compile
114142
- smoke-test
115143
strategy:
116144
fail-fast: false
@@ -130,6 +158,7 @@ jobs:
130158
needs:
131159
- detect-modules
132160
- lint
161+
- compile
133162
- smoke-test
134163
- test
135164
strategy:
@@ -150,6 +179,7 @@ jobs:
150179
needs:
151180
- detect-modules
152181
- lint
182+
- compile
153183
- smoke-test
154184
- test
155185
- test-podman

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"lint": "eslint --fix package.json \"packages/**/*.ts\"",
1616
"lint:ci": "eslint package.json \"${WORKSPACE_PATH}/**/*.ts\" --max-warnings=0",
1717
"update-deps": "npm-check-updates --workspaces --root -u",
18-
"validate-engine": "ls-engines"
18+
"validate-engine": "ls-engines",
19+
"check-compiles": "npm run build -ws -- --project tsconfig.json --noEmit"
1920
},
2021
"devDependencies": {
2122
"@eslint/js": "^9.22.0",
Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,33 @@
11
import mqtt from "mqtt";
2+
import { expect } from "vitest";
23
import { HiveMQContainer } from "./hivemq-container";
34

45
const IMAGE = "hivemq/hivemq-ce:2023.5";
56

67
describe("HiveMQContainer", { timeout: 240_000 }, () => {
78
// connect {
8-
it("should connect to HiveMQ Community Edition via MQTT.js", (done) => {
9-
new HiveMQContainer(IMAGE).start().then((hiveMQContainer) => {
10-
const testMqttClient = mqtt.connect(hiveMQContainer.getConnectionString());
9+
it("should connect to HiveMQ Community Edition via MQTT.js", async () => {
10+
const container = await new HiveMQContainer(IMAGE).start();
1111

12+
const testMqttClient = mqtt.connect(container.getConnectionString());
13+
14+
const promise = new Promise<void>((resolve) => {
1215
testMqttClient.on("message", (topic, message) => {
1316
expect(message.toString()).toEqual("Test Message");
1417
testMqttClient.end();
15-
done();
18+
resolve();
1619
});
20+
});
1721

18-
testMqttClient.on("connect", () => {
19-
testMqttClient.subscribe("test", (error) => {
20-
if (!error) {
21-
testMqttClient.publish("test", "Test Message");
22-
}
23-
});
22+
testMqttClient.on("connect", () => {
23+
testMqttClient.subscribe("test", (error) => {
24+
if (!error) {
25+
testMqttClient.publish("test", "Test Message");
26+
}
2427
});
2528
});
29+
30+
return expect(promise).resolves.toBeUndefined();
2631
});
2732
// }
2833
});

packages/modules/redpanda/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
},
2727
"scripts": {
2828
"prepack": "shx cp ../../../README.md . && shx cp ../../../LICENSE .",
29-
"build": "tsc --project tsconfig.build.json && shx cp -r src/assets build/"
29+
"build": "tsc --project tsconfig.build.json",
30+
"postpack": "shx cp -r src/assets build/"
3031
},
3132
"dependencies": {
3233
"handlebars": "^4.7.8",

packages/testcontainers/src/utils/test-helper.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { GetEventsOptions, ImageInspectInfo } from "dockerode";
22
import { Readable } from "stream";
3-
import { Agent } from "undici";
3+
import { Agent, request } from "undici";
44
import { IntervalRetry } from "../common";
55
import { getContainerRuntimeClient } from "../container-runtime";
66
import { StartedDockerComposeEnvironment } from "../docker-compose-environment/started-docker-compose-environment";
@@ -16,8 +16,8 @@ export const checkContainerIsHealthy = async (container: StartedTestContainer):
1616
export const checkContainerIsHealthyTls = async (container: StartedTestContainer): Promise<void> => {
1717
const url = `https://${container.getHost()}:${container.getMappedPort(8443)}`;
1818
const dispatcher = new Agent({ connect: { rejectUnauthorized: false } });
19-
const response = await fetch(`${url}/hello-world`, { dispatcher });
20-
expect(response.status).toBe(200);
19+
const response = await request(`${url}/hello-world`, { dispatcher });
20+
expect(response.statusCode).toBe(200);
2121
};
2222

2323
export const checkEnvironmentContainerIsHealthy = async (

0 commit comments

Comments
 (0)