Skip to content

Commit 2e972e7

Browse files
committed
tests: disabled testnetConnection.test.ts
The testnet seed nodes are unstable right now, so these tests are unlikely to pass.
1 parent 7f625c5 commit 2e972e7

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

tests/integration/testnet/testnetConnection.test.ts

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,18 @@ import fs from 'fs';
55
import readline from 'readline';
66
import Logger, { LogLevel, StreamHandler, formatting } from '@matrixai/logger';
77
import PolykeyAgent from '@/PolykeyAgent';
8+
import config from '@/config';
89
import * as testUtils from '../../utils';
910
import { globalRootKeyPems } from '../../fixtures/globalRootKeyPems';
1011
import { sleep } from '../../../src/utils/index';
1112

12-
describe('testnet connection', () => {
13+
describe.skip('testnet connection', () => {
1314
const logger = new Logger('TCT', LogLevel.INFO, [new StreamHandler()]);
1415
const format = formatting.format`${formatting.keys}:${formatting.msg}`;
1516
logger.handlers.forEach((handler) => handler.setFormatter(format));
16-
// The testnet node ids/addresses are not fixed
17-
// These will need to be updated whenever they change
18-
const seedNodeId1 =
19-
'vdrn5ok1cdrghve4r72dufhk5si9m42665eutias61sgavjusar60' as NodeIdEncoded;
20-
const seedNodeIp1 = 'testnet.polykey.io' as Host;
21-
const seedNodePort = 1314 as Port;
17+
const seedNodes = Object.entries(config.defaults.network.testnet);
18+
const seedNodeId1 = seedNodes[0][0] as NodeIdEncoded;
19+
const seedNodeAddress1 = seedNodes[0][1];
2220
let dataDir: string;
2321
beforeEach(async () => {
2422
dataDir = await fs.promises.mkdtemp(
@@ -34,13 +32,13 @@ describe('testnet connection', () => {
3432
test('can connect to `testnet.polykey.io` seed node', async () => {
3533
const password = 'abc123';
3634
const nodePath = path.join(dataDir, 'polykey');
37-
// Starting an agent with the testnet as a seed ndoe
35+
// Starting an agent with the testnet as a seed node
3836
const agentProcess = await testUtils.pkSpawn(
3937
[
4038
'agent',
4139
'start',
4240
'--seed-nodes',
43-
`${seedNodeId1}@${seedNodeIp1}:${seedNodePort}`,
41+
`${seedNodeId1}@${seedNodeAddress1.host}:${seedNodeAddress1.port}`,
4442
'--format',
4543
'json',
4644
'--verbose',
@@ -77,6 +75,7 @@ describe('testnet connection', () => {
7775
);
7876
expect(exitCode1).toBe(0);
7977
} finally {
78+
agentProcess.kill('SIGINT');
8079
await testUtils.processExit(agentProcess);
8180
}
8281
});
@@ -90,7 +89,7 @@ describe('testnet connection', () => {
9089
'agent',
9190
'start',
9291
'--seed-nodes',
93-
`${seedNodeId1}@${seedNodeIp1}:${seedNodePort}`,
92+
`${seedNodeId1}@${seedNodeAddress1.host}:${seedNodeAddress1.port}`,
9493
'--format',
9594
'json',
9695
'--verbose',
@@ -112,7 +111,7 @@ describe('testnet connection', () => {
112111
'agent',
113112
'start',
114113
'--seed-nodes',
115-
`${seedNodeId1}@${seedNodeIp1}:${seedNodePort}`,
114+
`${seedNodeId1}@${seedNodeAddress1.host}:${seedNodeAddress1.port}`,
116115
'--format',
117116
'json',
118117
'--verbose',
@@ -199,12 +198,14 @@ describe('testnet connection', () => {
199198
);
200199
expect(exitCode4).toBe(0);
201200
} finally {
201+
agentProcessA.kill('SIGINT');
202+
agentProcessB.kill('SIGINT');
202203
await testUtils.processExit(agentProcessA);
203204
await testUtils.processExit(agentProcessB);
204205
}
205206
});
206207
// This test is known to fail, two nodes on the same network can't hole punch
207-
test('testing hole punching', async () => {
208+
test.skip('testing hole punching', async () => {
208209
// Const nodePathS = path.join(dataDir, 'seed');
209210
const nodePath1 = path.join(dataDir, 'node1');
210211
const nodePath2 = path.join(dataDir, 'node2');
@@ -234,10 +235,7 @@ describe('testnet connection', () => {
234235
// },
235236
// };
236237
const seedNodes: SeedNodes = {
237-
[seedNodeId1]: {
238-
host: seedNodeIp1,
239-
port: seedNodePort,
240-
},
238+
[seedNodeId1]: seedNodeAddress1,
241239
};
242240
// Console.log('Starting Agent1');
243241
const agent1 = await PolykeyAgent.createPolykeyAgent({

0 commit comments

Comments
 (0)