Skip to content
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 NATS module #1003

Merged

Conversation

niklasfp
Copy link
Contributor

@niklasfp niklasfp commented Sep 17, 2023

What does this PR do?

This pr adds support for the official Nats Server image
It should roughly align with the Go version providing support for .WithUsername and .WithPassword

The container enables the http monitoring endpoints of Nats, and exposes the default Nats server ports:

  • Client port 4222
  • Http monitoring endpoints on port 8222
  • Routes on port 6222

It also adds methods for getting a Nats connection string and the url for the monitoring endpoint.

Why is it important?

I needed it for my own work, and thought I might as well share it.
And since Nats already has both Go and Node.js implementations, I guess others would benefit as well.

Related issues

N/A

How to test this PR

Tests has been added in this pr.
Run the tests in ./tests/Testcontainers.Nats.Tests

@netlify
Copy link

netlify bot commented Sep 17, 2023

Deploy Preview for testcontainers-dotnet ready!

Name Link
🔨 Latest commit b402f8b
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-dotnet/deploys/6509e89a5c12dc000856789d
😎 Deploy Preview https://deploy-preview-1003--testcontainers-dotnet.netlify.app/modules
📱 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 site configuration.

…eption.

Caused by a copy waste while doing the initial implementation.
Copy link
Collaborator

@HofmeisterAn HofmeisterAn left a comment

Choose a reason for hiding this comment

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

Thank you for your pull request 🙏. It looks good! I just have a few minor questions and some suggestions for improvements.

src/Testcontainers.Nats/NatsBuilder.cs Outdated Show resolved Hide resolved
src/Testcontainers.Nats/NatsBuilder.cs Outdated Show resolved Hide resolved
src/Testcontainers.Nats/NatsBuilder.cs Outdated Show resolved Hide resolved
src/Testcontainers.Nats/NatsBuilder.cs Outdated Show resolved Hide resolved
src/Testcontainers.Nats/NatsBuilder.cs Outdated Show resolved Hide resolved
src/Testcontainers.Nats/NatsContainer.cs Outdated Show resolved Hide resolved
niklasfp and others added 3 commits September 17, 2023 17:27
Co-authored-by: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com>
Fix -user & -pass were missing a -, so --user and --pass is now used.
Add long params instead, e.g --jetstream instead of -js
Add Validatation, if either password or username is set, then both are required.
Fix EscapeDataString on username and password.
…iklasfp/testcontainers-dotnet into feat/add-nats-server-container

# Conflicts:
#	src/Testcontainers.Nats/NatsBuilder.cs
@HofmeisterAn HofmeisterAn changed the title feat: Add Nats Server Container feat: Add NATS module Sep 18, 2023
@HofmeisterAn HofmeisterAn added the enhancement New feature or request label Sep 18, 2023
@niklasfp
Copy link
Contributor Author

@HofmeisterAn How should we handle this, you can rebase and merge if you see it fitting, or let me know what you need done from me 😄

@HofmeisterAn
Copy link
Collaborator

@HofmeisterAn How should we handle this, you can rebase and merge if you see it fitting, or let me know what you need done from me 😄

Ah, perhaps I misinterpreted it. I thought you were going to make changes according to the suggestion.

I'll ditch the null checks.

I am fine with the pull request; it looks good 👍, thanks! I can merge it later today when I am back home. Rebase, etc. is not necessary.

@niklasfp
Copy link
Contributor Author

@HofmeisterAn cool!!

Copy link
Collaborator

@HofmeisterAn HofmeisterAn left a comment

Choose a reason for hiding this comment

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

Thanks, again 🙏.

@HofmeisterAn HofmeisterAn merged commit 560b64f into testcontainers:develop Sep 19, 2023
9 checks passed
@niklasfp niklasfp deleted the feat/add-nats-server-container branch September 19, 2023 19:22
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.

None yet

2 participants