testcontainers-node
testcontainers-node copied to clipboard
Couchbase module tests fail in Node 20.x
Expected Behaviour Couchbase module test should pass with Node 20x LTS version
Actual Behaviour Couchbase module fails localy or in our pipeline running Node 20.x lts version
Steps to Reproduce
- With Node 20.x version, run test to Couchbase module
npm run test -- packages/modules/couchbase - See error:
FAIL packages/modules/couchbase/src/couchbase-container.test.ts (78.392 s)
CouchbaseContainer
Enterprise Image
✕ should connect and query using enterprise image (27383 ms)
✕ should flush bucket if flushEnabled and check any document exists (7864 ms)
Community Image
✕ should connect and query using community image (19874 ms)
✕ should flush bucket if flushEnabled and check any document exists (6583 ms)
✓ should throw error if analytics service enabled with community version (6474 ms)
✓ should throw error if eventing service enabled with community version (6435 ms)
● CouchbaseContainer › Enterprise Image › should connect and query using enterprise image
Could not perform request against couchbase HTTP endpoint FetchError: request to http://localhost:32778/node/controller/setupAlternateAddresses/external failed, reason: socket hang up
96 | });
97 | } catch (e) {
> 98 | throw new Error(`Could not perform request against couchbase HTTP endpoint ${e}`);
| ^
99 | }
100 | }
101 |
at CouchbaseContainer.doHttpRequest (src/couchbase-container.ts:98:13)
at async CouchbaseContainer.configureExternalPorts (src/couchbase-container.ts:336:22)
at async CouchbaseContainer.containerStarted (src/couchbase-container.ts:543:5)
at async CouchbaseContainer.startContainer (../../testcontainers/src/generic-container/generic-container.ts:213:7)
at async CouchbaseContainer.start (src/couchbase-container.ts:567:42)
at async Object.<anonymous> (src/couchbase-container.test.ts:55:30)
Environment Information
- Operating System: Mac os but Ubuntu Linux 22 too reproducible
- Docker Version: 4.28.0
- Node version: Node 20.x lts
- Testcontainers version: 10.8.1
[!NOTE]
Some interesting things debugging this
If we set a breakpoint before the http call that is failing https://github.com/testcontainers/testcontainers-node/blob/main/packages/modules/couchbase/src/couchbase-container.ts#L301
configureExternalPorts
and we do instead of a http call a curl call, the results to this curls its ok
curl -v -X PUT -u Administrator:password http://127.0.0.1:32944/node/controller/setupAltern
ateAddresses/external -d hostname=127.0.0.1 -d mgmt=32944
* Trying 127.0.0.1:32944...
* Connected to 127.0.0.1 (127.0.0.1) port 32944
* Server auth using Basic with user 'Administrator'
> PUT /node/controller/setupAlternateAddresses/external HTTP/1.1
> Host: 127.0.0.1:32944
> Authorization: Basic QWRtaW5pc3RyYXRvcjpwYXNzd29yZA==
> User-Agent: curl/8.4.0
> Accept: */*
> Content-Length: 29
> Content-Type: application/x-www-form-urlencoded
>
< HTTP/1.1 200 OK
< Cache-Control: no-cache,no-store,must-revalidate
< Content-Length: 0
< Date: Tue, 26 Mar 2024 15:20:20 GMT
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Pragma: no-cache
< Server: Couchbase Server
< X-Content-Type-Options: nosniff
< X-Frame-Options: DENY
< X-Permitted-Cross-Domain-Policies: none
< X-XSS-Protection: 1; mode=block
<
* Connection #0 to host 127.0.0.1 left intact