refactor(core)!: Remove webhook deregistration at startup and shutdown (#7515)

https://linear.app/n8n/issue/PAY-932/deprecate-flag-to-skip-webhook-deregistration-on-shutdown
This commit is contained in:
Iván Ovejero
2023-10-26 14:37:54 +02:00
committed by GitHub
parent 5477e3fb45
commit ae8c7a635e
8 changed files with 19 additions and 75 deletions

View File

@@ -160,7 +160,6 @@ describe('ActiveWorkflowRunner', () => {
await activeWorkflowRunner.init();
expect(await activeWorkflowRunner.getActiveWorkflows()).toHaveLength(0);
expect(mocked(Db.collections.Workflow.find)).toHaveBeenCalled();
expect(webhookService.deleteInstanceWebhooks).toHaveBeenCalled();
expect(externalHooks.run).toHaveBeenCalledTimes(1);
});
@@ -171,7 +170,6 @@ describe('ActiveWorkflowRunner', () => {
databaseActiveWorkflowsCount,
);
expect(mocked(Db.collections.Workflow.find)).toHaveBeenCalled();
expect(webhookService.deleteInstanceWebhooks).toHaveBeenCalled();
expect(externalHooks.run).toHaveBeenCalled();
});

View File

@@ -150,30 +150,6 @@ describe('WebhookService', () => {
});
});
describe('deleteInstanceWebhooks()', () => {
test('should delete all webhooks of the instance', async () => {
const mockInstanceWebhooks = [
createWebhook('PUT', 'users'),
createWebhook('GET', 'user/:id'),
createWebhook('POST', ':var'),
];
webhookRepository.find.mockResolvedValue(mockInstanceWebhooks);
await webhookService.deleteInstanceWebhooks();
expect(webhookRepository.remove).toHaveBeenCalledWith(mockInstanceWebhooks);
});
test('should not delete any webhooks if none found', async () => {
webhookRepository.find.mockResolvedValue([]);
await webhookService.deleteInstanceWebhooks();
expect(webhookRepository.remove).toHaveBeenCalledWith([]);
});
});
describe('deleteWorkflowWebhooks()', () => {
test('should delete all webhooks of the workflow', async () => {
const mockWorkflowWebhooks = [