test: connections — env-var loading and MongoDB auth detection#507
test: connections — env-var loading and MongoDB auth detection#507anandgupta42 wants to merge 1 commit intomainfrom
Conversation
Cover untested CI/CD code path (ALTIMATE_CODE_CONN_* env vars) and new MongoDB detectAuthMethod branches added in PR #482. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> https://claude.ai/code/session_01Uf1H6t7768cFYAT9AbKSzr
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdded two test files to expand test coverage: one for Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Deduplicate overlapping tests from PRs #494, #499, #502, #504, #506, #507, #508, #510, #511, #512. Most MongoDB/env-var/dbt coverage was already on main; this adds only genuinely new tests: - SSH tunnel: `extractSshConfig` validation + lifecycle safety (7 tests) - dbt profiles: spark->databricks, trino->postgres adapter mapping - `dbtConnectionsToConfigs` conversion + empty input handling - `containerToConfig` with fully-populated container - MongoDB assertions in `telemetry-safety.test.ts` - Sanity suite: branding, deny, driver, resilience expansions (#494) Closes #513 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Consolidated into #514. This PR's test coverage was either already on main or has been included in the consolidated PR. |
…514) * test: consolidate test coverage from 10 hourly PRs into single PR Deduplicate overlapping tests from PRs #494, #499, #502, #504, #506, #507, #508, #510, #511, #512. Most MongoDB/env-var/dbt coverage was already on main; this adds only genuinely new tests: - SSH tunnel: `extractSshConfig` validation + lifecycle safety (7 tests) - dbt profiles: spark->databricks, trino->postgres adapter mapping - `dbtConnectionsToConfigs` conversion + empty input handling - `containerToConfig` with fully-populated container - MongoDB assertions in `telemetry-safety.test.ts` - Sanity suite: branding, deny, driver, resilience expansions (#494) Closes #513 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address code review findings from 6-model consensus review - Use `require.resolve()` instead of `require()` for driver resolvability checks to avoid false negatives from native binding load failures - Remove unnecessary `altimate_change` markers from new ssh-tunnel test file - Add `closeAllTunnels()` cleanup in `afterEach` to prevent state leaks Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address convergence review findings — driver warns, unshare guard - Driver resolvability checks now emit warnings instead of failures since drivers are intentionally absent from sanity Docker image (#295) - `unshare --net` now tests with a dry-run before use, falling back to proxy-based network blocking when unprivileged (macOS, containers) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
What does this PR do?
1.
loadFromEnv—src/altimate/native/connections/registry.ts(5 new tests)The
ALTIMATE_CODE_CONN_*env-var connection loading path had zero unit test coverage. CI/CD users rely on this to inject warehouse connections without config files on disk. If JSON parsing or name normalization (uppercase prefix → lowercase key) broke, connections would silently fail to load with no indication why.New coverage includes:
typefield are rejected2.
detectAuthMethodfor MongoDB —src/altimate/native/connections/registry.ts(3 new tests)PR #482 added MongoDB driver support with a new branch in
detectAuthMethod(line 229) that returns"connection_string"for MongoDB connections without a password. This branch had zero test coverage. Wrong auth detection means incorrect telemetry for MongoDB users.New coverage includes:
type: "mongodb"without password →"connection_string"type: "mongo"(alias) without password →"connection_string"type: "mongodb"with password →"password"(exercises the generic password check path)Type of change
Issue for this PR
N/A — proactive test coverage
How did you verify your code works?
Checklist
https://claude.ai/code/session_01Uf1H6t7768cFYAT9AbKSzr
Summary by CodeRabbit