Skip to content

Commit

Permalink
NodeConnection: removing sends hole-punch message test
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuakarp committed Nov 25, 2021
1 parent b52d578 commit ffca4d9
Showing 1 changed file with 2 additions and 46 deletions.
48 changes: 2 additions & 46 deletions tests/nodes/NodeConnection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ import { ForwardProxy, ReverseProxy } from '@/network';
import { NodeConnection, NodeManager } from '@/nodes';
import { VaultManager } from '@/vaults';
import { KeyManager } from '@/keys';
import { utils as networkUtils } from '@/network';
import GRPCServer from '@/grpc/GRPCServer';
import { AgentServiceService, createAgentService } from '@/agent';
import { ACL } from '@/acl';
import { GestaltGraph } from '@/gestalts';
import { Sigchain } from '@/sigchain';
import { NotificationsManager } from '@/notifications';

import * as grpcErrors from '@/grpc/errors';
import * as nodesUtils from '@/nodes/utils';
import * as nodesErrors from '@/nodes/errors';
import * as networkErrors from '@/network/errors';
Expand All @@ -27,7 +25,6 @@ import { poll } from '@/utils';
import { generateKeyPair } from '@/keys/utils';
import * as nodesTestUtils from './utils';
import { makeCrypto } from '../utils';
// Import { poll } from '../utils';

describe('NodeConnection', () => {
const password = 'password';
Expand Down Expand Up @@ -115,13 +112,13 @@ describe('NodeConnection', () => {
const serverVaultsPath = path.join(serverDataDir, 'serverVaults');
const serverDbPath = path.join(serverDataDir, 'serverDb');

const ServerKeyPairOverride = await generateKeyPair(4096);
const serverKeyPairOverride = await generateKeyPair(4096);
serverKeyManager = await KeyManager.createKeyManager({
password,
keysPath: serverKeysPath,
fs: fs,
logger: logger,
keyPairOverride: ServerKeyPairOverride,
keyPairOverride: serverKeyPairOverride,
});

const serverTLSConfig = {
Expand Down Expand Up @@ -395,47 +392,6 @@ describe('NodeConnection', () => {
);
await conn.destroy();
});
test('sends hole punch message to connected target (expected to be broker, to relay further)', async () => {
const conn = await NodeConnection.createNodeConnection({
targetNodeId: targetNodeId,
targetHost: targetHost,
targetPort: targetPort,
forwardProxy: clientFwdProxy,
keyManager: clientKeyManager,
logger: logger,
});
await serverRevProxy.openConnection(sourceHost, sourcePort);

const egressAddress = networkUtils.buildAddress(
clientFwdProxy.egressHost as Host,
clientFwdProxy.egressPort as Port,
);
const signature = await clientKeyManager.signWithRootKeyPair(
Buffer.from(egressAddress),
);

// The targetNodeId ('NODEID') differs from the node ID of the connected target,
// indicating that this relay message is intended for another node.
// Expected to throw an error, as the connection to 1.1.1.1:11111 would not
// exist on the server's side. A broker is expected to have this pre-existing
// connection.
await expect(
async () =>
await conn.sendHolePunchMessage(
sourceNodeId,
'NODEID' as NodeId,
egressAddress,
signature,
),
).rejects.toThrow(grpcErrors.ErrorGRPCClientCall);

await conn.stop();
await serverRevProxy.closeConnection(
clientFwdProxy.egressHost,
clientFwdProxy.egressPort,
);
await conn.destroy();
});
test.skip('scans the servers vaults', async () => {
// Const vault1 = await serverVaultManager.createVault('Vault1' as VaultName);
// const vault2 = await serverVaultManager.createVault('Vault2' as VaultName);
Expand Down

0 comments on commit ffca4d9

Please sign in to comment.