testcontainers / testcontainers-java

Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
https://testcontainers.org
MIT License
7.97k stars 1.64k forks source link

[Bug]: Couchbase Community Edition 7.6 fails to start #8989

Closed dnault closed 1 month ago

dnault commented 1 month ago

Module

Couchbase

Testcontainers version

1.20.0

Using the latest Testcontainers version?

Yes

Host OS

macOS

Host Arch

arm64

Docker version

Client:
 Cloud integration: v1.0.35+desktop.10
 Version:           25.0.2
 API version:       1.44
 Go version:        go1.21.6
 Git commit:        29cf629
 Built:             Thu Feb  1 00:18:45 2024
 OS/Arch:           darwin/arm64
 Context:           desktop-linux

Server: Docker Desktop 4.27.1 (136059)
 Engine:
  Version:          25.0.2
  API version:      1.44 (minimum version 1.24)
  Go version:       go1.21.6
  Git commit:       fce6e0c
  Built:            Thu Feb  1 00:23:21 2024
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.28
  GitCommit:        ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

What happened?

When using CouchbaseContainer with Community Edition (CE) 7.6.2, the container fails to start because CE rejects the attempt to configure alternate addresses for TLS ports. This is new behavior, not exhibited in earlier CE versions.

To reproduce the problem, try to start a CouchbaseContainer using image "couchbase/server:community-7.6.2"

Relevant log output

2024-07-24T16:02:36,253-07:00 [main] INFO  tc.couchbase/server:community-7.6.2 - Creating container for image: couchbase/server:community-7.6.2
2024-07-24T16:02:36,276-07:00 [main] INFO  tc.couchbase/server:community-7.6.2 - Container couchbase/server:community-7.6.2 is starting: 8891e0274f1aca671c7096e58cf9ee76b88b09303c1f8e0cb1124130fb62ef77
2024-07-24T16:02:36,453-07:00 [main] INFO  org.testcontainers.containers.wait.strategy.HttpWaitStrategy - /loving_ride: Waiting for 60 seconds for URL: http://localhost:64698/pools (where port 64698 maps to container port 8091)
2024-07-24T16:02:42,749-07:00 [main] ERROR tc.couchbase/server:community-7.6.2 - Could not start container
java.lang.IllegalStateException: Could not configure external ports: Response{protocol=http/1.1, code=400, message=Bad Request, url=http://localhost:64698/node/controller/setupAlternateAddresses/external}, body=Cannot set external ports ["ftsSSL","n1qlSSL","capiSSL","kvSSL","mgmtSSL"] as services are unavailable on the node.
    at org.testcontainers.couchbase.CouchbaseContainer.checkSuccessfulResponse(CouchbaseContainer.java:751) ~[couchbase-1.20.0.jar:?]
    at org.testcontainers.couchbase.CouchbaseContainer.configureExternalPorts(CouchbaseContainer.java:544) ~[couchbase-1.20.0.jar:?]
    at org.testcontainers.couchbase.CouchbaseContainer.timePhase(CouchbaseContainer.java:809) ~[couchbase-1.20.0.jar:?]
    at org.testcontainers.couchbase.CouchbaseContainer.containerIsStarting(CouchbaseContainer.java:352) ~[couchbase-1.20.0.jar:?]
    at org.testcontainers.containers.GenericContainer.containerIsStarting(GenericContainer.java:712) ~[testcontainers-1.20.0.jar:1.20.0]
    at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:489) ~[testcontainers-1.20.0.jar:1.20.0]
    at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:354) ~[testcontainers-1.20.0.jar:1.20.0]
    at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81) [duct-tape-1.0.8.jar:?]
    at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:344) [testcontainers-1.20.0.jar:1.20.0]
    at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:330) [testcontainers-1.20.0.jar:1.20.0]
2024-07-24T16:02:42,782-07:00 [main] ERROR tc.couchbase/server:community-7.6.2 - Log output from the failed container:
Starting Couchbase Server -- Web UI available at http://<ip>:8091
and logs available in /opt/couchbase/var/lib/couchbase/logs

Additional Information

No response

dnault commented 1 month ago

I'll submit a PR in a moment.