Skip to content

feat(CosmosDb): Add get method AccountEndpoint#1707

Merged
HofmeisterAn merged 4 commits into
testcontainers:developfrom
srollinet:feature/cosmosdb-getters-for-accountendpoint-and-accountkey
Jun 17, 2026
Merged

feat(CosmosDb): Add get method AccountEndpoint#1707
HofmeisterAn merged 4 commits into
testcontainers:developfrom
srollinet:feature/cosmosdb-getters-for-accountendpoint-and-accountkey

Conversation

@srollinet

@srollinet srollinet commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Add getters for Cosmos DB AccountEndpoint and AccountKey

Why is it important?

Add a convenient way to access these properties

Related issues

Summary by CodeRabbit

  • New Features

    • Added a public helper to retrieve the Cosmos DB emulator account endpoint URI.
  • Refactor

    • Updated Cosmos DB connection string generation to populate the account endpoint using the new helper, rather than building it inline.
  • Documentation

    • Refreshed XML documentation for Azurite endpoint helper methods (no behavior changes).

@srollinet srollinet requested a review from HofmeisterAn as a code owner June 16, 2026 16:18
@netlify

netlify Bot commented Jun 16, 2026

Copy link
Copy Markdown

Deploy Preview for testcontainers-dotnet ready!

Name Link
🔨 Latest commit a4288de
🔍 Latest deploy log https://app.netlify.com/projects/testcontainers-dotnet/deploys/6a32369c440fc50007267a30
😎 Deploy Preview https://deploy-preview-1707--testcontainers-dotnet.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@srollinet srollinet closed this Jun 16, 2026
@srollinet srollinet reopened this Jun 16, 2026
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0bc885bd-0349-4d79-b238-e6921e285d42

📥 Commits

Reviewing files that changed from the base of the PR and between eac9d2b and a4288de.

📒 Files selected for processing (2)
  • src/Testcontainers.Azurite/AzuriteContainer.cs
  • src/Testcontainers.CosmosDb/CosmosDbContainer.cs
✅ Files skipped from review due to trivial changes (1)
  • src/Testcontainers.Azurite/AzuriteContainer.cs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/Testcontainers.CosmosDb/CosmosDbContainer.cs

Walkthrough

CosmosDbContainer gains a new public helper method GetAccountEndpoint() that returns the mapped emulator URI for the Cosmos DB port. GetConnectionString() is refactored to call this helper instead of constructing the AccountEndpoint inline. Azurite endpoint method documentation is updated for consistency.

Changes

CosmosDbContainer account endpoint extraction

Layer / File(s) Summary
Extract GetAccountEndpoint helper and refactor GetConnectionString
src/Testcontainers.CosmosDb/CosmosDbContainer.cs
New public GetAccountEndpoint() method returns the emulator account endpoint URI. GetConnectionString() now delegates AccountEndpoint construction to this helper instead of inline URI building.

Azurite endpoint method documentation updates

Layer / File(s) Summary
Update Azurite endpoint method documentation
src/Testcontainers.Azurite/AzuriteContainer.cs
XML documentation blocks for GetBlobEndpoint, GetQueueEndpoint, and GetTableEndpoint methods are updated with consistent formatting and punctuation.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

Suggested labels

module

Suggested reviewers

  • HofmeisterAn

Poem

🐇 Hippity hop, extracting with care,
One little helper floats through the air.
GetAccountEndpoint shines clean and bright,
No more inline logic tangled tight!
The cosmos runs smooth, the connection string sings—
Small methods bring joy to the simplest things. ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR adds GetAccountEndpoint() method as requested in #1704, but only partially addresses the issue by missing the GetAccountKey() method requirement. Add GetAccountKey() method to complete the requirements specified in #1704 for both AccountEndpoint and AccountKey getters.
Out of Scope Changes check ⚠️ Warning Documentation updates to AzuriteContainer are unrelated to the CosmosDb AccountEndpoint and AccountKey getter requirements from #1704. Remove the documentation-only changes to AzuriteContainer or address them in a separate PR focused on documentation improvements.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a getter method for AccountEndpoint in CosmosDb.
Description check ✅ Passed The description covers what the PR does and why it matters, but does not include the optional 'How to test' section or link the correct issue resolution status.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ 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.

