-
-
Notifications
You must be signed in to change notification settings - Fork 288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add Apache Pulsar module #1103
feat: Add Apache Pulsar module #1103
Conversation
✅ Deploy Preview for testcontainers-dotnet ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
fcc64e3
to
9f198d7
Compare
You can apply the final command at the end. We are doing this in other modules too; sometimes it is necessary to configure the wait strategy at the end. You just need to keep a reference somewhere (in the configuration) to decide which command should be used. Or you can use a similar approach we are doing with Kafka and upload a script that gets executed. Does that help? |
Yes! Thanks 👍 |
b31b4c1
to
1ebaa37
Compare
Hi @HofmeisterAn , |
Dear @HofmeisterAn. |
The Pulsar image has been upgraded from apachepulsar/pulsar:3.0.3 to apachepulsar/pulsar:3.0.4. Moreover, changes are made in the wait strategy to improve the way it handles authentication. A new WaitUntil class has been introduced to manage the authentication token.
c52101c
to
b839b1e
Compare
A new file, PulsarService.cs, has been added, with a struct named PulsarService that allows the creation of different Pulsar services. Changes have also been made to PulsarBuilder.cs, mainly to incorporate the use of PulsarService. Rather than using a constant value, `WithAuthentication()` and `WithFunctionsWorker(bool functionsWorkerEnabled = true)` now use elements from the PulsarService struct. Wait strategy has been updated to better account for various enabled services.
e4e3581
to
bdcef9d
Compare
@HofmeisterAn, Thank you for your valuable contribution to the open-source community. |
Update index.md to reflect that we use pulsar 3.0.4
…ers-dotnet into entvex-Testcontainers.Pulsar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering if there might be an issue with the [UsedImplicitly] after you refactored the tests.
No, this controls the usage check (code smell detection).
The issue was with the EnabledServices
implementation. You cannot store values in the builder because the builder returns new instances and loses the information without further adjustments (we made this change to support A/B testing). Therefore, the authentication use case was not properly configured. Please take a look at the latest adjustments and let me know what you think. IMO the implementation looks good. However, we should take a final look at the configuration and figure out why the latest version is incompatible. Version 3.2.2
does not start with enabled authentication.
Can you please complete this? This library is needed for my project. Thank you |
I am waiting for a reponse from @HofmeisterAn :) |
I stumbled across this discussion where the friends from Go are trying to achieve something similar. Maybe this can help to sort out the issue or align the configuration. |
Very interesting! Thanks for the link! |
Pulsar image version in PulsarBuilder has been updated from 3.0.4 to 3.2.3. The authentication token validity period has been extended from 1 hour to 365 days in both PulsarBuilder and PulsarContainerTest to reduce the impact of a token creation bug in Apache Pulsar. This change significantly reduces the impact of a token creation bug that affected versions 3.2.0 to 3.2.3. The bug is related to mishandling time units (seconds as milliseconds).
Hi @HofmeisterAn, I've identified a critical bug in Apache Pulsar related to token creation. The issue stems from mishandling time units (specifically, treating seconds as milliseconds). In my latest commit to this module, I've adjusted the expiration time for tokens used in the authentication to be one year. This change mitigates the impact of the token creation bug, which affected versions 3.2.0 to 3.2.3. |
The tests now run reliably, so you are free to merge 😄 @HofmeisterAn |
I see. Do you have any additional information, such as official documentation, a related issue, etc., regarding the workaround? Do we set the |
Jep, we have set the |
The issue arises because Apache Pulsar incorrectly treats seconds as milliseconds in specific versions. To address this, we multiply the value by 1000 when using affected versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, the efforts, and the patience. Great first contribution 🙏.
Thanks a lot! It was a pleasure working with you. I hope we can collaborate more modules soon 👍 |
I noticed that this merged. Do you have an estimate on when it will be available in nuget? |
What does this PR do?
This PR introduces Apache Pulsar support to testcontainers-dotnet, enabling users to easily spin up Pulsar containers for testing purposes. It also provides an option to enable TokenAuthentication, allowing for secure Pulsar interactions.
Why is it important?
Apache Pulsar is a rapidly growing distributed messaging system gaining traction in the cloud-native ecosystem. Integrating Pulsar support into testcontainers-dotnet will make it easier for developers to test their applications using Pulsar. Additionally, providing TokenAuthentication support enhances security and privacy in Pulsar-based testing scenarios.
How to test this PR
Run the XUnit tests in the testcontainers-dotnet project to ensure the Pulsar containerization and TokenAuthentication functionality work as expected.
Follow-ups
@HofmeisterAn, I encountered a challenge while adding WithTokenAuthentication capabilities to PulsarBuilder. The current implementation of WithCommand appends commands instead of replacing them, making it difficult to modify container startup commands based on selected Pulsar features. In the testcontainers-java module, the container command is modified just before the container starts, enabling control over its execution. Could you provide suggestions on how to achieve a similar approach in testcontainers-dotnet?
In the java module they seem to have the control to edit it, just before the container starts
Do you have a suggestion on a suggestion on how I should implement this for testcontainers-dotnet ?