update
This commit is contained in:
@ -1,16 +1,15 @@
|
||||
import { tap, expect } from '@git.zone/tstest/tapbundle';
|
||||
import { startTestServer, stopTestServer, type ITestServer } from '../../helpers/server.loader.js';
|
||||
import { startTestServer, stopTestServer, type ITestServer } from '../server.loader.js';
|
||||
import type { SmtpServer } from '../../../ts/mail/delivery/smtpserver/index.js';
|
||||
import { createConcurrentConnections, performSmtpHandshake, closeSmtpConnection } from '../../helpers/test.utils.js';
|
||||
|
||||
let testServer: ITestServer;
|
||||
let testServer: SmtpServer;
|
||||
const CONCURRENT_COUNT = 10;
|
||||
|
||||
tap.test('setup - start SMTP server', async () => {
|
||||
testServer = await startTestServer({
|
||||
port: 2526,
|
||||
maxConnections: 100
|
||||
});
|
||||
expect(testServer).toBeInstanceOf(Object);
|
||||
testServer = await startTestServer();
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
expect(testServer.port).toEqual(2526);
|
||||
});
|
||||
|
||||
@ -69,12 +68,10 @@ tap.test('CM-02: Connection limit enforcement - verify max connections', async (
|
||||
const maxConnections = 5;
|
||||
|
||||
// Start a new server with lower connection limit
|
||||
const limitedServer = await startTestServer({
|
||||
port: 2527,
|
||||
maxConnections: maxConnections
|
||||
});
|
||||
const limitedServer = await startTestServer();
|
||||
|
||||
try {
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));try {
|
||||
// Try to create more connections than allowed
|
||||
const attemptCount = maxConnections + 5;
|
||||
console.log(`🔄 Attempting ${attemptCount} connections (limit: ${maxConnections})...`);
|
||||
@ -104,7 +101,7 @@ tap.test('CM-02: Connection limit enforcement - verify max connections', async (
|
||||
});
|
||||
|
||||
tap.test('cleanup - stop SMTP server', async () => {
|
||||
await stopTestServer(testServer);
|
||||
await stopTestServer();
|
||||
console.log('✅ Test server stopped');
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user