[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:
Relates
relates to FOLIO-1845 Replace postgresql-embedded by testco... Closed
relates to RMB-826 Only use postgresTester (testContaine... Closed
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:
https://github.com/folio-org/raml-module-builder#postgresql-integration

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
reports that Windows 10 Pro can run Testcontainers without Vagrant: Use Docker Desktop Community 3.0.4 with default settings, one of the defaults is that "Use the WSL 2 based engine" is enabled.

Comment by Marc Johnson [ 15/Apr/21 ]

Julian Ladisch

RMB has configuration options to point to some other external PostgreSQL server

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 RMB-826 Closed .. Let me know if that procedure is what we want. This way module implements have do do "nothing" and call PostgresClient.setPostgresTester(new PostgresTesterContainer()) unconditonally and containers will not be used if DB configuration is present.

Comment by Jakub Skoczen [ 20/Apr/21 ]

Marc Johnson Oleksandr_Dekin Guys, can you comment if RMB-826 Closed addresses this problem sufficiently? Thanks.

Comment by Marc Johnson [ 20/Apr/21 ]

Jakub Skoczen RMB-826 Closed covers what I was talking about in the Technical Leads meeting.

Generated at Thu Feb 08 23:25:45 UTC 2024 using Jira 1001.0.0-SNAPSHOT#100246-sha1:7a5c50119eb0633d306e14180817ddef5e80c75d.