0

My development environment(JDK, Maven) is setup within WSL2. With this setup, there are test failures

Below is the output of the build process.

00:18:14.261 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.sudhirt.practice.testcontainers.repository.DatabaseTests]        00:18:14.263 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.sudhirt.practice.testcontainers.repository.DatabaseTests]
00:18:14.267 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.sudhirt.practice.testcontainers.repository.DatabaseTests]        00:18:14.268 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.sudhirt.practice.testcontainers.repository.DatabaseTests]
00:18:14.271 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.sudhirt.practice.testcontainers.repository.DatabaseTests]
00:18:14.272 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.sudhirt.practice.testcontainers.repository.DatabaseTests]
00:18:14.303 [main] DEBUG org.testcontainers.utility.TestcontainersConfiguration - Testcontainers configuration overrides will be loaded from file:/home/sudhirtumati/.testcontainers.properties
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.155 s <<< FAILURE! - in com.sudhirt.practice.testcontainers.repository.DatabaseTests
[ERROR] com.sudhirt.practice.testcontainers.repository.DatabaseTests  Time elapsed: 1.151 s  <<< ERROR!                                                                                                                  java.lang.ExceptionInInitializerError
        at com.sudhirt.practice.testcontainers.repository.DatabaseTests.<clinit>(DatabaseTests.java:23)

[INFO]
[INFO] Results:
[INFO]                                                                                                                                                                                                                   [ERROR] Errors:                                                                                                                                                                                                          [ERROR]   DatabaseTests.com.sudhirt.practice.testcontainers.repository.DatabaseTests ยป ExceptionInInitializer                                                                                                            [INFO]                                                                                                                                                                                                                   [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0                                                                                                                                                                 [INFO]                                                                                                                                                                                                                   [INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

Line 23 of DatabaseTests is:

@ClassRule
public static OracleContainer oracleContainer = new OracleContainer();

The complete source code is available on github.

Any suggestions to fix this issue?

Sudhir
  • 1,339
  • 2
  • 15
  • 36

1 Answers1

2

From the documentation of the Oracle-XE Module:

If you do not pass an image name to the OracleContainer constructor, a suitable image name should be placed in configuration instead. To do this, please place a file on the classpath named testcontainers.properties, containing oracle.container.image=IMAGE, where IMAGE is a suitable image name and tag.

I see nothing in your code that does this. new OracleContainer() is not enough.