Skip to content

Commit

Permalink
Refactor test (#86)
Browse files Browse the repository at this point in the history
* Refactor test runner
  • Loading branch information
seanpmorgan authored Nov 28, 2023
1 parent bdee0ab commit 1e7c393
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/javascript_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ jobs:
test:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'okay-to-test') || (github.event_name == 'push')
env:
CHROMA_URL: http://localhost:8000
CHROMA_COLLECTION_NAME: javascript_tests

steps:
# https://github.com/actions/checkout/issues/518
Expand All @@ -26,19 +23,19 @@ jobs:
with:
ref: "${{ github.event.pull_request.merge_commit_sha }}"

- name: Install dependencies
run: make init-js-sdk

- name: Run tests
working-directory: javascript-sdk
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
PINECONE_ENVIRONMENT: ${{ secrets.PINECONE_ENVIRONMENT }}
PINECONE_INDEX_NAME: ${{ secrets.PINECONE_INDEX_NAME }}
CHROMA_URL: http://localhost:8000
CHROMA_COLLECTION_NAME: javascript_tests
run: |
tests/setup-and-run-tests.sh
npm install
npm test
- name: Dump docker logs
if: failure()
run: docker logs chroma
2 changes: 1 addition & 1 deletion javascript-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"lint:debug": "eslint src/sdk.ts --debug",
"test": "mocha --require ts-node/register tests/**/*.test.ts"
"test": "tests/setup-and-run-tests.sh"
},
"repository": {
"type": "git",
Expand Down
3 changes: 1 addition & 2 deletions javascript-sdk/tests/setup-and-run-tests.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/usr/bin/env bash

set -e # Exit with nonzero exit code if anything fails
set -x

echo "Starting chroma server..."
export CHROMA_URL=http://localhost:8000
export CHROMA_COLLECTION_NAME=javascript_tests
docker pull chromadb/chroma
docker stop chroma || true
docker rm chroma || true
Expand Down

0 comments on commit 1e7c393

Please sign in to comment.