fix(tests): use high non-privileged ports in tests to avoid conflicts and CI failures

This commit is contained in:
2026-02-21 13:27:55 +00:00
parent d4739045cd
commit 9368226ce0
9 changed files with 55 additions and 48 deletions

View File

@@ -10,7 +10,7 @@ tap.test('setup socket handler test', async () => {
const routes: IRouteConfig[] = [{
name: 'echo-handler',
match: {
ports: 9999
ports: 47780
// No domains restriction - matches all connections
},
action: {
@@ -43,7 +43,7 @@ tap.test('should handle socket with custom function', async () => {
let response = '';
await new Promise<void>((resolve, reject) => {
client.connect(9999, 'localhost', () => {
client.connect(47780, 'localhost', () => {
console.log('Client connected to proxy');
resolve();
});
@@ -78,7 +78,7 @@ tap.test('should handle async socket handler', async () => {
// Update route with async handler
await proxy.updateRoutes([{
name: 'async-handler',
match: { ports: 9999 },
match: { ports: 47780 },
action: {
type: 'socket-handler',
socketHandler: async (socket, context) => {
@@ -108,7 +108,7 @@ tap.test('should handle async socket handler', async () => {
});
await new Promise<void>((resolve, reject) => {
client.connect(9999, 'localhost', () => {
client.connect(47780, 'localhost', () => {
// Send initial data to trigger the handler
client.write('test data\n');
resolve();
@@ -131,7 +131,7 @@ tap.test('should handle errors in socket handler', async () => {
// Update route with error-throwing handler
await proxy.updateRoutes([{
name: 'error-handler',
match: { ports: 9999 },
match: { ports: 47780 },
action: {
type: 'socket-handler',
socketHandler: (socket, context) => {
@@ -148,7 +148,7 @@ tap.test('should handle errors in socket handler', async () => {
});
await new Promise<void>((resolve, reject) => {
client.connect(9999, 'localhost', () => {
client.connect(47780, 'localhost', () => {
// Connection established - send data to trigger handler
client.write('trigger\n');
resolve();