Skip to content

test: add null auth type SSL fallback test#41841

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

test: add null auth type SSL fallback test#41841
lupingblaine wants to merge 1 commit into
appsmithorg:releasefrom
lupingblaine:test/41627-null-auth-type

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 SSL AuthType is null, the plugin gracefully defaults to encrypt=false instead of throwing an exception.

Why this test matters

This test validates the innermost null-guard branch in addSslOptionsToUrlBuilder() and ensures datasource creation remains robust when the SSL wrapper exists but no auth type is provided.

Fixes #41627

Summary by CodeRabbit

  • Tests
    • Added test coverage for MSSQL datasource SSL configuration validation, ensuring proper default behavior when SSL settings are not explicitly configured.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

Walkthrough

A new unit test validates MSSQL datasource creation behavior when SSL authentication type is explicitly null. The test configures the datasource, executes plugin creation logic, and asserts the resulting JDBC connection string disables encryption as expected.

Changes

MSSQL SSL null auth type validation

Layer / File(s) Summary
SSL null auth type test
app/server/appsmith-plugins/mssqlPlugin/src/test/java/com/external/plugins/MssqlPluginTest.java
New test testSslDefaultsToDisable_whenAuthTypeIsNull sets datasource SSL auth type to null, creates a HikariDataSource via mssqlPluginExecutor.datasourceCreate(), and asserts the JDBC URL contains encrypt=false.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

✨ When auth types vanish into the null,
Encryption bows and shields its wall,
A test affirms the default's true—
No secrets whispered, plain and new! 🔐

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The MSSQL SSL test is out of scope relative to issue #41627 which focuses on implementing a SeaTable data source plugin. Either update the issue link to reference the correct MSSQL SSL fallback issue, or remove this test from this PR if it belongs to a different feature.
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.
Linked Issues check ❓ Inconclusive Linked issue #41627 is about SeaTable plugin implementation, not MSSQL SSL testing. The PR appears to be a regression test unrelated to the stated issue objectives. Clarify the relationship between this MSSQL SSL test and issue #41627, or verify if the correct issue number was referenced.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed Title accurately reflects the change: adding a test for null auth type SSL fallback behavior in MSSQL plugin.
Description check ✅ Passed Description provides clear context, explains test purpose, and links to issue #41627, though the PR objectives mention a different SeaTable plugin issue.

✏️ 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: 1

🧹 Nitpick comments (1)
app/server/appsmith-plugins/mssqlPlugin/src/test/java/com/external/plugins/MssqlPluginTest.java (1)

784-788: 💤 Low value

Inconsistent indentation in assertion block.

The lines inside the assertNext lambda have extra indentation. While this doesn't affect functionality, it's inconsistent with the indentation style used in other tests in this file (e.g., lines 142-146, 669-673).

♻️ Align indentation with existing test style
         StepVerifier.create(dsConnectionMono)
                 .assertNext(hikariDataSource -> {
-                        assertNotNull(hikariDataSource);
-                        assertTrue(hikariDataSource.getJdbcUrl().contains("encrypt=false"));
+                    assertNotNull(hikariDataSource);
+                    assertTrue(hikariDataSource.getJdbcUrl().contains("encrypt=false"));
                 })
                 .verifyComplete();
🤖 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 - 788, The assertion block inside the Reactor test's
.assertNext lambda has extra indentation that differs from the file's standard;
locate the chain using .assertNext(hikariDataSource -> { ... }) and
.verifyComplete() and reformat the lines within the lambda (the assertNotNull
and assertTrue calls referencing hikariDataSource and
getJdbcUrl().contains("encrypt=false")) to match the surrounding test style
(remove the extra indent so the two assertions align with other tests).
🤖 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`:
- Around line 776-789: The test fails because addSslOptionsToUrlBuilder(...)
throws when Connection.getSsl().getAuthType() is null; update
addSslOptionsToUrlBuilder (used by datasourceCreate(...)) to treat a null
authType as the disabled/default case (do not throw), and build the JDBC URL
with encrypt=false in that path so the test expecting "encrypt=false" passes;
also adjust the indentation of the assertions inside the assertNext(...) lambda
in MssqlPluginTest.testSslDefaultsToDisable_whenAuthTypeIsNull to align
assertNotNull(...) and assertTrue(...).

---

Nitpick comments:
In
`@app/server/appsmith-plugins/mssqlPlugin/src/test/java/com/external/plugins/MssqlPluginTest.java`:
- Around line 784-788: The assertion block inside the Reactor test's .assertNext
lambda has extra indentation that differs from the file's standard; locate the
chain using .assertNext(hikariDataSource -> { ... }) and .verifyComplete() and
reformat the lines within the lambda (the assertNotNull and assertTrue calls
referencing hikariDataSource and getJdbcUrl().contains("encrypt=false")) to
match the surrounding test style (remove the extra indent so the two assertions
align with other tests).
🪄 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: 41087161-9bea-49e2-999b-5521118f795d

📥 Commits

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

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

Comment on lines +776 to +789
@Test
public void testSslDefaultsToDisable_whenAuthTypeIsNull() {
DatasourceConfiguration dsConfig = createDatasourceConfiguration(container);
dsConfig.getConnection().getSsl().setAuthType(null);

Mono<HikariDataSource> dsConnectionMono = mssqlPluginExecutor.datasourceCreate(dsConfig);

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 | 🔴 Critical | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check if MssqlPlugin.java still throws exception for null authType or handles it gracefully

# Search for the null authType check in addSslOptionsToUrlBuilder
rg -n -A 8 -B 2 'addSslOptionsToUrlBuilder' app/server/appsmith-plugins/mssqlPlugin/src/main/java/com/external/plugins/MssqlPlugin.java

# Also check if there's any null-safe handling logic for authType
rg -n -C 5 'getAuthType\(\)\s*==\s*null' app/server/appsmith-plugins/mssqlPlugin/src/main/java/com/external/plugins/MssqlPlugin.java

Repository: appsmithorg/appsmith

Length of output: 1865


🏁 Script executed:

#!/bin/bash
sed -n '760,805p' app/server/appsmith-plugins/mssqlPlugin/src/test/java/com/external/plugins/MssqlPluginTest.java

Repository: appsmithorg/appsmith

Length of output: 1400


Fix failing test: null authType currently throws in MssqlPlugin

  • addSslOptionsToUrlBuilder(...) throws AppsmithPluginException when getAuthType() is null, but testSslDefaultsToDisable_whenAuthTypeIsNull expects datasourceCreate(...) to succeed and the JDBC URL to contain encrypt=false.
  • Minor: align the indentation of assertNotNull(...) / assertTrue(...) inside the assertNext(...) lambda.
🤖 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 776 - 789, The test fails because addSslOptionsToUrlBuilder(...)
throws when Connection.getSsl().getAuthType() is null; update
addSslOptionsToUrlBuilder (used by datasourceCreate(...)) to treat a null
authType as the disabled/default case (do not throw), and build the JDBC URL
with encrypt=false in that path so the test expecting "encrypt=false" passes;
also adjust the indentation of the assertions inside the assertNext(...) lambda
in MssqlPluginTest.testSslDefaultsToDisable_whenAuthTypeIsNull to align
assertNotNull(...) and assertTrue(...).

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