Skip to content

Commit 2c7c774

Browse files
chore: add test of envoy proxy endpoint (#2344)
Signed-off-by: Jeffrey Tang <[email protected]>
1 parent 972d132 commit 2c7c774

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

test/e2e/commands/account.test.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,45 @@ endToEndTestSuite(testName, argv, {containerOverrides: overrides}, bootstrapResp
445445
}
446446
}).timeout(Duration.ofMinutes(2).toMillis());
447447

448+
it('Enable Envoy proxy port forwarding and create client from network config should succeed', async () => {
449+
try {
450+
// using label `app=envoy-proxy-node1` to find Envoy proxy pod
451+
const envoyProxyPod = await k8Factory.default().pods().list(namespace, ['app=envoy-proxy-node1']);
452+
// enable portfroward of Envoy proxy pod
453+
const portForward = await k8Factory
454+
.default()
455+
.pods()
456+
.readByReference(envoyProxyPod[0].podReference)
457+
.portForward(10_500, 8080);
458+
459+
// Setup network configuration
460+
const networkConfig = {};
461+
networkConfig['127.0.0.1:10500'] = AccountId.fromString('0.0.3');
462+
463+
// Instantiate SDK client
464+
const sdkClient = Client.fromConfig({network: networkConfig, scheduleNetworkUpdate: false});
465+
sdkClient.setOperator(MY_ACCOUNT_ID, MY_PRIVATE_KEY);
466+
467+
// Create a new public topic and submit a message
468+
const txResponse = await new TopicCreateTransaction().execute(sdkClient);
469+
const receipt = await txResponse.getReceipt(sdkClient);
470+
471+
const submitResponse = await new TopicMessageSubmitTransaction({
472+
topicId: receipt.topicId,
473+
message: 'Hello, Hedera!',
474+
}).execute(sdkClient);
475+
476+
const submitReceipt = await submitResponse.getReceipt(sdkClient);
477+
478+
expect(submitReceipt.status).to.deep.equal(Status.Success);
479+
480+
// disable portForward
481+
portForward.close();
482+
} catch (error) {
483+
testLogger.showUserError(error);
484+
}
485+
}).timeout(Duration.ofMinutes(2).toMillis());
486+
448487
// hitchhiker account test to test node freeze and restart
449488
it('Freeze and restart all nodes should succeed', async () => {
450489
try {

0 commit comments

Comments
 (0)