-
Notifications
You must be signed in to change notification settings - Fork 419
Fix integration and unit tests #912
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #912 +/- ##
==========================================
+ Coverage 76.75% 77.23% +0.48%
==========================================
Files 272 281 +9
Lines 10638 11461 +823
==========================================
+ Hits 8165 8852 +687
- Misses 2473 2609 +136 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
lgtm
AI Description
This PR introduces several changes to the backend codebase, primarily focusing on database operations, deployment handling, and testing.
seed_default_organization
anddelete_default_organization
functions are introduced insrc/backend/database_models/seeders/organization_seed.py
, replacing the previousdeployments_models_seed
anddelete_default_models
functions. These new functions handle seeding and deleting default organizations, addressing an issue with seed data and invalid config data.DATABASE_URL
environment variable is updated in various test files (src/backend/tests/integration/conftest.py
,src/backend/tests/unit/conftest.py
) to use a default value ofpostgresql://postgres:postgres@localhost:5433
if not set.DeploymentNotFoundError
exception is now caught insrc/backend/chat/custom/utils.py
andsrc/backend/services/request_validators.py
, ensuring proper handling of deployment-related errors.create_db_deployment
function insrc/backend/services/deployment.py
now returns the created deployment definition, allowing for further processing if needed.test_create_agent_deployment_not_in_db
function insrc/backend/tests/integration/routers/test_agent.py
now checks if thecohere_deployment
exists before deleting it.test_search_conversations
andtest_search_conversations_no_conversations
functions insrc/backend/tests/integration/routers/test_conversation.py
are now skipped if theCOHERE_API_KEY
environment variable is not set, ensuring that tests requiring the API key are not run without it.test_set_env_vars_with_invalid_deployment_name
function insrc/backend/tests/unit/routers/test_deployment.py
now usessession_client
instead ofclient
to make the HTTP request, aligning with the updated exception handling.test_get_deployment_definition_by_name_no_db_deployments
function insrc/backend/tests/unit/routers/test_chat.py
now includes additional assertions to verify the returned deployment definition's name, models, class name, and config, ensuring a more comprehensive test.run-integration-tests
target inMakefile
now usespoetry run pytest
instead ofdocker compose run --rm --build backend poetry run pytest
, simplifying the command and removing the need for Docker.DATABASE_URL
insrc/backend/pytest_integration.ini
is updated to usepostgresql://postgres:postgres@localhost:5433
, aligning with the changes in the test files.default_deployment
insrc/backend/tests/unit/configuration.yaml
is now set tocohere_platform
.engine_chat
fixture is added insrc/backend/tests/unit/conftest.py
to provide a SQLAlchemy engine for chat-related tests, ensuring proper isolation and setup for chat-specific database operations.