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

ci: collect and upload test coverage to coddecov vec-337 #50

Merged
merged 18 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from 14 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
138 changes: 123 additions & 15 deletions .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,18 @@ jobs:
sleep 5

docker ps
python -m pytest standard/aio -s --host 0.0.0.0 --port 5000
python -m pytest standard/aio -s --host 0.0.0.0 --port 5000 --cov=aerospike_vector_search

mv .coverage coverage_data
working-directory: tests

- name: Upload test coverage
if: ${{ matrix.python-version == '3.12' }}
uses: actions/upload-artifact@v4
with:
name: coverage_normal
path: tests/coverage_data

test-tls:
runs-on: ubuntu-24.04
continue-on-error: true
Expand Down Expand Up @@ -142,10 +151,18 @@ jobs:


docker ps
python -m pytest standard/aio -s --host 0.0.0.0 --port 5000 --root_certificate tls/root.crt --ssl_target_name_override child -vs
python -m pytest standard/aio -s --host 0.0.0.0 --port 5000 --root_certificate tls/root.crt --ssl_target_name_override child -vs --cov=aerospike_vector_search

mv .coverage coverage_data
working-directory: tests

- name: Upload test coverage
uses: actions/upload-artifact@v4
with:
name: coverage_tls
path: tests/coverage_data


test-tls-auth:
runs-on: ubuntu-24.04
continue-on-error: true
Expand Down Expand Up @@ -213,10 +230,17 @@ jobs:

sleep 5

python -m pytest standard/aio -s -vv --host 0.0.0.0 --port 5000 --root_certificate tls/root.crt --username admin --password admin --ssl_target_name_override child
python -m pytest standard/aio -s -vv --host 0.0.0.0 --port 5000 --root_certificate tls/root.crt --username admin --password admin --ssl_target_name_override child --cov=aerospike_vector_search

mv .coverage coverage_data
working-directory: tests

- name: Upload test coverage
uses: actions/upload-artifact@v4
with:
name: coverage_tls_auth
path: tests/coverage_data


test-tls-auth-rbac:
runs-on: ubuntu-24.04
Expand Down Expand Up @@ -290,12 +314,20 @@ jobs:


docker ps
python -m pytest rbac -s -vv --host 0.0.0.0 --port 5000 --root_certificate tls/root.crt --ssl_target_name_override child
python -m pytest rbac -s -vv --host 0.0.0.0 --port 5000 --root_certificate tls/root.crt --ssl_target_name_override child --cov=aerospike_vector_search

docker logs aerospike-vector-search
docker logs aerospike

mv .coverage coverage_data
working-directory: tests

- name: Upload test coverage
uses: actions/upload-artifact@v4
with:
name: coverage_tls_auth_rbac
path: tests/coverage_data


test-mtls:
runs-on: ubuntu-24.04
Expand Down Expand Up @@ -363,12 +395,17 @@ jobs:

sleep 5

python -m pytest standard/aio -s --host 0.0.0.0 --port 5000 --root_certificate tls/root.crt --private_key tls/brawn.key.pem --certificate_chain tls/brawn.crt --ssl_target_name_override brawn -vs


python -m pytest standard/aio -s --host 0.0.0.0 --port 5000 --root_certificate tls/root.crt --private_key tls/brawn.key.pem --certificate_chain tls/brawn.crt --ssl_target_name_override brawn -vs --cov=aerospike_vector_search

mv .coverage coverage_data
working-directory: tests

- name: Upload test coverage
uses: actions/upload-artifact@v4
with:
name: coverage_mtls
path: tests/coverage_data


test-mtls-auth:
runs-on: ubuntu-24.04
Expand All @@ -377,7 +414,7 @@ jobs:

strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.12"]


steps:
Expand Down Expand Up @@ -436,12 +473,17 @@ jobs:

sleep 5

python -m pytest standard/aio -s --host 0.0.0.0 --port 5000 --root_certificate tls/root.crt --private_key tls/brawn.key.pem --certificate_chain tls/brawn.crt --username admin --password admin --ssl_target_name_override brawn -vs


python -m pytest standard/aio -s --host 0.0.0.0 --port 5000 --root_certificate tls/root.crt --private_key tls/brawn.key.pem --certificate_chain tls/brawn.crt --username admin --password admin --ssl_target_name_override brawn -vs --cov=aerospike_vector_search

mv .coverage coverage_data
working-directory: tests

- name: Upload test coverage
uses: actions/upload-artifact@v4
with:
name: coverage_mtls_auth
path: tests/coverage_data


test-mtls-auth-rbac:
runs-on: ubuntu-24.04
Expand All @@ -450,7 +492,7 @@ jobs:

strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.12"]


steps:
Expand Down Expand Up @@ -510,9 +552,17 @@ jobs:

sleep 5

