Skip to content

test: add null connection SSL fallback test#41839

Open
lupingblaine wants to merge 1 commit into
appsmithorg:releasefrom
lupingblaine:test/41627-null-connection
Open

test: add null connection SSL fallback test#41839
lupingblaine wants to merge 1 commit into
appsmithorg:releasefrom
lupingblaine:test/41627-null-connection

Conversation

@lupingblaine
Copy link
Copy Markdown

@lupingblaine lupingblaine commented May 22, 2026

Summary

Adds a regression test for the MSSQL SSL fallback fix.

This test verifies that when the DatasourceConfiguration connection object is null, the plugin gracefully defaults to encrypt=false instead of throwing an exception.

Why this test matters

This test validates the outermost null-guard branch in addSslOptionsToUrlBuilder() and prevents regressions where missing connection configuration could crash datasource creation.

Fixes #41627

Summary by CodeRabbit

  • Tests
    • Added test coverage for MSSQL plugin's SSL configuration behavior, verifying expected default settings under specific connection conditions.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

Walkthrough

A new test method testSslDefaultsToNoVerify_whenConnectionIsNull is added to MssqlPluginTest, verifying that when a datasource configuration has a null connection field, the MSSQL plugin creates a HikariDataSource with encryption disabled in the JDBC URL.

Changes

MSSQL SSL Default Verification Test

Layer / File(s) Summary
SSL encryption defaults when connection is null
app/server/appsmith-plugins/mssqlPlugin/src/test/java/com/external/plugins/MssqlPluginTest.java
Test method nullifies the datasource connection field, triggers datasource creation via the MSSQL plugin executor, and asserts the resulting HikariDataSource's JDBC URL contains encrypt=false.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🔒 When connection fades to null,
Encryption yields its careful pull—
No verify, just encrypt=false,
A test that keeps the SSL phlox. 🌸

🚥 Pre-merge checks | ✅ 1 | ❌ 4

❌ Failed checks (4 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the change summary and explains the test's importance, but lacks the required issue reference format and template structure (missing 'Fixes #' format and automation/communication sections). Follow the template format: move issue reference to top as 'Fixes #41627', include the '/ok-to-test' automation section, and add the DevRel communication checkbox.
Linked Issues check ⚠️ Warning The PR adds a regression test for MSSQL SSL fallback, but the linked issue #41627 is about adding SeaTable as a native plugin—these are unrelated objectives. Verify the linked issue is correct. If this test relates to a different issue, update the PR to reference the appropriate issue number instead of #41627.
Out of Scope Changes check ⚠️ Warning The PR adds an MSSQL test for null connection handling, which is out of scope for the linked issue #41627 about implementing a SeaTable plugin. Either link the correct issue related to MSSQL SSL fallback fix, or clarify if this test was intended as part of a different PR.
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 (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding a regression test for null connection SSL fallback behavior in MSSQL plugin.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown
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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@app/server/appsmith-plugins/mssqlPlugin/src/test/java/com/external/plugins/MssqlPluginTest.java`:
- Line 778: The test method name testSslDefaultsToNoVerify_whenConnectionIsNull
is inconsistent with its assertion (it asserts encrypt=false / DISABLE); rename
the method to reflect the asserted SSL mode (e.g.,
testSslDefaultsToDisable_whenConnectionIsNull) or alternatively change the
assertion to match a NoVerify expectation; update the method declaration and any
references to testSslDefaultsToNoVerify_whenConnectionIsNull so the name and
asserted behavior (encrypt=false / DISABLE) are aligned.
- Around line 784-789: The test expects datasource creation to complete even
when the incoming connection is null, but MssqlPlugin.addSslOptionsToUrlBuilder
currently throws on a null connection; change addSslOptionsToUrlBuilder to
null-guard the connection parameter (e.g., if connection == null return the
original URLBuilder or a builder with default/no-op SSL options) so it does not
throw, ensuring datasourceCreate/dsConnectionMono can complete and the test in
MssqlPluginTest that asserts the JDBC URL contains "encrypt=false" can proceed;
locate and update the addSslOptionsToUrlBuilder method (and any callers in
datasourceCreate) to handle null safely without altering other behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 432099a5-7aef-4610-880b-0f6b5dceef82

📥 Commits

Reviewing files that changed from the base of the PR and between 3d5deb5 and a8b67c9.

📒 Files selected for processing (1)
  • app/server/appsmith-plugins/mssqlPlugin/src/test/java/com/external/plugins/MssqlPluginTest.java

}

@Test
public void testSslDefaultsToNoVerify_whenConnectionIsNull() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Rename the test to match the asserted SSL mode.

Line 778 says NoVerify, but Line 787 asserts encrypt=false, which corresponds to DISABLE behavior. Rename the method (or change assertion) to avoid semantic drift in test intent.

Suggested rename
-    public void testSslDefaultsToNoVerify_whenConnectionIsNull() {
+    public void testSslDefaultsToDisable_whenConnectionIsNull() {

Also applies to: 787-787

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@app/server/appsmith-plugins/mssqlPlugin/src/test/java/com/external/plugins/MssqlPluginTest.java`
at line 778, The test method name testSslDefaultsToNoVerify_whenConnectionIsNull
is inconsistent with its assertion (it asserts encrypt=false / DISABLE); rename
the method to reflect the asserted SSL mode (e.g.,
testSslDefaultsToDisable_whenConnectionIsNull) or alternatively change the
assertion to match a NoVerify expectation; update the method declaration and any
references to testSslDefaultsToNoVerify_whenConnectionIsNull so the name and
asserted behavior (encrypt=false / DISABLE) are aligned.

Comment on lines +784 to +789
StepVerifier.create(dsConnectionMono)
.assertNext(hikariDataSource -> {
assertNotNull(hikariDataSource);
assertTrue(hikariDataSource.getJdbcUrl().contains("encrypt=false"));
})
.verifyComplete();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Test expectation conflicts with current null-guard behavior.

This assertion expects datasourceCreate to complete, but MssqlPlugin.addSslOptionsToUrlBuilder(...) currently throws when connection is null. Unless the fallback fix is included in this stack, this test will fail before reaching the JDBC URL assertion.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@app/server/appsmith-plugins/mssqlPlugin/src/test/java/com/external/plugins/MssqlPluginTest.java`
around lines 784 - 789, The test expects datasource creation to complete even
when the incoming connection is null, but MssqlPlugin.addSslOptionsToUrlBuilder
currently throws on a null connection; change addSslOptionsToUrlBuilder to
null-guard the connection parameter (e.g., if connection == null return the
original URLBuilder or a builder with default/no-op SSL options) so it does not
throw, ensuring datasourceCreate/dsConnectionMono can complete and the test in
MssqlPluginTest that asserts the JDBC URL contains "encrypt=false" can proceed;
locate and update the addSslOptionsToUrlBuilder method (and any callers in
datasourceCreate) to handle null safely without altering other behavior.

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.

feat: Add SeaTable as native data source plugin

1 participant