Skip to content

Commit

Permalink
[TST] Get ts-integration-test.sh script working locally (#2518)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlabasterAxe authored Jul 18, 2024
1 parent 561e6f5 commit f248fd6
Show file tree
Hide file tree
Showing 6 changed files with 8,206 additions and 18 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/_javascript-client-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: pnpm/action-setup@v3
with:
version: "9"
- name: Test
run: bin/ts-integration-test
run: bin/ts-integration-test.sh
33 changes: 16 additions & 17 deletions bin/ts-integration-test → bin/ts-integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,31 @@ function cleanup {
function setup_auth {
local auth_type="$1"
case "$auth_type" in
basic)
docker run --rm --entrypoint htpasswd httpd:2 -Bbn admin admin > server.htpasswd
cat <<EOF > .chroma_env
basic)
docker run --rm --entrypoint htpasswd httpd:2 -Bbn admin admin >server.htpasswd
cat <<EOF >.chroma_env
CHROMA_SERVER_AUTHN_CREDENTIALS_FILE="/chroma/server.htpasswd"
CHROMA_SERVER_AUTHN_PROVIDER="chromadb.auth.basic_authn.BasicAuthenticationServerProvider"
EOF
;;
token)
cat <<EOF > .chroma_env
;;
token)
cat <<EOF >.chroma_env
CHROMA_AUTH_TOKEN_TRANSPORT_HEADER="Authorization"
CHROMA_SERVER_AUTHN_CREDENTIALS="test-token"
CHROMA_SERVER_AUTHN_PROVIDER="chromadb.auth.token_authn.TokenAuthenticationServerProvider"
EOF
;;
xtoken)
cat <<EOF > .chroma_env
;;
xtoken)
cat <<EOF >.chroma_env
CHROMA_AUTH_TOKEN_TRANSPORT_HEADER="X-Chroma-Token"
CHROMA_SERVER_AUTHN_CREDENTIALS="test-token"
CHROMA_SERVER_AUTHN_PROVIDER="chromadb.auth.token_authn.TokenAuthenticationServerProvider"
EOF
;;
*)
echo "Unknown auth type: $auth_type"
exit 1
;;
*)
echo "Unknown auth type: $auth_type"
exit 1
;;
esac
}

Expand All @@ -49,10 +49,9 @@ export CHROMA_SERVER_HTTP_PORT=8000
export CHROMA_SERVER_NOFILE=65535

cd clients/js
# moved off of yarn to npm to fix issues with jackspeak/cliui/string-width versions #1314
npm install
pnpm install

npm run test:run
pnpm test:run
docker compose down

cd ../..
Expand All @@ -62,7 +61,7 @@ for auth_type in basic token xtoken; do
setup_auth "$auth_type"
cd clients/js
docker compose --env-file ../../.chroma_env -f ../../docker-compose.test-auth.yml up --build -d
npm run test:run-auth-"$auth_type"
pnpm test:run-auth-"$auth_type"
cd ../..
docker compose down
done
2 changes: 2 additions & 0 deletions clients/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"@openapi-generator-plus/typescript-fetch-client-generator": "^1.5.0",
"@types/jest": "^29.5.0",
"@types/node": "^20.8.10",
"@jest/types": "^29.6.3",
"@jest/globals": "^29.7.0",
"jest": "^29.5.0",
"npm-run-all": "^4.1.5",
"openapi-generator-plus": "^2.6.0",
Expand Down
Loading

0 comments on commit f248fd6

Please sign in to comment.