Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[spruce] integration tests #166

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Generate TypeDoc documentation
Expand Down
125 changes: 4 additions & 121 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Prettier
Expand All @@ -35,123 +35,6 @@ jobs:
- name: TypeDoc
uses: ./.github/actions/build-docs

run-integration-tests:
name: Run integration tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
jest_env: ['node', 'edge']
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
- name: Run tests
env:
CI: true
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
run: npm run test:integration:${{ matrix.jest_env }}

example-app-semantic-search:
name: 'Example app: semantic search'
runs-on: ubuntu-latest
steps:
- name: Checkout pinecone-ts-client
uses: actions/checkout@v4
with:
path: pinecone-ts-client
- name: Checkout semantic-search-example
uses: actions/checkout@v4
with:
repository: pinecone-io/semantic-search-example
path: semantic-search-example
- name: Install and build client
shell: bash
run: |
cd pinecone-ts-client
npm install --ignore-scripts
npm run build
- name: Install and build sample app
shell: bash
run: |
cd semantic-search-example
npm install --no-cache
npm install '../pinecone-ts-client'
cat package.json
- name: Run example tests with dev version of client
env:
CI: true
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
PINECONE_INDEX: 'semantic-search'
shell: bash
run: |
cd semantic-search-example
npm run test

unit-tests:
name: Run unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
- name: Run tests
env:
CI: true
run: npm run test:unit -- --coverage

typescript-compilation-tests:
name: TS compile
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
tsVersion:
[
'~4.1.0',
'~4.2.0',
'~4.3.0',
'~4.4.0',
'~4.5.0',
'~4.6.0',
'~4.7.0',
'~4.8.0',
'~4.9.0',
'~5.0.0',
'~5.1.0',
'~5.2.0',
'latest',
]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: 'https://registry.npmjs.org'
- name: Install npm packages
run: |
npm install --ignore-scripts
shell: bash
- name: Build typescript for pinecone
run: npm run build
shell: bash
- name: install, compile, and run sample app
shell: bash
env:
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
run: |
set -x
cd ..
cp -r pinecone-ts-client/ts-compilation-test ts-compilation-test
cd ts-compilation-test
npm install typescript@${{matrix.tsVersion}} --no-cache
npm install '../pinecone-ts-client' --no-cache
cat package.json
cat package-lock.json
npm run tsc-version
npm run build
npm run start
testing:
uses: './.github/workflows/testing.yml'
secrets: inherit
6 changes: 5 additions & 1 deletion .github/workflows/release-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ on:
- cron: '0 0 * * *'

jobs:
testing:
uses: './.github/workflows/testing.yml'
secrets: inherit

version-and-release:
name: Release dev build to NPM
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/release-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,18 @@ concurrency:
cancel-in-progress: true

jobs:
# integration-tests:
# if: ${{ github.event.inputs.runTests == 'true' }}
# uses: ./.github/workflows/PR.yml
# secrets: inherit
testing:
uses: './.github/workflows/testing.yml'
secrets: inherit

version-and-release:
name: Release to NPM
# needs: integration-tests
runs-on: ubuntu-latest
outputs:
tagName: ${{ steps.npm-release.outputs.release_tag }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release-spruce-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
- cron: '0 0 * * *'

jobs:
testing:
uses: './.github/workflows/testing.yml'
secrets: inherit

version-and-release:
name: Release dev build to NPM
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release-spruce.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
workflow_dispatch: {}

jobs:
testing:
uses: './.github/workflows/testing.yml'
secrets: inherit

version-and-release:
name: Release dev build to NPM
runs-on: ubuntu-latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Cleanup
Expand Down
143 changes: 143 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
name: Testing

on:
workflow_call: {}

jobs:
unit-tests:
name: Run unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Run tests
env:
CI: true
run: npm run test:unit -- --coverage

integration-tests:
name: Run integration tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
jest_env: ['node', 'edge']
pinecone_env: ['prod', 'staging']

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Run integration tests (prod)
if: matrix.pinecone_env == 'prod'
env:
CI: true
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
PINECONE_CONTROLLER_HOST: 'https://api.pinecone.io'
run: npm run test:integration:${{ matrix.jest_env }}

- name: Run integration tests (staging)
if: matrix.pinecone_env == 'staging'
env:
CI: true
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY_STAGING }}
PINECONE_CONTROLLER_HOST: 'https://api-staging.pinecone.io'
run: npm run test:integration:${{ matrix.jest_env }}

