Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(core): Improve test-webhooks (no-changelog) #8069

Merged
merged 5 commits into from
Dec 19, 2023

Conversation

ivov
Copy link
Contributor

@ivov ivov commented Dec 18, 2023

Remove duplication, improve readability, and expand tests for TestWebhooks.ts - in anticipation for storing test webhooks in Redis.

@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels Dec 18, 2023
packages/cli/src/ActiveWebhooks.ts Outdated Show resolved Hide resolved
Copy link
Member

@netroy netroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this.
I'm seeing a bit of overlap between this and #7223, would like to cherry-pick some bits out of that PR in here if possible.

packages/cli/src/errors/id-less-workflow.error.ts Outdated Show resolved Hide resolved
packages/cli/src/TestWebhooks.ts Outdated Show resolved Hide resolved
Comment on lines +71 to +74
let path = request.params.path.endsWith('/')
? request.params.path.slice(0, -1)
: request.params.path;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

considering that we do this for test and prod webhooks, maybe we should move this bit to WebhookHelpers.webhookRequestHandler, and start passing a context object into executeWebhook calls.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not quite familiar yet with WebhookHelpers to address quickly, I'll come back to this later if needed.

@ivov
Copy link
Contributor Author

ivov commented Dec 18, 2023

Thanks for doing this. I'm seeing a bit of overlap between this and #7223, would like to cherry-pick some bits out of that PR in here if possible.

Please go ahead!

Copy link
Member

@netroy netroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

besides the one comment, LGTM.

packages/workflow/src/Workflow.ts Outdated Show resolved Hide resolved
Copy link
Member

@netroy netroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏽

Copy link

cypress bot commented Dec 19, 2023

2 flaky tests on run #3416 ↗︎

0 313 5 0 Flakiness 2

Details:

🌳 🖥️ browsers:node18.12.0-chrome107 🤖 ivov 🗃️ e2e/*
Project: n8n Commit: b46e91b7fd
Status: Passed Duration: 06:57 💡
Started: Dec 19, 2023 4:22 PM Ended: Dec 19, 2023 4:29 PM
Flakiness  16-webhook-node.cy.ts • 1 flaky test

View Output Video

Test Artifacts
Webhook Trigger node > should listen for a GET request and respond with an empty body Screenshots Video
Flakiness  17-sharing.cy.ts • 1 flaky test

View Output Video

Test Artifacts
Sharing > should work for admin role on credentials created by others (also can share it with themselves) Screenshots Video

Review all test suite changes for PR #8069 ↗︎

Copy link
Contributor

✅ All Cypress E2E specs passed

@ivov ivov merged commit 9dc491c into master Dec 19, 2023
19 checks passed
@ivov ivov deleted the improve-test-webhooks branch December 19, 2023 16:32
MiloradFilipovic added a commit that referenced this pull request Dec 21, 2023
* master: (22 commits)
  fix(editor): Make keyboard shortcuts more strict; don't accept extra Ctrl/Alt/Shift keys (#8024)
  fix(core):  Downgrade Rudderstack SDK (no-changelog) (#8107)
  fix(editor): Move versions check to init function and refactor store (no-changelog) (#8067)
  refactor(editor): Add telemetry for SSO/SAML (no-changelog) (#8102)
  fix(editor): Ensure execution data overrides pinned data when copying in executions view (#8009)
  fix(editor): Fix copy/paste issue when switch node is in workflow (#8103)
  feat(editor): Upgrade frontend tooling to address a few vulnerabilities (#8100)
  feat(editor): De-duplicate frontend devDependencies (no-changelog) (#8094)
  refactor(core): Improve test-webhooks (no-changelog) (#8069)
  refactor: Add telemetry for RBAC (no-changelog) (#8056)
  feat(core): Upgrade Rudderstack SDK (no-changelog) (#8090)
  fix: Upgrade axios to address CVE-2023-45857 (#7713)
  fix(core): Do not display error when stopping jobless execution in queue mode (#8007)
  feat(editor): Gracefully ignore invalid payloads in postMessage handler (#8096)
  feat(editor): Add lead enrichment suggestions to workflow list (#8042)
  refactor(Discord Node): Stop reporting to Sentry inaccessible guild error (no-changelog) (#8095)
  feat: Add opt-in enterprise license trial checkbox (no-changelog) (#7826)
  ci: Remove unnecessary async/await, enable await-thenable linting rule (no-changelog) (#8076)
  refactor(editor): Add telemetry for log streaming (no-changelog) (#8075)
  fix(core): Use relative imports for dynamic imports in SecurityAuditService (#8086)
  ...
@janober
Copy link
Member

janober commented Dec 21, 2023

Got released with [email protected]

netroy added a commit that referenced this pull request Dec 28, 2023
…o-changelog) (#8171)

## Summary
This PR continues refactoring webhooks code for better modularity.
Continued from #8069 to bring back `ActiveWebhooks`, but this time
actually handling active webhook calls in this class.

## Review / Merge checklist
- [x] PR title and summary are descriptive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team Released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants