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

PostgreSQLContainer pulls default image even if another one explicitly specified. #517

Closed
maksym72 opened this issue Dec 12, 2017 · 6 comments

Comments

@maksym72
Copy link

Container instantiation with explicit image:

@ClassRule
public static PostgreSQLContainer postgres = new PostgreSQLContainer("postgres:alpine");

Log output:
2017-12-12 15:23:38.850 INFO --- [ main] 🐳 [postgres:alpine] : Creating container for image: postgres:alpine 2017-12-12 15:23:38.938 INFO --- [ main] 🐳 [postgres:alpine] : Starting container with ID: e9db246598c07929ea134b43b469390ac47cd1f851b2f46f8280aea4bf13387c 2017-12-12 15:23:39.328 INFO --- [ main] 🐳 [postgres:alpine] : Container postgres:alpine is starting: e9db246598c07929ea134b43b469390ac47cd1f851b2f46f8280aea4bf13387c
...
2017-12-12 15:23:43.205 DEBUG --- [ main] o.t.containers.output.WaitingConsumer : STDERR: 2017-12-12 13:23:43.176 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" 2017-12-12 15:23:43.205 DEBUG --- [ main] o.t.containers.output.WaitingConsumer : STDERR: 2017-12-12 13:23:43.174 UTC [1] LOG: listening on IPv6 address "::", port 5432 2017-12-12 15:23:43.206 DEBUG --- [ main] o.t.containers.output.WaitingConsumer : STDERR: 2017-12-12 13:23:43.174 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 2017-12-12 15:23:43.217 DEBUG --- [ main] o.t.containers.output.WaitingConsumer : STDERR: 2017-12-12 13:23:43.191 UTC [45] LOG: database system was shut down at 2017-12-12 13:23:43 UTC 2017-12-12 15:23:43.228 DEBUG --- [ main] o.t.containers.output.WaitingConsumer : STDERR: 2017-12-12 13:23:43.193 UTC [1] LOG: database system is ready to accept connections 2017-12-12 15:23:43.228 INFO --- [ main] 🐳 [postgres:alpine] : Container postgres:alpine started
...
Now default image started

2017-12-12 15:23:55.859 INFO 10900 --- [ main] o.f.core.internal.util.VersionPrinter : Flyway 3.2.1 by Boxfuse 2017-12-12 15:23:55.914 INFO 10900 --- [ main] 🐳 [postgres:latest] : Pulling docker image: postgres:latest. Please be patient; this may take some time but only needs to be done once. 2017-12-12 15:41:33.404 INFO 10900 --- [ main] 🐳 [postgres:latest] : Creating container for image: postgres:latest 2017-12-12 15:41:33.574 INFO 10900 --- [ main] 🐳 [postgres:latest] : Starting container with ID: 6cb9a3ab79105646cdd23e26739e2a72a775aa18dfcb7753c5c5f637860f8818 2017-12-12 15:41:34.425 INFO 10900 --- [ main] 🐳 [postgres:latest] : Container postgres:latest is starting: 6cb9a3ab79105646cdd23e26739e2a72a775aa18dfcb7753c5c5f637860f8818 2017-12-12 15:41:35.550 DEBUG 10900 --- [ main] o.t.containers.output.WaitingConsumer : STDOUT: creating subdirectories ... ok 2017-12-12 15:41:35.551 DEBUG 10900 --- [ main] o.t.containers.output.WaitingConsumer : STDOUT: fixing permissions on existing directory /var/lib/postgresql/data ... ok ... STDERR: 2017-12-12 13:41:43.329 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" 2017-12-12 15:41:43.359 DEBUG 10900 --- [ main] o.t.containers.output.WaitingConsumer : STDERR: 2017-12-12 13:41:43.327 UTC [1] LOG: listening on IPv6 address "::", port 5432 2017-12-12 15:41:43.359 DEBUG 10900 --- [ main] o.t.containers.output.WaitingConsumer : STDERR: 2017-12-12 13:41:43.327 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 2017-12-12 15:41:43.374 DEBUG 10900 --- [ main] o.t.containers.output.WaitingConsumer : STDERR: 2017-12-12 13:41:43.345 UTC [62] LOG: database system was shut down at 2017-12-12 13:41:43 UTC 2017-12-12 15:41:43.384 DEBUG 10900 --- [ main] o.t.containers.output.WaitingConsumer : STDERR: 2017-12-12 13:41:43.351 UTC [1] LOG: database system is ready to accept connections 2017-12-12 15:41:43.384 INFO 10900 --- [ main] 🐳 [postgres:latest] : Container postgres:latest started

