Skip to content

Commit 70a6323

Browse files
committed
test(cbjs): make search suite sequential
1 parent b9ea201 commit 70a6323

File tree

4 files changed

+2002
-5596
lines changed

4 files changed

+2002
-5596
lines changed

packages/deploy/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
"dependencies": {
3838
"@cbjsdev/cbjs": "workspace:*",
3939
"@cbjsdev/http-client": "workspace:*",
40-
"@cbjsdev/shared": "workspace:*"
40+
"@cbjsdev/shared": "workspace:*",
41+
"ts-retry-promise": "^0.8.0"
4142
},
4243
"devDependencies": {
4344
"typescript": "5.4.5",

packages/deploy/src/clusterChanges/applyCouchbaseClusterChanges.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { retry } from 'ts-retry-promise';
2+
13
import { Cluster, keyspacePath } from '@cbjsdev/cbjs';
24
import {
35
CouchbaseHttpApiConfig,
@@ -12,7 +14,7 @@ import {
1214
waitForUser,
1315
whoami,
1416
} from '@cbjsdev/http-client';
15-
import { waitFor } from '@cbjsdev/shared';
17+
import { hasOwn, waitFor } from '@cbjsdev/shared';
1618

1719
import {
1820
CouchbaseClusterChange,
@@ -96,7 +98,22 @@ export async function applyCouchbaseClusterChanges(
9698

9799
for (const change of changes) {
98100
const operation = operations[change.type];
99-
await operation(cluster, apiConfig, change as never, resolvedOptions);
101+
102+
// We retry the operation only in case of internal failure - often the server is getting
103+
// overwhelmed in CI
104+
await retry(() => operation(cluster, apiConfig, change as never, resolvedOptions), {
105+
retries: 3,
106+
delay: 5_000,
107+
retryIf: (err) => {
108+
if (err instanceof Error && hasOwn(err, 'errors') && Array.isArray(err.errors)) {
109+
return err.errors.some(
110+
(e) => hasOwn(e, 'code') && (e as { code: number }).code === 5000
111+
);
112+
}
113+
114+
return false;
115+
},
116+
});
100117
}
101118
}
102119

0 commit comments

Comments
 (0)