typescript-compilation-tests:
name: TS compile
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
tsVersion:
[
'~4.1.0',
'~4.2.0',
'~4.3.0',
'~4.4.0',
'~4.5.0',
'~4.6.0',
'~4.7.0',
'~4.8.0',
'~4.9.0',
'~5.0.0',
'~5.1.0',
'~5.2.0',
'latest',
]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: 'https://registry.npmjs.org'
- name: Install npm packages
run: |
npm install --ignore-scripts
shell: bash
- name: Build TypeScript for Pinecone
run: npm run build
shell: bash
- name: install, compile, and run sample app
shell: bash
env:
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
run: |
set -x
cd ..
cp -r pinecone-ts-client/ts-compilation-test ts-compilation-test
cd ts-compilation-test
npm install typescript@${{ matrix.tsVersion }} --no-cache
npm install '../pinecone-ts-client' --no-cache
cat package.json
cat package-lock.json
npm run tsc-version
npm run build
npm run start

example-app-semantic-search:
name: 'Example app: semantic search'
runs-on: ubuntu-latest
steps:
- name: Checkout pinecone-ts-client
uses: actions/checkout@v4
with:
path: pinecone-ts-client
- name: Checkout semantic-search-example
uses: actions/checkout@v4
with:
repository: pinecone-io/semantic-search-example
path: semantic-search-example
- name: Install and build client
shell: bash
run: |
cd pinecone-ts-client
npm install --ignore-scripts
npm run build
- name: Install and build sample app
shell: bash
run: |
cd semantic-search-example
npm install --no-cache
npm install '../pinecone-ts-client'
cat package.json
- name: Run example tests with dev version of client
env:
CI: true
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
PINECONE_INDEX: 'semantic-search'
shell: bash
run: |
cd semantic-search-example
npm run test
2 changes: 1 addition & 1 deletion src/control/__tests__/configureIndex.validation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('configureIndex argument validations', () => {

expect(toThrow).rejects.toThrowError(PineconeArgumentError);
expect(toThrow).rejects.toThrowError(
'The second argument to configureIndex should not be empty object. Please specify at least one propert (replicas, podType) to update.'
'The second argument to configureIndex should not be empty object. Please specify at least one property (replicas, podType) to update.'
);
});

Expand Down
6 changes: 3 additions & 3 deletions src/control/__tests__/createIndex.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('createIndex', () => {
capacityMode: 'pod',
});

expect(returned).toBe(void 0);
expect(returned).toEqual(void 0);
expect(IOA.createIndex).toHaveBeenCalledWith({
createRequest: {
name: 'index-name',
Expand Down Expand Up @@ -93,7 +93,7 @@ describe('createIndex', () => {
waitUntilReady: true,
});

expect(returned).toBe(void 0);
expect(returned).toEqual({ status: { ready: true, state: 'Ready' } });
expect(IOA.createIndex).toHaveBeenCalledWith({
createRequest: {
name: 'index-name',
Expand Down Expand Up @@ -137,7 +137,7 @@ describe('createIndex', () => {
await jest.advanceTimersByTimeAsync(3000);

return returned.then((result) => {
expect(result).toBe(void 0);
expect(result).toEqual({ status: { ready: true, state: 'Ready' } });
expect(IOA.describeIndex).toHaveBeenNthCalledWith(3, {
indexName: 'index-name',
});
Expand Down
Loading
Loading