fix(ServiceBus): Ignore runtime property to support reuse#1643
Conversation
✅ Deploy Preview for testcontainers-dotnet ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
WalkthroughAdded Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
HofmeisterAn
left a comment
There was a problem hiding this comment.
Thanks for the contribution!
Something came to mind while I was thinking about this again. It's probably best to use the reuse hash from the actual dependent container instead of ignoring it.
We can merge this for now to unblock your use case, and then add it properly as a feature in a separate PR.
|
I didn't mention it in the issue, but while investigating I also thought of that and my thought process was:
So I believe this is actually the correct way to do it, at least until we have a pattern to pass down WithReuse to dependant containers. |
What does this PR do?
Makes the configuration hash of ServiceBusContainer stable by removing the IDatabaseContainer from the hashed configuration.
Why is it important?
The IDatabaseContainer contains runtime information about the database container such as the start time which changes everytime, resulting in an always changing configuration hash, which breaks the Resource Reuse feature for ServiceBus containers.
Related issues
How to test this PR
Since this concerns cross-execution tests, an automated test would become quite convoluted. The easiest way to test this is to temporarily modify the configurations on ServiceBusCustomMsSqlConfiguration and DatabaseFixture to both use .WithReuse(true) and running the test twice. The first execution should create the containers and the second should reuse them.
Follow-ups
An analogous change needs to be made for EventHubs. I will do it in a separate PR
Summary by CodeRabbit