Skip to content

Conversation

@rahim-kanji
Copy link
Collaborator

@rahim-kanji rahim-kanji commented Jan 12, 2026

(same as title)

Summary by CodeRabbit

  • Tests
    • Modified test setup and cleanup to use an alternative (proxy) connection configuration.
    • Added an early exit in tests when a specific environment flag is detected.
    • Left administrative/statistics actions unchanged; no user-facing functionality changes.

✏️ Tip: You can customize this high-level summary in your review settings.

@gemini-code-assist
Copy link

Summary of Changes

Hello @rahim-kanji, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves an issue within the reg_test_5233_set_warning-t test by ensuring that all database interactions within the test are routed through the intended proxy connection. This correction is crucial for accurately simulating real-world scenarios where client applications interact with the database via the proxy, thus improving the reliability and relevance of the test results.

Highlights

  • Test Connection Correction: The reg_test_5233_set_warning-t.cpp test has been updated to use the proxy connection for all database and table manipulation queries, including creation, insertion, and cleanup. Previously, these operations were incorrectly performed using the admin connection.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Jan 12, 2026

📝 Walkthrough

Walkthrough

Test reg_test_5233_set_warning was updated to perform setup and cleanup SQL via the proxy connection (instead of admin), added an early exit when cl.getEnv() is true before connecting, and retained existing admin-side actions like PROXYSQL FLUSH STATS.

Changes

Cohort / File(s) Summary
Test file
test/tap/tests/reg_test_5233_set_warning-t.cpp
Switched setup SQL (CREATE DATABASE, USE, CREATE TABLE, INSERT) and cleanup (DROP TABLE) to use the proxy connection; added early exit if cl.getEnv() is true prior to establishing connections; left remaining admin-side actions (e.g., PROXYSQL FLUSH STATS) unchanged.

Sequence Diagram(s)

(omitted — change is a test connection-target swap and minor control-flow tweak, not a multi-component new feature)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 I hopped from admin fields to proxy lanes,
Snuck setup rows through gentler plains,
If env says stop, I pause my run,
Cleanup done beneath the sun,
Little rabbit tests—now neatly spun.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix: reg_test_5233_set_warning-t' directly references the test file being modified and indicates a bug fix, but lacks detail about the actual change made.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly fixes the regression test reg_test_5233_set_warning-t by redirecting the database setup and cleanup queries from the admin connection to the proxy connection. This ensures that DDL and DML statements are properly handled by the proxy and executed on the backend database. I have included one suggestion to improve the robustness of the test setup, addressing a potential failure point in clean environments.

Comment on lines +102 to +106
MYSQL_QUERY(proxy, "CREATE DATABASE IF NOT EXISTS test");
MYSQL_QUERY(proxy, "USE test");

Choose a reason for hiding this comment

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

medium

While correctly changing the connection from admin to proxy for these queries, there is a latent issue with the test's setup. The proxy connection is established on line 91 by connecting directly to the test database. If this database does not exist, mysql_real_connect will fail, and the test will terminate before this CREATE DATABASE statement can be executed.

To ensure the test is robust and can run in an environment where the test database doesn't already exist, you should consider modifying the connection logic on line 91 to connect without a specific database (using NULL for the database name). This would allow the CREATE DATABASE and USE statements here to function as intended.

Copy link

@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: 0

🧹 Nitpick comments (1)
test/tap/tests/reg_test_5233_set_warning-t.cpp (1)

102-105: LGTM! Correct fix to use proxy for MySQL DDL/DML.

Using the proxy connection instead of admin is the right approach—admin is for ProxySQL configuration, while proxy forwards queries to the MySQL backend.

Minor note: Line 103 (USE test) is redundant since the proxy connection at line 91 already specifies "test" as the default database.

Optional: Remove redundant USE statement
     MYSQL_QUERY(proxy, "CREATE DATABASE IF NOT EXISTS test");
-    MYSQL_QUERY(proxy, "USE test");
     MYSQL_QUERY(proxy, "CREATE TABLE IF NOT EXISTS setting (setting_id VARCHAR(100) PRIMARY KEY, value VARCHAR(100))");
     MYSQL_QUERY(proxy, "INSERT IGNORE INTO setting (setting_id, value) VALUES ('foo', '1.0')");
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7e9e009 and 45a8aa3.

📒 Files selected for processing (1)
  • test/tap/tests/reg_test_5233_set_warning-t.cpp
🔇 Additional comments (1)
test/tap/tests/reg_test_5233_set_warning-t.cpp (1)

210-210: LGTM!

Cleanup correctly uses the proxy connection, consistent with the setup changes.

@rahim-kanji rahim-kanji force-pushed the v3.0_fix_reg_test_5233_set_warning-t_test branch from 45a8aa3 to b9175f8 Compare January 12, 2026 15:23
@sonarqubecloud
Copy link

Copy link

@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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
test/tap/tests/reg_test_5233_set_warning-t.cpp (1)

94-98: Missing mysql_close(proxy) on connection failure.

When mysql_real_connect fails for the proxy connection, only admin is closed. The proxy handle was already initialized via mysql_init on line 86 and should also be closed to avoid a resource leak.

Suggested fix
     if (!mysql_real_connect(proxy, cl.host, cl.username, cl.password, "test", cl.port, NULL, CLIENT_MULTI_STATEMENTS)) {
         diag("Failed to connect to ProxySQL proxy: %s", mysql_error(proxy));
+        mysql_close(proxy);
         mysql_close(admin);
         return exit_status();
     }
🧹 Nitpick comments (1)
test/tap/tests/reg_test_5233_set_warning-t.cpp (1)

105-108: Minor: USE test is redundant.

The proxy connection is already established with the "test" database on line 94, making the USE test statement on line 106 unnecessary.

Suggested fix
     MYSQL_QUERY(proxy, "CREATE DATABASE IF NOT EXISTS test");
-    MYSQL_QUERY(proxy, "USE test");
     MYSQL_QUERY(proxy, "CREATE TABLE IF NOT EXISTS setting (setting_id VARCHAR(100) PRIMARY KEY, value VARCHAR(100))");
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 45a8aa3 and b9175f8.

📒 Files selected for processing (1)
  • test/tap/tests/reg_test_5233_set_warning-t.cpp
🔇 Additional comments (2)
test/tap/tests/reg_test_5233_set_warning-t.cpp (2)

69-71: LGTM!

The early exit when cl.getEnv() fails is correctly placed before any resource allocation (connections), preventing potential resource leaks and following the typical pattern for ProxySQL test initialization.


213-216: LGTM!

The cleanup correctly uses the proxy connection (consistent with setup) and properly closes both connections afterward.

@rahim-kanji rahim-kanji changed the title Fixed reg_test_5233_set_warning-t Fix: reg_test_5233_set_warning-t Jan 12, 2026
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