This commit is contained in:
2025-05-29 12:54:31 +00:00
parent ab1ea95070
commit 30ff3b7d8a
7 changed files with 36 additions and 180 deletions

View File

@ -19,7 +19,7 @@ tap.test('should defer certificate provisioning until after ports are listening'
// Create proxy with ACME certificate requirement
const proxy = new SmartProxy({
useHttpProxy: [acmePort],
httpProxyPort: 8844,
httpProxyPort: 8845, // Use different port to avoid conflicts
acme: {
email: 'test@test.local',
useProduction: false,
@ -56,21 +56,12 @@ tap.test('should defer certificate provisioning until after ports are listening'
return result;
};
// Track certificate provisioning
const originalProvisionAll = proxy['certManager'] ?
proxy['certManager']['provisionAllCertificates'] : null;
// Track that we created a certificate manager and SmartProxy will call provisionAllCertificates
let certManagerCreated = false;
if (proxy['certManager']) {
proxy['certManager']['provisionAllCertificates'] = async function() {
operationLog.push('Starting certificate provisioning');
// Check if port 80 is listening
if (!port80Listening) {
operationLog.push('ERROR: Certificate provisioning started before ports ready');
}
// Don't actually provision certificates in the test
operationLog.push('Certificate provisioning completed');
};
}
// Override createCertificateManager to set up our tracking
const originalCreateCertManager = (proxy as any).createCertificateManager;
(proxy as any).certManagerCreated = false;
// Mock certificate manager to avoid real ACME initialization
(proxy as any).createCertificateManager = async function() {
@ -81,17 +72,21 @@ tap.test('should defer certificate provisioning until after ports are listening'
setGlobalAcmeDefaults: () => {},
setAcmeStateManager: () => {},
initialize: async () => {
operationLog.push('Certificate manager initialized');
},
provisionAllCertificates: async () => {
operationLog.push('Starting certificate provisioning');
if (!port80Listening) {
operationLog.push('ERROR: Certificate provisioning started before ports ready');
}
operationLog.push('Certificate provisioning completed');
},
provisionAllCertificates: async () => {},
stop: async () => {},
getAcmeOptions: () => ({ email: 'test@test.local', useProduction: false }),
getState: () => ({ challengeRouteActive: false })
};
certManagerCreated = true;
(proxy as any).certManager = mockCertManager;
return mockCertManager;
};
@ -120,7 +115,7 @@ tap.test('should have ACME challenge route ready before certificate provisioning
const proxy = new SmartProxy({
useHttpProxy: [8080],
httpProxyPort: 8844,
httpProxyPort: 8846, // Use different port to avoid conflicts
acme: {
email: 'test@test.local',
useProduction: false,