-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Pass SSL config when checking connection to external mysql instance #18481
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
base: main
Are you sure you want to change the base?
Pass SSL config when checking connection to external mysql instance #18481
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
@chrisplim Are you able to add a test for this as well? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #18481 +/- ##
==========================================
- Coverage 67.50% 67.48% -0.02%
==========================================
Files 1607 1607
Lines 263093 263102 +9
==========================================
- Hits 177593 177554 -39
- Misses 85500 85548 +48 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@dbussink I'll write one today |
Signed-off-by: Christopher Lim <[email protected]>
@dbussink Hi, I was planning on making an endtoend test for this. Is there some existing test that I can use some existing patterns and fixtures from? It seems like there's no test that sets up an external mysql instance requiring SSL connections. |
Signed-off-by: Christopher Lim <[email protected]>
261abf0
to
ea3ed2e
Compare
@dbussink Added an endtoend test |
// 2. When a MySQL instance does require SSL connections and SSL config is configured in the TabletConfig DB config, there's no error | ||
// 3. When a MySQL instance does not require SSL connections, and no SSL config is configured in the TabletConfig DB config, there's no error | ||
// 4. When a MySQL instance does require SSL connections, but no SSL config is configured in the TabletConfig DB config, there's an error | ||
func TestUnmanagedMysqlSSLConnection(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might have to guard these new tests with a version check, since we also run endtoend tests against older versions for compatibility checks but that would fail here then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Signed-off-by: Christopher Lim <[email protected]>
Signed-off-by: Christopher Lim <[email protected]>
// when creating the mysql.ConnParams structure and calling mysql.Connect | ||
}) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chrisplim Do we really need all the things from this test? Can we create a much more focussed test on the actual issue here instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to be thorough in testing the different scenarios of my change. I need some help in what a good, focused test would be.
Can you please be a bit more specific in what I should be changing?
-
Should I reduce the number of test scenarios down to only these?
-
// 2. When a MySQL instance does require SSL connections and SSL config is configured in the TabletConfig DB config, there's no error
// 4. When a MySQL instance does require SSL connections, but no SSL config is configured in the TabletConfig DB config, there's an error
-
-
Should I be setting up the test a different way?
-
Other things?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This honestly looks like a lot of AI generated tests, and my experience generally is that you really have to cut that down to the core of what it needs.
What we need to check here is if we have SSL on the TableConfig, it connects to MySQL with that. Let's focus purely on that change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, will pare down the tests to just
When a MySQL instance does require SSL connections and SSL config is configured in the TabletConfig DB config, there's no error
Description
When connecting to an external mysql instance, vttablet performs a connectivity check. That connectivity check doesn't pass through any SSL configuration to the connect logic so if the external mysql instance requires secure connections, then an error is thrown from mysql, preventing the vttablet from starting.
This PR addresses the issue by passing through the SSL configuration to the connect logic.
Related Issue(s)
Fixes: #18480
Checklist
Deployment Notes