Skip to content

Commit 902539f

Browse files
LordKubayaRafaelAPB
authored andcommitted
fix(satp-hermes): fix test (#3911)
Signed-off-by: Carlos Amaro <[email protected]>
1 parent f2b7ff2 commit 902539f

File tree

1 file changed

+27
-16
lines changed

1 file changed

+27
-16
lines changed

packages/cactus-plugin-satp-hermes/src/test/typescript/integration/satp-e2e-transfer-1-gateway-dockerization.test.ts

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ let gatewayRunner: SATPGatewayRunner;
5656

5757
const testNetwork = "test-network";
5858

59+
const gatewayAddress = "gateway.satp-hermes";
60+
5961
afterAll(async () => {
6062
await gatewayRunner.stop();
6163
await gatewayRunner.destroy();
@@ -152,7 +154,7 @@ describe("SATPGateway sending a token from Besu to Fabric", () => {
152154
);
153155
});
154156
it("should realize a transfer", async () => {
155-
const address: Address = `http://localhost`;
157+
const address: Address = `http://${gatewayAddress}`;
156158

157159
// gateway setup:
158160
const gatewayIdentity = {
@@ -199,17 +201,18 @@ describe("SATPGateway sending a token from Besu to Fabric", () => {
199201
logsPath: files.logsPath,
200202
ontologiesPath: files.ontologiesPath,
201203
networkName: testNetwork,
204+
url: gatewayAddress,
202205
};
203206

204207
gatewayRunner = new SATPGatewayRunner(gatewayRunnerOptions);
205208
log.debug("starting gatewayRunner...");
206209
await gatewayRunner.start(false);
207210
log.debug("gatewayRunner started sucessfully");
208211

209-
const port = await gatewayRunner.getHostPort(DEFAULT_PORT_GATEWAY_OAPI);
210-
211212
const approveAddressApi = new GetApproveAddressApi(
212-
new Configuration({ basePath: `${address}:${port}` }),
213+
new Configuration({
214+
basePath: `http://${await gatewayRunner.getOApiHost()}`,
215+
}),
213216
);
214217

215218
const reqApproveBesuAddress = await approveAddressApi.getApproveAddress({
@@ -248,7 +251,9 @@ describe("SATPGateway sending a token from Besu to Fabric", () => {
248251
await fabricEnv.giveRoleToBridge("Org2MSP");
249252

250253
const satpApi = new TransactionApi(
251-
new Configuration({ basePath: `${address}:${port}` }),
254+
new Configuration({
255+
basePath: `http://${await gatewayRunner.getOApiHost()}`,
256+
}),
252257
);
253258

254259
const req = getTransactRequest(
@@ -316,7 +321,7 @@ describe("SATPGateway sending a token from Fabric to Besu", () => {
316321
);
317322
});
318323
it("should realize a transfer", async () => {
319-
const address: Address = `http://localhost`;
324+
const address: Address = `http://${gatewayAddress}`;
320325

321326
// gateway setup:
322327
const gatewayIdentity = {
@@ -330,7 +335,7 @@ describe("SATPGateway sending a token from Fabric to Besu", () => {
330335
},
331336
],
332337
proofID: "mockProofID10",
333-
address: "http://localhost" as Address,
338+
address,
334339
} as GatewayIdentity;
335340

336341
// ethereumConfig Json object setup:
@@ -360,17 +365,18 @@ describe("SATPGateway sending a token from Fabric to Besu", () => {
360365
logsPath: files.logsPath,
361366
ontologiesPath: files.ontologiesPath,
362367
networkName: testNetwork,
368+
url: gatewayAddress,
363369
};
364370

365371
gatewayRunner = new SATPGatewayRunner(gatewayRunnerOptions);
366372
log.debug("starting gatewayRunner...");
367373
await gatewayRunner.start(true);
368374
log.debug("gatewayRunner started sucessfully");
369375

370-
const port = await gatewayRunner.getHostPort(DEFAULT_PORT_GATEWAY_OAPI);
371-
372376
const approveAddressApi = new GetApproveAddressApi(
373-
new Configuration({ basePath: `${address}:${port}` }),
377+
new Configuration({
378+
basePath: `http://${await gatewayRunner.getOApiHost()}`,
379+
}),
374380
);
375381

376382
const reqApproveFabricAddress = await approveAddressApi.getApproveAddress({
@@ -409,7 +415,9 @@ describe("SATPGateway sending a token from Fabric to Besu", () => {
409415
await besuEnv.giveRoleToBridge(reqApproveBesuAddress.data.approveAddress);
410416

411417
const satpApi = new TransactionApi(
412-
new Configuration({ basePath: `${address}:${port}` }),
418+
new Configuration({
419+
basePath: `http://${await gatewayRunner.getOApiHost()}`,
420+
}),
413421
);
414422

415423
const req = getTransactRequest(
@@ -478,7 +486,7 @@ describe("SATPGateway sending a token from Besu to Ethereum", () => {
478486
);
479487
});
480488
it("should realize a transfer", async () => {
481-
const address: Address = `http://localhost`;
489+
const address: Address = `http://${gatewayAddress}`;
482490

483491
// gateway setup:
484492
const gatewayIdentity = {
@@ -525,17 +533,18 @@ describe("SATPGateway sending a token from Besu to Ethereum", () => {
525533
logsPath: files.logsPath,
526534
ontologiesPath: files.ontologiesPath,
527535
networkName: testNetwork,
536+
url: gatewayAddress,
528537
};
529538

530539
gatewayRunner = new SATPGatewayRunner(gatewayRunnerOptions);
531540
log.debug("starting gatewayRunner...");
532541
await gatewayRunner.start(true);
533542
log.debug("gatewayRunner started sucessfully");
534543

535-
const port = await gatewayRunner.getHostPort(DEFAULT_PORT_GATEWAY_OAPI);
536-
537544
const approveAddressApi = new GetApproveAddressApi(
538-
new Configuration({ basePath: `${address}:${port}` }),
545+
new Configuration({
546+
basePath: `http://${await gatewayRunner.getOApiHost()}`,
547+
}),
539548
);
540549

541550
const reqApproveBesuAddress = await approveAddressApi.getApproveAddress({
@@ -579,7 +588,9 @@ describe("SATPGateway sending a token from Besu to Ethereum", () => {
579588
);
580589

581590
const satpApi = new TransactionApi(
582-
new Configuration({ basePath: `${address}:${port}` }),
591+
new Configuration({
592+
basePath: `http://${await gatewayRunner.getOApiHost()}`,
593+
}),
583594
);
584595

585596
const req = getTransactRequest(

0 commit comments

Comments
 (0)