[FOLIO-3118] SPIKE: testcontainers and Vagrant Created: 14/Apr/21 Updated: 21/Apr/21 Resolved: 21/Apr/21 |
|
| Status: | Closed |
| Project: | FOLIO |
| Components: | None |
| Affects versions: | None |
| Fix versions: | None |
| Type: | Task | Priority: | P3 |
| Reporter: | Jakub Skoczen | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original estimate: | Not Specified | ||
| Issue links: |
|
||||||||||||
| Sprint: | CP: R3 2022 roadmap | ||||||||||||
| Story Points: | 3 | ||||||||||||
| Development Team: | Core: Platform | ||||||||||||
| Description |
|
Can we use testcontainers under Vagrant? Should we? According to Marc Johnson the changes to RMB force developers to use testcontainers for testing and there's no way to use external Postgres. This will cause problems for people running Windows and Vagrant. Oleksandr_Dekin mentioned during the TL meeting that he has a guideline for how to run on Windows w Vagrant and will post a wiki page about it. |
| Comments |
| Comment by Julian Ladisch [ 14/Apr/21 ] |
|
RMB based modules can use the testcontainers support that RMB ships with: https://github.com/folio-org/raml-module-builder/blob/master/doc/upgrading.md#rmb-789-remove-support-of-embedded-postgresql-server RMB has configuration options to point to some other external PostgreSQL server: |
| Comment by Julian Ladisch [ 14/Apr/21 ] |
|
https://folio-org.atlassian.net/browse/FOLIO-1845?focusedCommentId=192264&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel |
| Comment by Marc Johnson [ 15/Apr/21 ] |
Has this been tested for use during tests since moving to test containers? When I tried, the environment variables were not respected during tests and so could no longer use an external PostgreSQL server. |
| Comment by Adam Dickmeiss [ 16/Apr/21 ] |
|
If you do NOT call PostgresClient.setPostgresTester(new PostgresTesterContainer()), then RMB should work exactly as it would do in in runtime. Switching away from containers because one of the standard production environment entries are present (eg DB_HOST is present) is not what I would recommend. But if you guys think that if DB_HOST or one of the other env entries are set should switch away from test containers, that can , of course be the new behavior.. But obviously is a change to RMB . |
| Comment by Adam Dickmeiss [ 16/Apr/21 ] |
|
Example on how it can be done: if (System.getProperty("postgres_external") == null) { PostgresClient.setPostgresTester(new PostgresTesterContainer()); } And an external Postgres can then be used with something like: DB_HOST=localhost DB_PORT=5432 DB_USERNAME=user DB_PASSWORD=pass DB_DATABASE=postgres \ mvn -B -Dpostgres_external=1 test |
| Comment by Adam Dickmeiss [ 16/Apr/21 ] |
|
OK. I've created
|
| Comment by Jakub Skoczen [ 20/Apr/21 ] |
|
Marc Johnson Oleksandr_Dekin Guys, can you comment if
|
| Comment by Marc Johnson [ 20/Apr/21 ] |
|
Jakub Skoczen
|