This library follows Semantic Versioning.
This repository uses tool Release Please to create GitHub and PyPi releases. It does so by parsing your git history, looking for Conventional Commit messages, and creating release PRs.
Learn more by reading How should I write my commits?
-
Set environment variables for
INSTANCE_ID,PROJECT_ID -
Run pytest to automatically run all tests:
pytest
- All the tests are running against the same instance, in the same project, using the same user. A common error is caused when too many tests run at the same time, using up all the quota for table creation\modification. This issue is multiplied when running tests through github actions, that run the tests against 5 different versions of Python. To remedy the issue, try not to run many test suites concurrently.
Cloud Build is used to run tests against Google Cloud resources in test project: langchain-bigtable-testing.
Each test has a corresponding Cloud Build trigger, see all triggers.
These tests are registered as required tests in .github/sync-repo-settings.yaml.
Cloud Build triggers (for Python versions 3.8 to 3.11) were created with the following specs:
name: integration-test-pr-py39
description: Run integration tests on PR for Python 3.9
filename: integration.cloudbuild.yaml
github:
name: langchain-google-bigtable-python
owner: googleapis
pullRequest:
branch: .*
commentControl: COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY
ignoredFiles:
- docs/**
- .kokoro/**
- .github/**
- "*.md"
substitutions:
_VERSION: "3.9"Use gcloud builds triggers import --source=trigger.yaml to create triggers via the command line
- Create an Cloud SQL for PostgreSQL instance and database
- Setup Cloud Build triggers (above)
-
Run integration test:
gcloud builds submit --config integration.cloudbuild.yaml --region us-central1
To run Cloud Build tests on GitHub from external contributors, ie RenovateBot, comment: /gcbrun.
Please make sure your code is fully tested. The Cloud Build integration tests are run with the pytest-cov code coverage plugin. They fail for PRs with a code coverage less than the threshold specified in .coveragerc. If your file is inside the main module and should be ignored by code coverage check, add it to the omit section of .coveragerc.
Check for code coverage report in any Cloud Build integration test log. Here is a breakdown of the report:
Stmts: lines of executable code (statements).Miss: number of lines not covered by tests.Branch: branches of executable code (e.g an if-else clause may count as 1 statement but 2 branches; test for both conditions to have both branches covered).BrPart: number of branches not covered by tests.Cover: average coverage of files.Missing: lines that are not covered by tests.