From 8c11ca4bbf6cf0209d378ded0cfa02816e8d2c6e Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Mon, 23 Oct 2023 13:21:10 -0400 Subject: [PATCH 1/5] Add integration config, adjust config --- .github/workflows/pr.yml | 15 +++++++++++++-- src/integration/data/query.test.ts | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 2dac6c26..7a7b6c76 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -43,18 +43,29 @@ jobs: strategy: fail-fast: false matrix: - jest_env: ['node', 'edge'] + config: + [ + { runner: 'npm', jest_env: 'node' }, + { runner: 'npm', jest_env: 'edge' }, + { runner: 'bun', jest_env: 'node', bunVersion: '1.0.4' }, + { runner: 'bun', jest_env: 'node', bunVersion: '1.0.7' }, + ] steps: - name: Checkout uses: actions/checkout@v3 - name: Setup uses: ./.github/actions/setup + - name: Setup bun + if: matrix.config.bunVersion + uses: oven-sh/setup-bun@v1 + with: + bun-version: ${{ matrix.config.bunVersion }} - name: Run tests env: CI: true PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} PINECONE_ENVIRONMENT: ${{ secrets.PINECONE_ENVIRONMENT }} - run: npm run test:integration:${{ matrix.jest_env }} + run: npm run test:integration:${{ matrix.config.jest_env }} example-app-semantic-search: name: 'Example app: semantic search' diff --git a/src/integration/data/query.test.ts b/src/integration/data/query.test.ts index 2791fbe4..e3cf98a7 100644 --- a/src/integration/data/query.test.ts +++ b/src/integration/data/query.test.ts @@ -94,4 +94,22 @@ describe('query', () => { expect(results.matches).toBeDefined(); expect(results.matches?.length).toEqual(topK); }); + + test('query with includeValues: true', async () => { + const recordsToUpsert = generateRecords(5, 3); + expect(recordsToUpsert).toHaveLength(3); + + const queryVec = Array.from({ length: 5 }, () => Math.random()); + + await ns.upsert(recordsToUpsert); + const results = await ns.query({ + vector: queryVec, + topK: 2, + includeValues: true, + includeMetadata: true, + }); + + expect(results.matches).toBeDefined(); + expect(results.matches?.length).toEqual(2); + }); }); From bfbf7112de5f1f979f0bc077ef4b80818580c7de Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Mon, 23 Oct 2023 14:11:53 -0400 Subject: [PATCH 2/5] Limit parallelism in tests --- .github/workflows/pr.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 7a7b6c76..3626a0ff 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -42,11 +42,11 @@ jobs: runs-on: ubuntu-latest strategy: fail-fast: false + max-parallel: 2 matrix: - config: - [ - { runner: 'npm', jest_env: 'node' }, - { runner: 'npm', jest_env: 'edge' }, + config: [ + # { runner: 'npm', jest_env: 'node' }, + # { runner: 'npm', jest_env: 'edge' }, { runner: 'bun', jest_env: 'node', bunVersion: '1.0.4' }, { runner: 'bun', jest_env: 'node', bunVersion: '1.0.7' }, ] From 05c8a0601eed4f52c8929e5edcc17a418fd3496e Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Mon, 23 Oct 2023 14:14:58 -0400 Subject: [PATCH 3/5] Use runner from config --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 3626a0ff..d37414ff 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -65,7 +65,7 @@ jobs: CI: true PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} PINECONE_ENVIRONMENT: ${{ secrets.PINECONE_ENVIRONMENT }} - run: npm run test:integration:${{ matrix.config.jest_env }} + run: ${{ matrix.config.runner }} run test:integration:${{ matrix.config.jest_env }} example-app-semantic-search: name: 'Example app: semantic search' From b377b57c8892f8fcf40a032d7cb2e21eb94b6f39 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Wed, 25 Oct 2023 11:09:25 -0400 Subject: [PATCH 4/5] Add more bun versions --- .github/workflows/pr.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index d37414ff..35a61a3e 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -48,11 +48,13 @@ jobs: # { runner: 'npm', jest_env: 'node' }, # { runner: 'npm', jest_env: 'edge' }, { runner: 'bun', jest_env: 'node', bunVersion: '1.0.4' }, - { runner: 'bun', jest_env: 'node', bunVersion: '1.0.7' }, + { runner: 'bun', jest_env: 'node', bunVersion: '1.0.5' }, + { runner: 'bun', jest_env: 'node', bunVersion: '1.0.6' }, + { runner: 'bun', jest_env: 'node', bunVersion: '1.0.7' } ] steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup uses: ./.github/actions/setup - name: Setup bun From bc35bd5e6fde64b6e7926dfaf9226de6009addd1 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Wed, 25 Oct 2023 11:48:59 -0400 Subject: [PATCH 5/5] Temporarily scope tests to one file --- .github/workflows/pr.yml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 35a61a3e..c78e7c22 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -50,7 +50,7 @@ jobs: { runner: 'bun', jest_env: 'node', bunVersion: '1.0.4' }, { runner: 'bun', jest_env: 'node', bunVersion: '1.0.5' }, { runner: 'bun', jest_env: 'node', bunVersion: '1.0.6' }, - { runner: 'bun', jest_env: 'node', bunVersion: '1.0.7' } + { runner: 'bun', jest_env: 'node', bunVersion: '1.0.7' }, ] steps: - name: Checkout diff --git a/package.json b/package.json index a9f23894..a64c95f1 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "format": "prettier --write .", "lint": "eslint src/ --ext .ts", "repl": "npm run build && node utils/replInit.ts", - "test:integration:node": "TEST_ENV=node jest src/integration/ -c jest.config.integration-node.js --runInBand --bail", + "test:integration:node": "TEST_ENV=node jest src/integration/data/query.test.ts -c jest.config.integration-node.js --runInBand --bail", "test:integration:edge": "TEST_ENV=edge jest src/integration/ -c jest.config.integration-edge.js --runInBand --bail", "test:integration:cleanup": "npm run build && node utils/cleanupResources.ts", "test:unit": "jest src/"