Skip to content

Fix handshake issues local db#2066

Open
tobiaskleiner wants to merge 4 commits intomainfrom
fix-handshake-issues-local-db
Open

Fix handshake issues local db#2066
tobiaskleiner wants to merge 4 commits intomainfrom
fix-handshake-issues-local-db

Conversation

@tobiaskleiner
Copy link
Collaborator

No description provided.

@tobiaskleiner tobiaskleiner marked this pull request as draft February 19, 2026 09:44
@ctao-sonarqube
Copy link

@tobiaskleiner tobiaskleiner marked this pull request as ready for review February 19, 2026 12:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes MongoDB connection issues for local databases by implementing case-insensitive hostname matching and expanding the list of recognized local database hostnames. The fix prevents incorrect TLS handshake attempts when connecting to local non-TLS MongoDB containers, which was occurring when hostnames had different casing or were IPv6 addresses.

Changes:

  • Extended local database hostname detection to include IPv4 (127.0.0.1) and IPv6 (::1) localhost addresses, plus additional container hostname aliases
  • Implemented case-insensitive hostname matching using casefold() to handle variations like "MongoDB" vs "mongodb"
  • Added comprehensive test coverage for the new hostname aliases with mixed-case examples

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/simtools/db/mongo_db.py Modified _build_uri to use case-insensitive hostname matching with an expanded set of local database hostnames, ensuring local databases use direct connections without TLS
tests/unit_tests/db/test_mongo_db.py Added parametrized test covering new local hostname aliases including mixed-case variants to verify case-insensitive matching works correctly
docs/changes/2066.bugfix.md Added changelog entry documenting the bug fix for MongoDB URI generation
.gitignore Added mongo-data directory to ignore list for local database data

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