@srollinet srollinet changed the title feat(CosmosDb) - add getters for AccountEndpoint and AccountKey feat(CosmosDb) add getters for AccountEndpoint and AccountKey Jun 16, 2026
Comment thread src/Testcontainers.CosmosDb/CosmosDbContainer.cs Outdated
@HofmeisterAn HofmeisterAn changed the title feat(CosmosDb) add getters for AccountEndpoint and AccountKey feat(CosmosDb): Add get method AccountEndpoint Jun 17, 2026
@HofmeisterAn HofmeisterAn added the enhancement New feature or request label Jun 17, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/Testcontainers.CosmosDb/CosmosDbContainer.cs (2)

38-45: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Add remarks section explaining design rationale.

Based on past review discussion, a <remarks> section should be added to explain why GetAccountEndpoint() is provided as a method (returns runtime information based on the mapped port) while GetAccountKey() is not (the key is a static default accessible via CosmosDbBuilder.DefaultAccountKey). As per coding guidelines, this documentation helps users understand the design decision and where to find the account key.

📝 Proposed enhancement
     /// <summary>
-    /// Gets the CosmosDb account endpoint
+    /// Gets the CosmosDb account endpoint.
     /// </summary>
+    /// <remarks>
+    /// This method returns runtime information (the mapped emulator endpoint).
+    /// The account key is a static default available via <see cref="CosmosDbBuilder.DefaultAccountKey"/>.
+    /// </remarks>
     /// <returns>The CosmosDb account endpoint</returns>
🤖 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 `@src/Testcontainers.CosmosDb/CosmosDbContainer.cs` around lines 38 - 45, Add a
<remarks> XML documentation section to the GetAccountEndpoint() method that
explains the design rationale. The remarks should clarify that this method
returns runtime-specific information based on the dynamically mapped
CosmosDbPort, and contrast this with GetAccountKey() which is not provided as a
method since the account key is a static default value accessible via
CosmosDbBuilder.DefaultAccountKey. This helps users understand where to obtain
both the endpoint and the account key.

39-39: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add missing period for consistency.

The XML doc summary is missing a period at the end, inconsistent with other method documentation in this class (e.g., line 17).

📝 Proposed fix
-    /// Gets the CosmosDb account endpoint
+    /// Gets the CosmosDb account endpoint.
🤖 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 `@src/Testcontainers.CosmosDb/CosmosDbContainer.cs` at line 39, Add a period at
the end of the XML documentation summary comment "Gets the CosmosDb account
endpoint" to ensure consistency with the documentation style used elsewhere in
the CosmosDbContainer class. The summary line should end with a period, matching
the convention seen in other method documentation throughout the class.
🤖 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.

Outside diff comments:
In `@src/Testcontainers.CosmosDb/CosmosDbContainer.cs`:
- Around line 38-45: Add a <remarks> XML documentation section to the
GetAccountEndpoint() method that explains the design rationale. The remarks
should clarify that this method returns runtime-specific information based on
the dynamically mapped CosmosDbPort, and contrast this with GetAccountKey()
which is not provided as a method since the account key is a static default
value accessible via CosmosDbBuilder.DefaultAccountKey. This helps users
understand where to obtain both the endpoint and the account key.
- Line 39: Add a period at the end of the XML documentation summary comment
"Gets the CosmosDb account endpoint" to ensure consistency with the
documentation style used elsewhere in the CosmosDbContainer class. The summary
line should end with a period, matching the convention seen in other method
documentation throughout the class.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1ef1d2fe-33eb-4320-a5ea-ba589280dda4

📥 Commits

Reviewing files that changed from the base of the PR and between 4f4660e and eac9d2b.

📒 Files selected for processing (1)
  • src/Testcontainers.CosmosDb/CosmosDbContainer.cs

@HofmeisterAn HofmeisterAn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks

@HofmeisterAn HofmeisterAn merged commit 8394aab into testcontainers:develop Jun 17, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement]: CosmosDb: Add getters for AccountEndpoint and AccountKey

2 participants