@kiview
Copy link
Member

kiview commented Dec 12, 2017

Hi @maksym72 ,

can you reproduce this behavior if you run CustomizablePostgreSQLTest from master with "postgres:alpine" as image name? Does not happen for me.

@maksym72
Copy link
Author

With this simple test it is working just fine. I guess it has something todo with loading Spring context with @SpringBootTest.

@bsideup
Copy link
Member

bsideup commented Dec 12, 2017

@maksym72 make sure you don't use tc:jdbc: URLs if you instantiate containers manually

@maksym72
Copy link
Author

@bsideup What does it mean "instantiate containers manually"?

@kiview
Copy link
Member

kiview commented Dec 13, 2017

I think @bsideup refers to the interaction with your application.properties file.
If you've used tc:jdbc:, testcontainers will automatically launch a new database container once requested. In conjunction with a manually specified PostgreSQLContainer in your test, this could explain your behavior.

Can you share the project, for further investigation?

@maksym72
Copy link
Author

@kiview @bsideup Thank you for clearifying things up!

Got it working by specifying appropriate tag in JDBC connection string and removing explicit container start.

rnorth pushed a commit that referenced this issue Dec 24, 2018
Bumps [influxdb-java](https://github.com/influxdata/influxdb-java) from 2.10 to 2.14.
<details>
<summary>Changelog</summary>

*Sourced from [influxdb-java's changelog](https://github.com/influxdata/influxdb-java/blob/master/CHANGELOG.md).*

> ## 2.14 [2018-10-12]
> 
> ### Fixes
> 
> - Fixed chunked query exception handling [Issue #523](https://github-redirect.dependabot.com/influxdata/influxdb-java/issues/523)
> - Memory leak in StringBuilder cache for Point.lineprotocol() [Issue #526](https://github-redirect.dependabot.com/influxdata/influxdb-java/issues/521)
> 
> ## 2.13 [2018-09-12]
> 
> ### Fixes
> - MessagePack queries: Exception during parsing InfluxDB version [macOS] [PR #487](https://github-redirect.dependabot.com/influxdata/influxdb-java/issues/487)
> - The InfluxDBResultMapper is able to handle results with a different time precision [PR #501](https://github-redirect.dependabot.com/influxdata/influxdb-java/pull/501)
> - UDP target host address is cached [PR #502](https://github-redirect.dependabot.com/influxdata/influxdb-java/issues/502)
> - Error messages from server not parsed correctly when using msgpack [PR #506](https://github-redirect.dependabot.com/influxdata/influxdb-java/issues/506)
> - Response body must be closed properly in case of JSON response [PR #514](https://github-redirect.dependabot.com/influxdata/influxdb-java/issues/514)
> - Time is serialized not consistently in MsgPack and Json, missing millis and nanos in MsgPack[PR #517](https://github-redirect.dependabot.com/influxdata/influxdb-java/issues/517)
> 
> ### Features
> 
> - Support for Basic Authentication [PR #492](https://github-redirect.dependabot.com/influxdata/influxdb-java/pull/492)
> - Added possibility to reuse client as a core part of [influxdb-java-reactive](https://github.com/bonitoo-io/influxdb-java-reactive) client [PR #493](https://github-redirect.dependabot.com/influxdata/influxdb-java/pull/493)
> - Retry capability for writing of BatchPoints [PR #503](https://github-redirect.dependabot.com/influxdata/influxdb-java/issues/503)
> - Added `BiConsumer` with capability to discontinue a streaming query [Issue #515](https://github-redirect.dependabot.com/influxdata/influxdb-java/issues/515)
> - Added `onComplete` action that is invoked after successfully end of streaming query [Issue #515](https://github-redirect.dependabot.com/influxdata/influxdb-java/issues/515)
> 
> ## 2.12 [2018-07-31]
> 
> ### Fixes
> 
> - Remove code which checks for unsupported influxdb versions [PR #474](https://github-redirect.dependabot.com/influxdata/influxdb-java/pull/474)
> - Unpredictable errors when OkHttpClient.Builder instance is reused [PR #478](https://github-redirect.dependabot.com/influxdata/influxdb-java/pull/478)
> 
> ### Features
> 
> - Support for MessagePack [PR #471](https://github-redirect.dependabot.com/influxdata/influxdb-java/pull/471)
> - Cache version per influxdb instance and reduce ping() calls for every query call [PR #472](https://github-redirect.dependabot.com/influxdata/influxdb-java/pull/472)
> - FAQ list for influxdb-java [PR #475](https://github-redirect.dependabot.com/influxdata/influxdb-java/pull/475)
> 
> ### Improvements
> 
> - Test: Unit test to ensure tags should be sorted by key in line protocol (to reduce db server overheads) [PR #476](https://github-redirect.dependabot.com/influxdata/influxdb-java/pull/476)
> 
> ## 2.11 [2018-07-02]
> 
> ### Features
> 
> - Allow write precision of TimeUnit other than Nanoseconds [PR #321](https://github-redirect.dependabot.com/influxdata/influxdb-java/pull/321)
> - Support dynamic measurement name in InfluxDBResultMapper [PR #423](https://github-redirect.dependabot.com/influxdata/influxdb-java/pull/423)
> - Debug mode which allows HTTP requests being sent to the database to be logged [PR #450](https://github-redirect.dependabot.com/influxdata/influxdb-java/pull/450)
> - Fix problem of connecting to the influx api with URL which does not points to the url root (e.g. localhots:80/influx-api/) [PR #400] (https://github-redirect.dependabot.com/influxdata/influxdb-java/pull/400)
></table> ... (truncated)
</details>
<details>
<summary>Commits</summary>

- [`91d0f09`](influxdata/influxdb-java@91d0f09) [maven-release-plugin] prepare release influxdb-java-2.14
- [`8ffaeb9`](influxdata/influxdb-java@8ffaeb9) Revert "[maven-release-plugin] prepare release influxdb-java-2.14"
- [`2781da2`](influxdata/influxdb-java@2781da2) [maven-release-plugin] prepare release influxdb-java-2.14
- [`19c69ed`](influxdata/influxdb-java@19c69ed) [maven-release-plugin] prepare for next development iteration
- [`c6d7f25`](influxdata/influxdb-java@c6d7f25) [maven-release-plugin] prepare release influxdb-java-2.14
- [`2f4c594`](influxdata/influxdb-java@2f4c594) Merge pull request [#531](https://github-redirect.dependabot.com/influxdata/influxdb-java/issues/531) from heshengbang/master
- [`f653e62`](influxdata/influxdb-java@f653e62) Easy to use try-with-resources, add README.md
- [`c7be9b0`](influxdata/influxdb-java@c7be9b0) Easy to use try-with-resources
- [`4590d18`](influxdata/influxdb-java@4590d18) - added automated SNAPSHOT publishing to Maven Central repository
- [`ce65a41`](influxdata/influxdb-java@ce65a41) - added automated SNAPSHOT publishing to Maven Central repository
- Additional commits viewable in [compare view](influxdata/influxdb-java@influxdb-java-2.10...influxdb-java-2.14)
</details>
<br />

[![Dependabot compatibility score](https://api.dependabot.com/badges/compatibility_score?dependency-name=org.influxdb:influxdb-java&package-manager=gradle&previous-version=2.10&new-version=2.14)](https://dependabot.com/compatibility-score.html?dependency-name=org.influxdb:influxdb-java&package-manager=gradle&previous-version=2.10&new-version=2.14)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

**Note:** This repo was added to Dependabot recently, so you'll receive a maximum of 5 PRs for your first few update runs. Once an update run creates fewer than 5 PRs we'll remove that limit.

You can always request more updates by clicking `Bump now` in your [Dependabot dashboard](https://app.dependabot.com).

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in the `.dependabot/config.yml` file in this repo:
- Update frequency (including time of day and day of week)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Pull request limits (per update run and/or open at any time)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)

Finally, you can contact us by mentioning @dependabot.

</details>
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

3 participants