Skip to content

chore: add test afterAll timeout to wait for message processing#73

Merged
SirSimon04 merged 7 commits intomainfrom
test-tests
Apr 2, 2026
Merged

chore: add test afterAll timeout to wait for message processing#73
SirSimon04 merged 7 commits intomainfrom
test-tests

Conversation

@SirSimon04
Copy link
Copy Markdown
Contributor

Have you...

  • Added relevant entry to the change log?

Copy link
Copy Markdown
Contributor

@hyperspace-insights hyperspace-insights bot left a comment

Choose a reason for hiding this comment

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

The PR adds afterAll(() => (cds as any).flush()) to every inner describe block, but an identical afterAll already exists at the outer describe level — this is a meaningful duplication that risks flushing shared CDS state mid-suite, potentially corrupting isolation between subsequent inner suites. The single outer-level cleanup (already present and matching the pattern in programmaticApproach.test.ts) is sufficient; all six newly added inner afterAll blocks should be removed.

PR Bot Information

Version: 1.19.15 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback

  • LLM: anthropic--claude-4.6-sonnet
  • Correlation ID: a6ba57b0-2dd5-11f1-9976-f874771d4ccc
  • Event Trigger: pull_request.opened
  • File Content Strategy: Full file content

Comment thread tests/integration/genericProgrammaticApproach.test.ts Outdated
@SirSimon04 SirSimon04 reopened this Apr 1, 2026
@SirSimon04 SirSimon04 changed the title do not merge, try out chore: add test afterAll timeout to wait for message processing Apr 2, 2026
@SirSimon04 SirSimon04 marked this pull request as ready for review April 2, 2026 12:03
@SirSimon04 SirSimon04 requested a review from a team as a code owner April 2, 2026 12:03
@hyperspace-insights
Copy link
Copy Markdown
Contributor

Summary

The following content is AI-generated and provides a summary of the pull request:


Add afterAll Timeout to Ensure Message Processing Completion in Tests

Chore

🔧 Added a 5-second delay in afterAll hooks across all test files to ensure pending outbox messages are fully processed before test teardown completes.

Changes

All modified test files follow the same pattern — a await new Promise((resolve) => setTimeout(resolve, 5000)) delay is appended after (cds as any).flush() in the afterAll hook to allow asynchronous message processing to finish gracefully.

  • tests/hybrid/annotationApproach.test.ts: Added a new afterAll block with cds.flush() and a 5-second timeout.
  • tests/hybrid/programmaticApproach.test.ts: Added a new afterAll block with cds.flush() and a 5-second timeout.
  • tests/integration/annotations/businessKey.test.ts: Added 5-second delay after cds.flush() in existing afterAll.
  • tests/integration/annotations/customEvents.test.ts: Added 5-second delay after cds.flush() in existing afterAll.
  • tests/integration/annotations/deleteMultiEvent.test.ts: Added 5-second delay after cds.flush() in existing afterAll.
  • tests/integration/annotations/draftAnnotation.test.ts: Added 5-second delay after cds.flush() in existing afterAll.
  • tests/integration/annotations/isolated.test.ts: Added 5-second delay after cds.flush() in existing afterAll.
  • tests/integration/annotations/lifeCycleAnnotation.test.ts: Added 5-second delay after cds.flush() in existing afterAll.
  • tests/integration/annotations/multipleStartAnnotations.test.ts: Added 5-second delay after cds.flush() in existing afterAll.
  • tests/integration/annotations/processStart-input.test.ts: Added 5-second delay after cds.flush() in existing afterAll.
  • tests/integration/annotations/wildcardEvents.test.ts: Added 5-second delay after cds.flush() in existing afterAll.
  • tests/integration/genericProgrammaticApproach.test.ts: Added 5-second delay after cds.flush() in existing afterAll.
  • tests/integration/programmaticApproach.test.ts: Added 5-second delay after cds.flush() in existing afterAll.

  • 🔄 Regenerate and Update Summary
  • ✏️ Insert as PR Description (deletes this comment)
  • 🗑️ Delete comment
PR Bot Information

Version: 1.20.0 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback

  • Output Template: Default Template
  • Correlation ID: f8334f00-2e8b-11f1-8f7d-1eb808c4982c
  • Event Trigger: pull_request.ready_for_review
  • Summary Prompt: Default Prompt
  • LLM: anthropic--claude-4.6-sonnet
  • File Content Strategy: Full file content

💌 Have ideas or want to contribute? Create an issue and share your thoughts with us!
📑 Check out the documentation for more information.
📬 Subscribe to the Hyperspace PR Bot DL to get the latest announcements and pilot features!

Made with ❤️ by Hyperspace.

Copy link
Copy Markdown
Contributor

@hyperspace-insights hyperspace-insights bot left a comment

Choose a reason for hiding this comment

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

The PR adds an identical afterAll teardown block to 13 test files — calling cds.flush() followed by a hard-coded 5-second setTimeout. While the intent (letting async message processing finish before the process exits) is sound, the implementation has a maintainability concern: the magic number 5000 is duplicated across all files and the overall approach is non-deterministic. A single shared utility (or at least a named constant) would make the timeout easier to adjust and signal intent more clearly. No functional correctness bugs were found beyond that concern.

PR Bot Information

Version: 1.20.0 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback

  • Event Trigger: pull_request.ready_for_review
  • LLM: anthropic--claude-4.6-sonnet
  • File Content Strategy: Full file content
  • Correlation ID: f8334f00-2e8b-11f1-8f7d-1eb808c4982c

Comment thread tests/hybrid/annotationApproach.test.ts
Copy link
Copy Markdown
Contributor

@Kronprinz03 Kronprinz03 left a comment

Choose a reason for hiding this comment

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

LGTM

@SirSimon04 SirSimon04 merged commit c3fdf05 into main Apr 2, 2026
12 checks passed
@SirSimon04 SirSimon04 deleted the test-tests branch April 2, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants