Skip to content

fix: fixed mysql plugin tests by closing the connections#36657

Merged
NilanshBansal merged 5 commits intoreleasefrom
fix/issue-36656/mysql-max-connections
Oct 2, 2024
Merged

fix: fixed mysql plugin tests by closing the connections#36657
NilanshBansal merged 5 commits intoreleasefrom
fix/issue-36656/mysql-max-connections

Conversation

@NilanshBansal
Copy link
Contributor

@NilanshBansal NilanshBansal commented Oct 2, 2024

Description

  • This PR fixes the MySql plugin server unit tests which started to fail after increasing the max connection pool size from 5 to 20. The failures were due to the Too Many Connections error because of the connections not getting closed.
  • In this PR, I have added the code to close connections after each test is executed.

Fixes #36656

Automation

/ok-to-test tags="@tag.Sanity"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/11147034776
Commit: 3b9f579
Cypress dashboard.
Tags: @tag.Sanity
Spec:


Wed, 02 Oct 2024 16:20:15 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

Summary by CodeRabbit

  • Bug Fixes

    • Updated the expected default value for the maximum connection pool size in tests to ensure accuracy.
  • Chores

    • Improved management of MySQL connection context to prevent resource leaks in tests.

@NilanshBansal NilanshBansal self-assigned this Oct 2, 2024
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 2, 2024

Warning

Rate limit exceeded

@NilanshBansal has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 22 minutes and 34 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

Files that changed from the base of the PR and between 25da840 and 3b9f579.

Walkthrough

The pull request introduces modifications to the testing classes for the MySQL plugin and connection pool configuration. In MySqlPluginTest, enhancements are made to manage the MySQL connection context more effectively during tests, including the addition of a cleanup method to prevent resource leaks. In ConnectionPoolConfigCETest, the expected default value for the maximum connection pool size is adjusted from 20 to 5. These changes aim to ensure that tests run smoothly without exceeding connection limits.

Changes

File Change Summary
app/server/appsmith-plugins/mysqlPlugin/src/test/java/com/external/plugins/MySqlPluginTest.java Added instanceConnectionContext variable; introduced cleanup method; updated multiple tests for connection context management.
app/server/appsmith-server/src/test/java/com/appsmith/server/connectionpoolconfig/configurations/ConnectionPoolConfigCETest.java Changed expected default max connection pool size from 20 to 5 in the test assertion.

Assessment against linked issues

Objective Addressed Explanation
Update MySQL connection management to prevent test failures (#[36656])
Adjust connection pool size to prevent test failures (#[36656])

Possibly related PRs

Suggested reviewers

  • nidhi-nair
  • AnaghHegde
  • sondermanish

In the realm of code where tests do dwell,
A tweak to MySQL, we know it well.
With connections set high, they’ll no longer fail,
And the pool size adjusted, we’ll surely prevail.
So let’s raise a cheer for the changes made,
In the world of testing, our fears will fade! 🎉


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.

@github-actions github-actions bot added Bug Something isn't working Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. Integrations Pod Integrations Product Issues related to a specific integration Medium Issues that frustrate users due to poor UX Needs Triaging Needs attention from maintainers to triage Query & JS Pod Issues related to the query & JS Pod Release labels Oct 2, 2024
@NilanshBansal NilanshBansal added the ok-to-test Required label for CI label Oct 2, 2024
subrata71
subrata71 previously approved these changes Oct 2, 2024
Copy link
Collaborator

@subrata71 subrata71 left a comment

Choose a reason for hiding this comment

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

Pending justification. Else LGTM

@NilanshBansal NilanshBansal changed the title fix: fixed mysql plugin tests by increasing the max connections fix: fixed mysql plugin tests by closing the connections Oct 2, 2024
NilanshBansal and others added 2 commits October 2, 2024 21:05
…rnal/plugins/MySqlPluginTest.java

Co-authored-by: Manish Kumar <107841575+sondermanish@users.noreply.github.com>
@NilanshBansal NilanshBansal merged commit 25e83f6 into release Oct 2, 2024
@NilanshBansal NilanshBansal deleted the fix/issue-36656/mysql-max-connections branch October 2, 2024 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. Integrations Pod Integrations Product Issues related to a specific integration Medium Issues that frustrate users due to poor UX Needs Triaging Needs attention from maintainers to triage ok-to-test Required label for CI Query & JS Pod Issues related to the query & JS Pod Release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: MySQL Plugin Server Tests Failing

3 participants