Skip to content

Commit

Permalink
test(test-tooling): fix WS identity server port publish configuration
Browse files Browse the repository at this point in the history
1. The hostconfig portion of the container start configuration was not
being set up correctly which made it so that the exposed ports were not
published on randomized ports like they were supposed to.
2. This caused  the `fabric-v2-2-x/run-transaction-with-ws-ids.test.ts`
test to fail because it couldn't map the container port to a host machine
port.
3. Setting up the ws-test-server.ts class so that it does map the ports
to the host machine solved the issue.

Signed-off-by: Peter Somogyvari <[email protected]>
  • Loading branch information
petermetz committed Jul 16, 2024
1 parent c8b33c8 commit 8b268bc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,21 @@ describe("PluginLedgerConnectorFabric", () => {
logLevel,
});

await ledger.start({ omitPull: false });

wsTestContainer = new WsTestServer({});
await wsTestContainer.start();

const ci = await Containers.getById(wsTestContainer.containerId);
const wsIpAddr = await internalIpV4();
const hostPort = await Containers.getPublicPort(WS_IDENTITY_HTTP_PORT, ci);

await ledger.start({ omitPull: false });

const connectionProfile = await ledger.getConnectionProfileOrg1();
expect(connectionProfile).toBeTruthy();

const keychainInstanceId = uuidv4();
keychainId = uuidv4();

const ci = await Containers.getById(wsTestContainer.containerId);
const wsIpAddr = await internalIpV4();
const hostPort = await Containers.getPublicPort(WS_IDENTITY_HTTP_PORT, ci);

const wsUrl = `http://${wsIpAddr}:${hostPort}`;

const wsConfig: IWebSocketConfig = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ export class WsTestServer {
// to docker container's IP addresses directly...
// https://stackoverflow.com/a/39217691
PublishAllPorts: true,
/*Env: [`WS_IDENTITY_PATH=${WS_IDENTITY_PATH}`, ...this.envVars],
/*Env: [`WS_IDENTITY_PATH=${WS_IDENTITY_PATH}`, ...this.envVars],*/
HostConfig: {
// NetworkMode: "host",
CapAdd: ["IPC_LOCK"],
// CapAdd: ["IPC_LOCK"],
PublishAllPorts: true,
},*/
},
//Healthcheck: {
// Test: ["CMD-SHELL", "wget -O- http://127.0.0.1:8200/v1/sys/health"],
// Interval: 100 * 1000000,
Expand Down

0 comments on commit 8b268bc

Please sign in to comment.