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

Testcontainers not closing correctly after tests #666

Open
jczuchnowski opened this issue May 26, 2022 · 1 comment
Open

Testcontainers not closing correctly after tests #666

jczuchnowski opened this issue May 26, 2022 · 1 comment
Labels
bug Something isn't working ziohackathon

Comments

@jczuchnowski
Copy link
Member

jczuchnowski commented May 26, 2022

When running the tests from sbt with:

sbt test

some of the containers don't close after running the tests finish. Resulting in:
testcontainers

Perhaps there's a problem with how zio.sql.TestContainer and zio.sql.JdbcRunnableSpec are interacting with ZIO Test.

Also it seems like closing sbt also closes these containers after couple of seconds.

@jczuchnowski jczuchnowski added bug Something isn't working ziohackathon labels May 26, 2022
@kyledinh
Copy link

kyledinh commented Oct 28, 2022

I pulled the latest and ran the test and the containers are cleaning themselves afterwards:

    + lower
    + trim
37 tests passed. 0 tests failed. 1 tests ignored.

Executed in 7 m 16 s

[info] Completed tests
[error] (postgres / Test / test) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 296 s (04:56), completed Oct 28, 2022, 3:08:38 AM
sbt test  295.43s user 20.04s system 103% cpu 5:03.57 total

*[master][~/src/github.com/zio/zio-sql]$ docker ps                                                        
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
*[master][~/src/github.com/zio/zio-sql]$ 

I was getting this error with the default sbt settings:

[error] ## Exception when compiling 4 sources to /Users/kyle/src/github.com/zio/zio-sql/sqlserver/target/scala-2.13/test-classes
[error] java.lang.OutOfMemoryError: Java heap space
[error] 
[error]            
+ Hikaricp module
java.lang.OutOfMemoryError: Java heap space
[error] [launcher] error during sbt launcher: java.lang.OutOfMemoryError: Java heap space

Solved it with:

export SBT_OPTS="-Xms1024M -Xmx4G -Xss2M -XX:MaxMetaspaceSize=2G"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ziohackathon
Projects
None yet
Development

No branches or pull requests

2 participants