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

Example how to use #15

Open
ChristianLangmann opened this issue Jan 29, 2019 · 1 comment
Open

Example how to use #15

ChristianLangmann opened this issue Jan 29, 2019 · 1 comment

Comments

@ChristianLangmann
Copy link

Missing an example (or description) how to use the connector in a real munit-test.

When I simply add the connector (e.g. for a postgres-testcontainer) an instance is started, the init-script is executed, but the flow under test cannot access this database, because ports are defined dynamically in testcontainer and therefore no configuration is possible.

tescontainer-jdbc itself ignores all ports provided in the url, so it cannot be provided from the test itself.

@manikmagar
Copy link
Owner

manikmagar commented Feb 3, 2019

Hello @ChristianLangmann, Thanks for trying this. Here is a demo project https://github.com/manikmagar/munit-db-testcontainers-demo and https://www.youtube.com/watch?v=EJ3r5uEPhKU&t=8s youtube presentation about this connector. (I have updated Readme with these links). Hope that helps to get started.

I am not sure why you are trying to access database port. You should be overriding the jdbc url in your test properties - https://github.com/manikmagar/munit-db-testcontainers-demo/blob/master/src/test/resources/application.properties#L8

When your flow runs and Database connector tries to connect using jdbc url, connector will spin up a database in a container and provide a connection to that. Let me know if you have any questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants