fix(tests): use high non-privileged ports in tests to avoid conflicts and CI failures
This commit is contained in:
@@ -24,8 +24,8 @@ tap.test('setup test servers', async () => {
|
||||
});
|
||||
|
||||
await new Promise<void>((resolve) => {
|
||||
testServer.listen(7001, '127.0.0.1', () => {
|
||||
console.log('TCP test server listening on port 7001');
|
||||
testServer.listen(47712, '127.0.0.1', () => {
|
||||
console.log('TCP test server listening on port 47712');
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
@@ -45,8 +45,8 @@ tap.test('setup test servers', async () => {
|
||||
);
|
||||
|
||||
await new Promise<void>((resolve) => {
|
||||
tlsTestServer.listen(7002, '127.0.0.1', () => {
|
||||
console.log('TLS test server listening on port 7002');
|
||||
tlsTestServer.listen(47713, '127.0.0.1', () => {
|
||||
console.log('TLS test server listening on port 47713');
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
@@ -60,13 +60,13 @@ tap.test('should forward TCP connections correctly', async () => {
|
||||
{
|
||||
name: 'tcp-forward',
|
||||
match: {
|
||||
ports: 8080,
|
||||
ports: 47710,
|
||||
},
|
||||
action: {
|
||||
type: 'forward',
|
||||
targets: [{
|
||||
host: '127.0.0.1',
|
||||
port: 7001,
|
||||
port: 47712,
|
||||
}],
|
||||
},
|
||||
},
|
||||
@@ -77,7 +77,7 @@ tap.test('should forward TCP connections correctly', async () => {
|
||||
|
||||
// Test TCP forwarding
|
||||
const client = await new Promise<net.Socket>((resolve, reject) => {
|
||||
const socket = net.connect(8080, '127.0.0.1', () => {
|
||||
const socket = net.connect(47710, '127.0.0.1', () => {
|
||||
console.log('Connected to proxy');
|
||||
resolve(socket);
|
||||
});
|
||||
@@ -106,7 +106,7 @@ tap.test('should handle TLS passthrough correctly', async () => {
|
||||
{
|
||||
name: 'tls-passthrough',
|
||||
match: {
|
||||
ports: 8443,
|
||||
ports: 47711,
|
||||
domains: 'test.example.com',
|
||||
},
|
||||
action: {
|
||||
@@ -116,7 +116,7 @@ tap.test('should handle TLS passthrough correctly', async () => {
|
||||
},
|
||||
targets: [{
|
||||
host: '127.0.0.1',
|
||||
port: 7002,
|
||||
port: 47713,
|
||||
}],
|
||||
},
|
||||
},
|
||||
@@ -129,7 +129,7 @@ tap.test('should handle TLS passthrough correctly', async () => {
|
||||
const client = await new Promise<tls.TLSSocket>((resolve, reject) => {
|
||||
const socket = tls.connect(
|
||||
{
|
||||
port: 8443,
|
||||
port: 47711,
|
||||
host: '127.0.0.1',
|
||||
servername: 'test.example.com',
|
||||
rejectUnauthorized: false,
|
||||
@@ -164,7 +164,7 @@ tap.test('should handle SNI-based forwarding', async () => {
|
||||
{
|
||||
name: 'domain-a',
|
||||
match: {
|
||||
ports: 8443,
|
||||
ports: 47711,
|
||||
domains: 'a.example.com',
|
||||
},
|
||||
action: {
|
||||
@@ -174,14 +174,14 @@ tap.test('should handle SNI-based forwarding', async () => {
|
||||
},
|
||||
targets: [{
|
||||
host: '127.0.0.1',
|
||||
port: 7002,
|
||||
port: 47713,
|
||||
}],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'domain-b',
|
||||
match: {
|
||||
ports: 8443,
|
||||
ports: 47711,
|
||||
domains: 'b.example.com',
|
||||
},
|
||||
action: {
|
||||
@@ -191,7 +191,7 @@ tap.test('should handle SNI-based forwarding', async () => {
|
||||
},
|
||||
targets: [{
|
||||
host: '127.0.0.1',
|
||||
port: 7002,
|
||||
port: 47713,
|
||||
}],
|
||||
},
|
||||
},
|
||||
@@ -204,7 +204,7 @@ tap.test('should handle SNI-based forwarding', async () => {
|
||||
const clientA = await new Promise<tls.TLSSocket>((resolve, reject) => {
|
||||
const socket = tls.connect(
|
||||
{
|
||||
port: 8443,
|
||||
port: 47711,
|
||||
host: '127.0.0.1',
|
||||
servername: 'a.example.com',
|
||||
rejectUnauthorized: false,
|
||||
@@ -231,7 +231,7 @@ tap.test('should handle SNI-based forwarding', async () => {
|
||||
const clientB = await new Promise<tls.TLSSocket>((resolve, reject) => {
|
||||
const socket = tls.connect(
|
||||
{
|
||||
port: 8443,
|
||||
port: 47711,
|
||||
host: '127.0.0.1',
|
||||
servername: 'b.example.com',
|
||||
rejectUnauthorized: false,
|
||||
|
||||
Reference in New Issue
Block a user