Skip to content

Commit 60a9aa9

Browse files
committed
test(http-client): wait for the collection to be ready before creating an index on it
1 parent 952d7ec commit 60a9aa9

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

tests/http-client/tests/query/getQueryIndexStatus.spec.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
*/
1616
import { describe } from 'vitest';
1717

18-
import { getQueryIndexStatus } from '@cbjsdev/http-client';
18+
import {
19+
getQueryIndexStatus,
20+
waitForCollection,
21+
waitForQueryIndexer,
22+
} from '@cbjsdev/http-client';
1923
import { createCouchbaseTest } from '@cbjsdev/vitest';
2024

2125
describe('getQueryIndexStatus', { timeout: 40_000, retry: 2 }, async () => {
@@ -27,6 +31,12 @@ describe('getQueryIndexStatus', { timeout: 40_000, retry: 2 }, async () => {
2731
serverTestContext,
2832
apiConfig,
2933
}) => {
34+
await waitForCollection(
35+
apiConfig,
36+
serverTestContext.bucket.name,
37+
serverTestContext.scope.name,
38+
serverTestContext.collection.name
39+
);
3040
const name = await useIndex({
3141
bucketName: serverTestContext.bucket.name,
3242
scopeName: serverTestContext.scope.name,

vitest.shared.projects.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default defineProject({
3939
minWorkers: 1,
4040
maxWorkers: 1,
4141
env: {
42-
CB_CONNECTION_STRING: process.env.CB_CONNECTION_STRING ?? 'couchbase://localhost',
42+
CB_CONNECTION_STRING: process.env.CB_CONNECTION_STRING ?? 'couchbase://127.0.0.1',
4343
CB_USER: process.env.CB_USER ?? 'Administrator',
4444
CB_PASSWORD: process.env.CB_PASSWORD ?? 'password',
4545
DEBUG: '1',

0 commit comments

Comments
 (0)