fix(smartproxy): improve certificate manager mocking in tests, enhance IPv6 validation, and record initial bytes for connection metrics
This commit is contained in:
@@ -56,6 +56,7 @@ tap.test('should preserve route update callback after updateRoutes', async () =>
|
||||
setHttpProxy: function() {},
|
||||
setGlobalAcmeDefaults: function() {},
|
||||
setAcmeStateManager: function() {},
|
||||
setRoutes: function(routes: any) {},
|
||||
initialize: async function() {
|
||||
// This is where the callback is actually set in the real implementation
|
||||
return Promise.resolve();
|
||||
@@ -116,6 +117,7 @@ tap.test('should preserve route update callback after updateRoutes', async () =>
|
||||
setHttpProxy: function() {},
|
||||
setGlobalAcmeDefaults: function() {},
|
||||
setAcmeStateManager: function() {},
|
||||
setRoutes: function(routes: any) {},
|
||||
initialize: async function() {},
|
||||
provisionAllCertificates: async function() {},
|
||||
stop: async function() {},
|
||||
@@ -126,12 +128,12 @@ tap.test('should preserve route update callback after updateRoutes', async () =>
|
||||
return { challengeRouteActive: false };
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Set the callback as done in createCertificateManager
|
||||
newMockCertManager.setUpdateRoutesCallback(async (routes: any) => {
|
||||
await this.updateRoutes(routes);
|
||||
});
|
||||
|
||||
|
||||
(this as any).certManager = newMockCertManager;
|
||||
await (this as any).certManager.initialize();
|
||||
}
|
||||
@@ -236,6 +238,7 @@ tap.test('should handle route updates when cert manager is not initialized', asy
|
||||
},
|
||||
updateRoutesCallback: null,
|
||||
setHttpProxy: function() {},
|
||||
setRoutes: function(routes: any) {},
|
||||
initialize: async function() {},
|
||||
provisionAllCertificates: async function() {},
|
||||
stop: async function() {},
|
||||
@@ -246,9 +249,9 @@ tap.test('should handle route updates when cert manager is not initialized', asy
|
||||
return { challengeRouteActive: false };
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
(this as any).certManager = mockCertManager;
|
||||
|
||||
|
||||
// Set the callback
|
||||
mockCertManager.setUpdateRoutesCallback(async (routes: any) => {
|
||||
await this.updateRoutes(routes);
|
||||
@@ -299,6 +302,7 @@ tap.test('real code integration test - verify fix is applied', async () => {
|
||||
setHttpProxy: function() {},
|
||||
setGlobalAcmeDefaults: function() {},
|
||||
setAcmeStateManager: function() {},
|
||||
setRoutes: function(routes: any) {},
|
||||
initialize: async function() {},
|
||||
provisionAllCertificates: async function() {},
|
||||
stop: async function() {},
|
||||
@@ -309,7 +313,7 @@ tap.test('real code integration test - verify fix is applied', async () => {
|
||||
return initialState || { challengeRouteActive: false };
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Always set up the route update callback for ACME challenges
|
||||
mockCertManager.setUpdateRoutesCallback(async (routes) => {
|
||||
await this.updateRoutes(routes);
|
||||
|
||||
Reference in New Issue
Block a user