-
-
Notifications
You must be signed in to change notification settings - Fork 498
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
MongoDB example #723
MongoDB example #723
Conversation
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
@@ -1,4 +1,4 @@ | |||
name: Mongodb example pipeline | |||
name: MongoDB example pipeline |
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.
This is a good point, as the generator does not distinguish this notation including initials. I'll take a note to include a way to provide a variant that overrides the titled names
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.
yep, anyway, great work on the generator. It saves a lot of time 💪
} | ||
|
||
// setupMongoDB creates an instance of the mongodb container type | ||
func setupMongoDB(ctx context.Context) (*mongodbContainer, error) { |
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.
Were you able to take a look at the Java implementation, or do you think this simple example is enough?
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.
In any case, this LGTM. I'll merge it as is and we can iterate and evolve the example in follow ups, if you are interested
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 have a look into Java implementation, looks like it's supports replica set that looks like for me as an option. I doesn't need it, and I believe if someone will need it, it could be added as an option, as container option.
From my perspective it is good enough, as it just works and doesn't require overcomplicating it at this stage.
If we will add these rows below test, it will work, and this is most common usecase for tests, just perform operations
res, err := mongoClient.Database("test").Collection("test").InsertOne(ctx, bson.M{"test": "test"})
if err != nil {
t.Fatal(fmt.Errorf("error inserting document into mongo: %w", err))
}
if res.InsertedID == nil {
t.Fatal("expected InsertedID to not be nil")
}
wdyt?
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.
Sounds good to me 👏
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 your time adding this example! Much appreciated :)
thank you for maintaining this great project and rapid review ❤️ |
What does this PR do?
Added example for MongoDB
Why is it important?
MongoDB doesn't have example yet
Related issues