Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Testcontainers.EventHubs/EventHubsConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public EventHubsConfiguration(EventHubsConfiguration oldValue, EventHubsConfigur
/// <summary>
/// Gets the Azurite container.
/// </summary>
[JsonIgnore]
public AzuriteContainer AzuriteContainer { get; }
Comment on lines +64 to 65
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

git ls-files | head -20

Repository: testcontainers/testcontainers-dotnet

Length of output: 613


🏁 Script executed:

fd -t f "EventHubsConfiguration" --max-results 5

Repository: testcontainers/testcontainers-dotnet

Length of output: 134


🏁 Script executed:

fd -t d "test|Test" | head -10

Repository: testcontainers/testcontainers-dotnet

Length of output: 440


🏁 Script executed:

cat -n "src/Testcontainers.EventHubs/EventHubsConfiguration.cs" | head -80

Repository: testcontainers/testcontainers-dotnet

Length of output: 3634


🏁 Script executed:

fd -t d "EventHubs" | grep -i test

Repository: testcontainers/testcontainers-dotnet

Length of output: 147


🏁 Script executed:

rg -l "EventHubsConfiguration" --type=cs | grep -i test

Repository: testcontainers/testcontainers-dotnet

Length of output: 300


🏁 Script executed:

find tests/Testcontainers.EventHubs.Tests -type f -name "*.cs" | head -20

Repository: testcontainers/testcontainers-dotnet

Length of output: 257


🏁 Script executed:

rg "reuse|signature|hash|WithReuse|ResourceHash" tests/Testcontainers.EventHubs.Tests --type=cs -l

Repository: testcontainers/testcontainers-dotnet

Length of output: 62


🏁 Script executed:

rg "JsonIgnore|json|JSON" tests/Testcontainers.EventHubs.Tests --type=cs -l

Repository: testcontainers/testcontainers-dotnet

Length of output: 62


🏁 Script executed:

rg -l "reuse|signature|hash|WithReuse|ResourceHash" src/Testcontainers.EventHubs --type=cs

Repository: testcontainers/testcontainers-dotnet

Length of output: 62


🏁 Script executed:

cat tests/Testcontainers.EventHubs.Tests/EventHubsContainerTest.cs

Repository: testcontainers/testcontainers-dotnet

Length of output: 4556


🏁 Script executed:

rg "reuse|signature|hash|WithReuse|ResourceHash" src --type=cs | head -30

Repository: testcontainers/testcontainers-dotnet

Length of output: 4560


🏁 Script executed:

rg "JsonIgnore" src --type=cs | head -20

Repository: testcontainers/testcontainers-dotnet

Length of output: 1935


🏁 Script executed:

rg -l "reuse|hash.*signature|ResourceHash" tests --type=cs | head -10

Repository: testcontainers/testcontainers-dotnet

Length of output: 388


🏁 Script executed:

rg "WithReuse|ResourceReuse" tests --type=cs -A 5 | head -40

Repository: testcontainers/testcontainers-dotnet

Length of output: 3910


🏁 Script executed:

find src -name "*ResourceConfiguration*" -o -name "*ReuseHash*" | xargs cat

Repository: testcontainers/testcontainers-dotnet

Length of output: 5873


🏁 Script executed:

cat tests/Testcontainers.Platform.Linux.Tests/ReusableResourceTest.cs | head -100

Repository: testcontainers/testcontainers-dotnet

Length of output: 4148


🏁 Script executed:

rg "EventHubsConfiguration|GetReuseHash" tests --type=cs -B 2 -A 5

Repository: testcontainers/testcontainers-dotnet

Length of output: 4252


🏁 Script executed:

find tests -name "*Hash*" -o -name "*Signature*" | head -10

Repository: testcontainers/testcontainers-dotnet

Length of output: 62


Add a regression test to lock this hashing behavior for EventHubs configurations.

This fix is correct—excluding AzuriteContainer from the reuse hash via [JsonIgnore] aligns with the framework pattern and prevents runtime container state from affecting the signature. However, EventHubs currently lacks specific test coverage verifying that the reuse signature remains stable when only Azurite runtime state changes, while still changing when actual EventHubs config inputs (ServiceConfiguration) change. Add a test case in the EventHubs test suite to assert this behavior.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Testcontainers.EventHubs/EventHubsConfiguration.cs` around lines 64 - 65,
Add a regression test in the EventHubs test suite that constructs two
EventHubsConfiguration instances which differ only in their AzuriteContainer
runtime instance (leave ServiceConfiguration identical) and asserts their reuse
signature/hash (the same mechanism used elsewhere to determine container reuse)
is equal, then mutate ServiceConfiguration on one instance and assert the reuse
signature/hash changes; reference the EventHubsConfiguration type and its
AzuriteContainer and ServiceConfiguration properties in the test to ensure
AzuriteContainer is ignored in the signature while ServiceConfiguration affects
it.


/// <summary>
Expand Down
1 change: 1 addition & 0 deletions src/Testcontainers.EventHubs/Usings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
global using System.Linq;
global using System.Text;
global using System.Text.Json;
global using System.Text.Json.Serialization;
global using Docker.DotNet.Models;
global using DotNet.Testcontainers;
global using DotNet.Testcontainers.Builders;
Expand Down
Loading