-
Notifications
You must be signed in to change notification settings - Fork 15
[TST] Add v2 API #80
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
Open
tazarov
wants to merge
15
commits into
main
Choose a base branch
from
feature/v2-api-tests-and-ci
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[TST] Add v2 API #80
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
aadefea
test: add comprehensive v2 API tests and CI workflows
tazarov beee333
feat: add v2 API implementation files
tazarov 9945ce7
fix: update v2 API to use v1 endpoints temporarily
tazarov 2b3beac
docs: add V2 API status documentation
tazarov 2121660
fix: update v2 API to use correct /api/v2 endpoints
tazarov d5647f2
fix: update GitHub Actions artifact actions from v3 to v4
tazarov 8fdd324
fix: update GitHub Actions artifact actions to v5
tazarov 9a5f1f2
fix: update ChromaDB versions to 1.0.0-1.1.0 in all workflows
tazarov f224afb
fix: revert artifact actions to v4 (v5 doesn't exist)
tazarov b579485
fix: update GitHub Actions and ChromaClientTest
tazarov a7233a9
fix: update artifact uploads to v4 and add V2StressTest
tazarov cf8b845
fix: resolve CI issues in v2-api-tests workflow
tazarov 8f7175f
fix: correct Java version matrix and API endpoint compatibility
tazarov 405f1d7
fix: replace curl with wget in all workflow healthchecks
tazarov 1bb2de8
feat: add convenience methods and dual API approach to V2 client
tazarov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,225 @@ | ||
| name: V2 API Nightly Tests | ||
|
|
||
| on: | ||
| schedule: | ||
| # Run at 2 AM UTC every day | ||
| - cron: '0 2 * * *' | ||
| workflow_dispatch: | ||
| inputs: | ||
| test_experimental: | ||
| description: 'Test experimental ChromaDB features' | ||
| required: false | ||
| type: boolean | ||
| default: false | ||
|
|
||
| env: | ||
| MAVEN_OPTS: -Xmx4096m -Xms1024m | ||
|
|
||
| jobs: | ||
| comprehensive-v2-tests: | ||
| name: Comprehensive V2 API Tests | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| chroma-version: | ||
| - '1.0.0' # Minimum supported version | ||
| - '1.0.1' | ||
| - '1.0.2' | ||
| - '1.0.3' | ||
| - '1.0.4' | ||
| - '1.1.0' | ||
| - 'latest' | ||
| java-version: [8, 11, 17, 21] | ||
| exclude: | ||
| # Java 8 only with older ChromaDB versions (no exclusions needed for 1.x) | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Java ${{ matrix.java-version }} | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: ${{ matrix.java-version }} | ||
| distribution: 'temurin' | ||
| cache: 'maven' | ||
|
|
||
| - name: Start ChromaDB container | ||
| run: | | ||
| docker run -d \ | ||
| --name chroma-${{ matrix.chroma-version }} \ | ||
| -p 8000:8000 \ | ||
| -e ALLOW_RESET=TRUE \ | ||
| -e IS_PERSISTENT=FALSE \ | ||
| chromadb/chroma:${{ matrix.chroma-version }} | ||
|
|
||
| # Wait for ChromaDB to be ready | ||
| echo "Waiting for ChromaDB to start..." | ||
| for i in {1..60}; do | ||
| if curl -f http://localhost:8000/api/v1 > /dev/null 2>&1; then | ||
| echo "ChromaDB is ready!" | ||
| break | ||
| fi | ||
| echo "Waiting... ($i/60)" | ||
| sleep 2 | ||
| done | ||
|
|
||
| - name: Check ChromaDB health | ||
| run: | | ||
| curl -v http://localhost:8000/api/v1 | ||
| docker logs chroma-${{ matrix.chroma-version }} | tail -20 | ||
|
|
||
| - name: Run V2 API tests | ||
| run: | | ||
| mvn clean test \ | ||
| -Dtest="tech.amikos.chromadb.v2.**" \ | ||
| -DfailIfNoTests=false \ | ||
| -Dchroma.url=http://localhost:8000 | ||
| env: | ||
| CHROMA_VERSION: ${{ matrix.chroma-version }} | ||
| CHROMA_URL: http://localhost:8000 | ||
|
|
||
| - name: Generate detailed test report | ||
| if: always() | ||
| run: | | ||
| mvn surefire-report:report-only | ||
| mvn site -DgenerateReports=false | ||
|
|
||
| - name: Collect container logs | ||
| if: failure() | ||
| run: | | ||
| docker logs chroma-${{ matrix.chroma-version }} > chroma-logs-${{ matrix.chroma-version }}-java-${{ matrix.java-version }}.txt | ||
|
|
||
| - name: Upload test artifacts | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: nightly-v2-chroma-${{ matrix.chroma-version }}-java-${{ matrix.java-version }} | ||
| path: | | ||
| target/surefire-reports/ | ||
| target/site/ | ||
| chroma-logs-*.txt | ||
|
|
||
| - name: Stop ChromaDB container | ||
| if: always() | ||
| run: docker stop chroma-${{ matrix.chroma-version }} && docker rm chroma-${{ matrix.chroma-version }} | ||
|
|
||
| stress-tests: | ||
| name: V2 API Stress Tests | ||
| runs-on: ubuntu-latest | ||
|
|
||
| services: | ||
| chroma: | ||
| image: chromadb/chroma:latest | ||
| ports: | ||
| - 8000:8000 | ||
| env: | ||
| ALLOW_RESET: 'TRUE' | ||
| IS_PERSISTENT: 'TRUE' | ||
| PERSIST_DIRECTORY: '/chroma/data' | ||
| options: >- | ||
| --health-cmd "wget -q --spider http://localhost:8000/api/v1 || exit 1" | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 5 | ||
| --mount type=tmpfs,destination=/chroma/data | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Java 17 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: '17' | ||
| distribution: 'temurin' | ||
| cache: 'maven' | ||
|
|
||
| - name: Run stress tests | ||
| run: | | ||
| mvn test -Dtest=V2StressTest -DfailIfNoTests=false | ||
| env: | ||
| CHROMA_URL: http://localhost:8000 | ||
|
|
||
| - name: Upload stress test results | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: stress-test-results-v2 | ||
| path: | | ||
| target/surefire-reports/TEST-*V2StressTest.xml | ||
| target/site/ | ||
|
|
||
| report-summary: | ||
| name: Generate Nightly Report | ||
| needs: [comprehensive-v2-tests, stress-tests] | ||
| runs-on: ubuntu-latest | ||
| if: always() | ||
|
|
||
| steps: | ||
| - name: Download all artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: test-artifacts | ||
|
|
||
| - name: Generate summary report | ||
| run: | | ||
| echo "# V2 API Nightly Test Report" > nightly-report.md | ||
| echo "Date: $(date -u +"%Y-%m-%d %H:%M:%S UTC")" >> nightly-report.md | ||
| echo "" >> nightly-report.md | ||
|
|
||
| echo "## Test Coverage Matrix" >> nightly-report.md | ||
| echo "| ChromaDB | Java 8 | Java 11 | Java 17 | Java 21 |" >> nightly-report.md | ||
| echo "|----------|--------|---------|---------|---------|" >> nightly-report.md | ||
|
|
||
| # Process test results | ||
| for dir in test-artifacts/nightly-v2-*; do | ||
| if [ -d "$dir" ]; then | ||
| basename "$dir" | grep -o "chroma-[^-]*" | cut -d- -f2 >> versions.txt | ||
| fi | ||
| done | ||
|
|
||
| sort -u versions.txt > unique-versions.txt || true | ||
|
|
||
| while IFS= read -r version; do | ||
| if [ -n "$version" ]; then | ||
| row="| $version |" | ||
| for java in 8 11 17 21; do | ||
| if [ -d "test-artifacts/nightly-v2-chroma-${version}-java-${java}" ]; then | ||
| if ls test-artifacts/nightly-v2-chroma-${version}-java-${java}/TEST-*.xml 2>/dev/null | head -1 | xargs grep -q 'failures="0".*errors="0"' 2>/dev/null; then | ||
| row="$row ✅ |" | ||
| else | ||
| row="$row ❌ |" | ||
| fi | ||
| else | ||
| row="$row - |" | ||
| fi | ||
| done | ||
| echo "$row" >> nightly-report.md | ||
| fi | ||
| done < unique-versions.txt || true | ||
|
|
||
| echo "" >> nightly-report.md | ||
| echo "## Stress Test Results" >> nightly-report.md | ||
| if [ -f "test-artifacts/stress-test-results-v2/TEST-*V2StressTest.xml" ]; then | ||
| echo "✅ Stress tests completed successfully" >> nightly-report.md | ||
| else | ||
| echo "⚠️ Stress test results not found" >> nightly-report.md | ||
| fi | ||
|
|
||
| cat nightly-report.md >> $GITHUB_STEP_SUMMARY | ||
|
|
||
| - name: Create issue for failures | ||
| if: failure() | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const date = new Date().toISOString().split('T')[0]; | ||
| await github.rest.issues.create({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| title: `[V2 API] Nightly test failures - ${date}`, | ||
| body: `Nightly V2 API tests have failed. Please check the [workflow run](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}) for details.`, | ||
| labels: ['bug', 'v2-api', 'nightly-test'] | ||
| }); | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The shell wildcard pattern inside double quotes won't expand as expected. For reliable file detection, consider using:
This ensures proper glob expansion and redirects both stdout and stderr to avoid unnecessary output.
Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.