python -m pytest rbac -s --host 0.0.0.0 --port 5000 --root_certificate tls/root.crt --private_key tls/brawn.key.pem --certificate_chain tls/brawn.crt --ssl_target_name_override brawn -vs
python -m pytest rbac -s --host 0.0.0.0 --port 5000 --root_certificate tls/root.crt --private_key tls/brawn.key.pem --certificate_chain tls/brawn.crt --ssl_target_name_override brawn -vs --cov=aerospike_vector_search

mv .coverage coverage_data
working-directory: tests

- name: Upload test coverage
uses: actions/upload-artifact@v4
with:
name: coverage_mtls_auth_rbac
path: tests/coverage_data

test-is-loadbalancer:
runs-on: ubuntu-24.04
continue-on-error: true
Expand Down Expand Up @@ -576,9 +626,17 @@ jobs:

sleep 5

python -m pytest standard/aio -s --host 0.0.0.0 --port 5000 --is_loadbalancer -vs
python -m pytest standard/aio -s --host 0.0.0.0 --port 5000 --is_loadbalancer -vs --cov=aerospike_vector_search

mv .coverage coverage_data
working-directory: tests

- name: Upload test coverage
uses: actions/upload-artifact@v4
with:
name: coverage_is_load_balancer
path: tests/coverage_data

test-exhaustive-vector-search:
runs-on: ubuntu-24.04
continue-on-error: true
Expand Down Expand Up @@ -642,9 +700,59 @@ jobs:

sleep 5

python -m pytest standard/aio -s --host 0.0.0.0 --port 5000 --extensive_vector_search -vs
python -m pytest standard/aio -s --host 0.0.0.0 --port 5000 --extensive_vector_search --cov=aerospike_vector_search -vs

mv .coverage coverage_data
working-directory: tests

- name: Upload test coverage
uses: actions/upload-artifact@v4
with:
name: coverage_exhaustive_vector_search
path: tests/coverage_data

upload-to-codecov:
needs: [test-normal, test-tls, test-tls-auth, test-tls-auth-rbac, test-mtls, test-mtls-auth, test-mtls-auth-rbac, test-is-loadbalancer, test-exhaustive-vector-search]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install dependencies
run: pip install coverage build

- name: Download coverage reports
uses: actions/download-artifact@v4
with:
path: coverage_files

- name: List files
run: ls -R coverage_files

- name: Combine coverage reports
run: |
coverage combine $(find coverage_files -name "coverage_data")

# this is needed because the coverage files expect the source code
# to be installed in a certain location. TODO use relative files and source instead
# https://coverage.readthedocs.io/en/latest/config.html#config-run-relative-files
- name: Build and install aerospike-vector-search
run: |
python -m build
pip install dist/aerospike_vector_search-2.0.0-py3-none-any.whl

- name: Upload to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
files: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}

#
# test-timeout-on-sandbox:
# runs-on: ubuntu-24.04
Expand Down
8 changes: 4 additions & 4 deletions src/aerospike_vector_search/aio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ async def wait_for_index_completion(

async def close(self):
"""
Close the Aerospike Vector Search Vector Client.
Close the Aerospike Vector Search Client.

This method closes gRPC channels connected to Aerospike Vector Search.

Expand All @@ -615,15 +615,15 @@ async def close(self):

async def __aenter__(self):
"""
Enter an asynchronous context manager for the vector client.
Enter an asynchronous context manager for the client.

Returns:
VectorDbClient: Aerospike Vector Search Vector Client instance.
VectorDbClient: Aerospike Vector Search Client instance.
"""
return self

async def __aexit__(self, exc_type, exc_val, exc_tb):
"""
Exit an asynchronous context manager for the vector client.
Exit an asynchronous context manager for the client.
"""
await self.close()
10 changes: 5 additions & 5 deletions src/aerospike_vector_search/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class Client(BaseClient):
"""
Aerospike Vector Search Vector Client
Aerospike Vector Search Client

This client specializes in performing database operations with vector data.
Moreover, the client supports Hierarchical Navigable Small World (HNSW) vector searches,
Expand Down Expand Up @@ -579,7 +579,7 @@ def wait_for_index_completion(

def close(self):
"""
Close the Aerospike Vector Search Vector Client.
Close the Aerospike Vector Search Client.

This method closes gRPC channels connected to Aerospike Vector Search.

Expand All @@ -590,15 +590,15 @@ def close(self):

def __enter__(self):
"""
Enter a context manager for the vector client.
Enter a context manager for the client.

Returns:
VectorDbClient: Aerospike Vector Search Vector Client instance.
VectorDbClient: Aerospike Vector Search Client instance.
"""
return self

def __exit__(self, exc_type, exc_val, exc_tb):
"""
Exit a context manager for the vector client.
Exit a context manager for the client.
"""
self.close()
2 changes: 2 additions & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ pytest==7.4.0
pytest-aio==1.5.0
pyjwt
hypothesis
coverage
pytest-cov
..
Loading