test(phase-4): add E2E suites for DAG workflows, SFTP transfers, broadcast, and AlertEngine
This commit is contained in:
parent
3791f83bf6
commit
413053182b
3 changed files with 1464 additions and 7 deletions
|
|
@ -4,7 +4,10 @@ import net from 'node:net';
|
|||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import ssh2, { type Attributes, type Connection, type Server } from 'ssh2';
|
||||
import { computeOpenSshFingerprint } from '../../src/server/security/vault.js';
|
||||
import {
|
||||
computeOpenSshFingerprint,
|
||||
generateValidEd25519KeyPair,
|
||||
} from '../../src/server/security/vault.js';
|
||||
|
||||
export interface MockSshOptions {
|
||||
username: string;
|
||||
|
|
@ -77,9 +80,9 @@ export class MockSshServer {
|
|||
this.sftpRootDir = fs.mkdtempSync(path.join(os.tmpdir(), 'mock-ssh-sftp-'));
|
||||
this.ownsSftpRoot = true;
|
||||
}
|
||||
const kp = ssh2.utils.generateKeyPairSync('ed25519', { comment: 'mock-host' });
|
||||
this.hostPrivateKey = kp.private;
|
||||
this.hostFingerprint = computeOpenSshFingerprint(kp.public.trim());
|
||||
const kp = generateValidEd25519KeyPair({ comment: 'mock-host' });
|
||||
this.hostPrivateKey = kp.privateKey;
|
||||
this.hostFingerprint = kp.fingerprint;
|
||||
}
|
||||
|
||||
private resolveVirtualPath(vPath: string): { normPosix: string; absPath: string } {
|
||||
|
|
@ -129,9 +132,9 @@ export class MockSshServer {
|
|||
async swapHostKey(): Promise<string> {
|
||||
const prevPort = this.port;
|
||||
await this.close();
|
||||
const kp = ssh2.utils.generateKeyPairSync('ed25519', { comment: 'mitm-host' });
|
||||
this.hostPrivateKey = kp.private;
|
||||
this.hostFingerprint = computeOpenSshFingerprint(kp.public.trim());
|
||||
const kp = generateValidEd25519KeyPair({ comment: 'mitm-host' });
|
||||
this.hostPrivateKey = kp.privateKey;
|
||||
this.hostFingerprint = kp.fingerprint;
|
||||
await this.start(prevPort);
|
||||
return this.hostFingerprint;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue