Skip to content

Commit c7ad631

Browse files
fix: stabilize stream/cursor CI flakes and run single-topology on small runners
1 parent 9be70ca commit c7ad631

5 files changed

Lines changed: 74 additions & 22 deletions

File tree

.circleci/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ All integration and browser jobs attach **`context: docker-hub`**.
2525

2626
| Job | Executor | Resource class |
2727
| --- | -------- | -------------- |
28-
| **`node-test`** | `n22` / `n24` | `arangodb/medium-arm64-privileged` |
28+
| **`node-test`** (single / HTTP smoke) | `n22` / `n24` | `arangodb/small-arm64-privileged` |
29+
| **`node-test`** (cluster) | `n22` / `n24` | `arangodb/medium-arm64-privileged` |
2930
| **`browser-smoke`** | `n24-browser` (`cimg/node:24.4`) | `arangodb/medium-amd64-privileged` |
3031

3132
- **`setup-docker`** — install Docker CLI, start in-container `dockerd` (DinD).
@@ -122,15 +123,15 @@ All run when **`docker-img`** is set (Trigger Pipeline). They use the same **`<<
122123
| ------------------- | ----------------------------------------------- |
123124
| **Docker DB image** | `<<pipeline.parameters.docker-img>>` |
124125
| **Node** | `n22`, `n24` |
125-
| **Topology** | `single`, `cluster` |
126+
| **Topology** | `single` (small runners), `cluster` (medium) |
126127
| **SSL** | `true`, `false` |
127128
| **Module system** | `cjs`, `esm` |
128129
| **HTTP** | Default `**h1`** only (no `http_proto` matrix). |
129130

130131

131-
**Job count:** 2 × 2 × 2 × 2 = **16**.
132+
**Job count:** 2 × 2 × 2 × 2 = **16** (8 single + 8 cluster).
132133

133-
**Naming:** `<node>-<topology>-ssl<true|false>-<cjs|esm>`
134+
**Naming:** `<node>-single-ssl<true|false>-<cjs|esm>` | `<node>-cluster-ssl<true|false>-<cjs|esm>`
134135

135136
### B) `integration-http-proto-smoke-given-db-image` (**2** jobs)
136137

.circleci/config.yml

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,9 @@ executors:
9696
n22:
9797
docker:
9898
- image: cimg/node:22.22.3
99-
resource_class: arangodb/medium-arm64-privileged
10099
n24:
101100
docker:
102101
- image: cimg/node:24.16.0
103-
resource_class: arangodb/medium-arm64-privileged
104102
n24-browser:
105103
docker:
106104
- image: cimg/node:24.16.0
@@ -128,7 +126,12 @@ jobs:
128126
module-system:
129127
type: enum
130128
enum: ['cjs', 'esm']
129+
# Single-server DinD fits small; cluster stays on medium.
130+
resource_class:
131+
type: string
132+
default: 'arangodb/medium-arm64-privileged'
131133
executor: <<parameters.node>>
134+
resource_class: <<parameters.resource_class>>
132135
steps:
133136
- timeout
134137
- checkout
@@ -271,6 +274,7 @@ workflows:
271274
name: single-<<matrix.node>>-ssl<<matrix.ssl>>-<<matrix.module-system>>-312
272275
context: docker-hub
273276
topology: single
277+
resource_class: arangodb/small-arm64-privileged
274278
filters:
275279
branches:
276280
ignore: stable
@@ -291,6 +295,7 @@ workflows:
291295
name: single-<<matrix.node>>-ssl<<matrix.ssl>>-<<matrix.module-system>>-4.0-nightly
292296
context: docker-hub
293297
topology: single
298+
resource_class: arangodb/small-arm64-privileged
294299
filters:
295300
branches:
296301
ignore: stable
@@ -367,6 +372,7 @@ workflows:
367372
ignore: stable
368373
docker-img: 'gcr.io/gcr-for-testing/arangodb/enterprise:3.12'
369374
topology: single
375+
resource_class: arangodb/small-arm64-privileged
370376
ssl: 'true'
371377
http_proto: h1
372378
node: n24
@@ -379,6 +385,7 @@ workflows:
379385
ignore: stable
380386
docker-img: 'gcr.io/gcr-for-testing/arangodb/enterprise:3.12'
381387
topology: single
388+
resource_class: arangodb/small-arm64-privileged
382389
ssl: 'true'
383390
http_proto: h2
384391
node: n24
@@ -409,8 +416,30 @@ workflows:
409416
when: <<pipeline.parameters.docker-img>>
410417
jobs:
411418
- node-test:
412-
name: <<matrix.node>>-<<matrix.topology>>-ssl<<matrix.ssl>>-<<matrix.module-system>>
419+
name: <<matrix.node>>-single-ssl<<matrix.ssl>>-<<matrix.module-system>>
413420
context: docker-hub
421+
topology: single
422+
resource_class: arangodb/small-arm64-privileged
423+
filters:
424+
branches:
425+
ignore: stable
426+
matrix:
427+
parameters:
428+
docker-img:
429+
- <<pipeline.parameters.docker-img>>
430+
node:
431+
- 'n22'
432+
- 'n24'
433+
ssl:
434+
- 'true'
435+
- 'false'
436+
module-system:
437+
- 'cjs'
438+
- 'esm'
439+
- node-test:
440+
name: <<matrix.node>>-cluster-ssl<<matrix.ssl>>-<<matrix.module-system>>
441+
context: docker-hub
442+
topology: cluster
414443
filters:
415444
branches:
416445
ignore: stable
@@ -421,9 +450,6 @@ workflows:
421450
node:
422451
- 'n22'
423452
- 'n24'
424-
topology:
425-
- 'single'
426-
- 'cluster'
427453
ssl:
428454
- 'true'
429455
- 'false'
@@ -443,6 +469,7 @@ workflows:
443469
ignore: stable
444470
docker-img: <<pipeline.parameters.docker-img>>
445471
topology: single
472+
resource_class: arangodb/small-arm64-privileged
446473
ssl: 'true'
447474
http_proto: h1
448475
node: n24
@@ -455,6 +482,7 @@ workflows:
455482
ignore: stable
456483
docker-img: <<pipeline.parameters.docker-img>>
457484
topology: single
485+
resource_class: arangodb/small-arm64-privileged
458486
ssl: 'true'
459487
http_proto: h2
460488
node: n24

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ This driver uses semantic versioning:
2222
on the default `globalThis.fetch` path (not only when using `config.agentOptions`) by removing
2323
manual `Content-Length` header handling by default and letting `fetch` set it from the request body.
2424
([#855](https://github.com/arangodb/arangojs/issues/855))
25+
- Tests: Stream query setup inserts and parallel stream opens are chunked; multi-batch cursor
26+
tests use a longer `ttl` to avoid intermittent CI timeouts / `cursor not found` under load.
2527

2628
### Added
2729

@@ -34,6 +36,8 @@ This driver uses semantic versioning:
3436

3537
### Changed
3638

39+
- CI: Single-topology and HTTP proto smoke `node-test` jobs use
40+
`arangodb/small-arm64-privileged`; cluster jobs keep `arangodb/medium-arm64-privileged`.
3741
- Dev: Builds use **TypeScript 7** (`@typescript/native``typescript@^7.0.2`) for `tsc`. The
3842
`typescript` package is aliased to `@typescript/typescript6` so tools that still need the
3943
TypeScript 6 programmatic API (TypeDoc, typescript-eslint) keep working until a TS 7 API ships.

src/test/08-cursors.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,8 @@ describe("Batch-wise Cursor API", function () {
276276
}
277277
});
278278
beforeEach(async () => {
279-
cursor = (await db.query(aqlQuery, { batchSize: 1 })).batches;
279+
// batchSize:1 needs many round-trips; keep cursor alive under slow CI/cluster.
280+
cursor = (await db.query(aqlQuery, { batchSize: 1, ttl: 120 })).batches;
280281
allCursors.push(cursor);
281282
});
282283
describe("for await of cursor", () => {

src/test/23-aql-queries-stream.ts

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,23 @@ import {
1010
waitForNewDatabase,
1111
} from "./_integration-timeouts.js";
1212

13+
/** Cap in-flight writes/streams so small CI runners and cluster LBs stay responsive. */
14+
const insertChunk = 100;
15+
const streamOpenChunk = 5;
16+
const docCount = 1000;
17+
const parallelStreamCount = 25;
18+
19+
async function parallelInChunks(
20+
count: number,
21+
chunk: number,
22+
run: (index: number) => Promise<unknown>,
23+
): Promise<void> {
24+
for (let i = 0; i < count; i += chunk) {
25+
const n = Math.min(chunk, count - i);
26+
await Promise.all(Array.from({ length: n }, (_, j) => run(i + j)));
27+
}
28+
}
29+
1330
describe("AQL Stream queries", function () {
1431
this.timeout(clusterIntegrationTimeoutMs);
1532
const name = `testdb_${Date.now()}`;
@@ -70,18 +87,18 @@ describe("AQL Stream queries", function () {
7087
expect(cursor.batches.hasMore).to.equal(true);
7188
});
7289
});
73-
describe("with some data", () => {
90+
describe("with some data", function () {
91+
// Setup inserts many docs; keep headroom above the single-topology 60s suite ceiling.
92+
this.timeout(Math.max(clusterIntegrationTimeoutMs, 120_000));
7493
const cname = "MyTestCollection";
7594
before(async () => {
7695
const collection = await db.createCollection(cname);
7796
await db.waitForPropagation(
7897
{ pathname: `/_api/collection/${collection.name}` },
7998
propagationForResourceMs,
8099
);
81-
await Promise.all(
82-
Array.from(Array(1000).keys()).map((i: number) =>
83-
collection.save({ hallo: i }),
84-
),
100+
await parallelInChunks(docCount, insertChunk, (i) =>
101+
collection.save({ hallo: i }),
85102
);
86103
});
87104
/*after(async () => {
@@ -90,21 +107,22 @@ describe("AQL Stream queries", function () {
90107
it("can access large collection in parallel", async () => {
91108
const collection = db.collection(cname);
92109
const query = aql`FOR doc in ${collection} RETURN doc`;
93-
const options = { batchSize: 250, stream: true };
110+
const options = { batchSize: 250, stream: true, ttl: 120 };
94111

95112
let count = 0;
96-
const cursors = await Promise.all(
97-
Array.from(Array(25)).map(() => db.query(query, options)),
98-
);
113+
const cursors: Cursor[] = [];
114+
await parallelInChunks(parallelStreamCount, streamOpenChunk, async () => {
115+
cursors.push(await db.query(query, options));
116+
});
99117
allCursors.push(...cursors);
100118
await Promise.all(
101119
cursors.map((c) =>
102-
(c as Cursor).forEach(() => {
120+
c.forEach(() => {
103121
count++;
104122
}),
105123
),
106124
);
107-
expect(count).to.equal(25 * 1000);
125+
expect(count).to.equal(parallelStreamCount * docCount);
108126
});
109127
it("can do writes and reads", async () => {
110128
const collection = db.collection(cname);

0 commit comments

Comments
 (0)