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

fix(e2e): Use pagination in sentinel #1372

Merged
merged 3 commits into from
Nov 1, 2024
Merged

Conversation

elsand
Copy link
Member

@elsand elsand commented Nov 1, 2024

Description

This fixes the sentinel to clean all unpurged dialogs, not just the first 100

Related Issue(s)

  • #{issue number}

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of unpurged dialogs by implementing pagination, ensuring all dialogs are properly fetched and purged.
    • Enhanced error handling to provide clearer references to dialog IDs during purge failures.

@elsand elsand requested a review from a team as a code owner November 1, 2024 11:47
Copy link
Contributor

coderabbitai bot commented Nov 1, 2024

Warning

Rate limit exceeded

@elsand has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 4 minutes and 11 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 257b493 and d6f2fa8.

📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes in this pull request modify the functionality of a test case in tests/k6/common/sentinel.js. The implementation now incorporates pagination handling for fetching unpurged dialogs, utilizing a do...while loop and a continuationToken. The collected dialog IDs are stored in an array for purging, with updated error handling and assertions to ensure all dialogs have been purged.

Changes

File Change Summary
tests/k6/common/sentinel.js Modified test case to handle pagination for fetching dialogs, updated error handling, and assertions.

Possibly related PRs

Suggested reviewers

  • arealmaas

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@elsand elsand force-pushed the fix/improve-sentiel-purge branch from 81aeddc to 7cb04a8 Compare November 1, 2024 11:48
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (2)
tests/k6/common/sentinel.js (2)

11-13: Consider adding JSDoc type documentation for pagination variables.

For better code clarity and maintainability, consider documenting the types of these variables.

+/** @type {boolean} */
 let hasNextPage = false;
+/** @type {string} */
 let continuationToken = "";
+/** @type {string[]} */
 let dialogIdsToPurge = [];

41-42: Enhance assertion message for better test failure visibility.

The current assertion message could be more descriptive to help identify the issue faster.

-expect(dialogIdsToPurge.length, 'unpurged dialogs').to.equal(0);
+expect(dialogIdsToPurge.length, `${dialogIdsToPurge.length} dialogs were not properly cleaned up during tests`).to.equal(0);
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between c3b440a and 257b493.

📒 Files selected for processing (1)
  • tests/k6/common/sentinel.js (1 hunks)
🔇 Additional comments (1)
tests/k6/common/sentinel.js (1)

11-42: Implementation successfully addresses the pagination requirement.

The changes effectively solve the original issue of being limited to the first 100 dialogs. The implementation is solid with proper pagination handling, error checking, and cleanup verification.

tests/k6/common/sentinel.js Show resolved Hide resolved
tests/k6/common/sentinel.js Show resolved Hide resolved
tests/k6/common/sentinel.js Outdated Show resolved Hide resolved
oskogstad
oskogstad previously approved these changes Nov 1, 2024
Copy link

sonarqubecloud bot commented Nov 1, 2024

@elsand elsand merged commit a1df0ff into main Nov 1, 2024
3 checks passed
@elsand elsand deleted the fix/improve-sentiel-purge branch November 1, 2024 12:16
@coderabbitai coderabbitai bot mentioned this pull request Nov 1, 2024
4 tasks
arealmaas added a commit that referenced this pull request Nov 5, 2024
🤖 I have created a release *beep* *boop*
---


##
[1.28.0](v1.27.1...v1.28.0)
(2024-11-05)


### Features

* update swagger name generation
([#1350](#1350))
([94c5544](94c5544))
* **webapi:** Add ExternalReference to dialog search result
([#1384](#1384))
([431fe16](431fe16))
* **webapi:** Return 410 GONE for notification checks on deleted dialogs
([#1387](#1387))
([198bebd](198bebd))


### Bug Fixes

* Add system user id to identifying claims
([#1362](#1362))
([16f160d](16f160d))
* **e2e:** Use pagination in sentinel
([#1372](#1372))
([a1df0ff](a1df0ff))
* fixed placement of referenced workflow-file
([#1365](#1365))
([49c1d80](49c1d80))
* workaround for github number error in dispatch workflow
([#1367](#1367))
([06ee356](06ee356))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants