-
Notifications
You must be signed in to change notification settings - Fork 425
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:
|
EugeneLightsOn
left a comment
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_organizationanddelete_default_organizationfunctions are introduced insrc/backend/database_models/seeders/organization_seed.py, replacing the previousdeployments_models_seedanddelete_default_modelsfunctions. These new functions handle seeding and deleting default organizations, addressing an issue with seed data and invalid config data.DATABASE_URLenvironment 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:5433if not set.DeploymentNotFoundErrorexception is now caught insrc/backend/chat/custom/utils.pyandsrc/backend/services/request_validators.py, ensuring proper handling of deployment-related errors.create_db_deploymentfunction insrc/backend/services/deployment.pynow returns the created deployment definition, allowing for further processing if needed.test_create_agent_deployment_not_in_dbfunction insrc/backend/tests/integration/routers/test_agent.pynow checks if thecohere_deploymentexists before deleting it.test_search_conversationsandtest_search_conversations_no_conversationsfunctions insrc/backend/tests/integration/routers/test_conversation.pyare now skipped if theCOHERE_API_KEYenvironment variable is not set, ensuring that tests requiring the API key are not run without it.test_set_env_vars_with_invalid_deployment_namefunction insrc/backend/tests/unit/routers/test_deployment.pynow usessession_clientinstead ofclientto make the HTTP request, aligning with the updated exception handling.test_get_deployment_definition_by_name_no_db_deploymentsfunction insrc/backend/tests/unit/routers/test_chat.pynow includes additional assertions to verify the returned deployment definition's name, models, class name, and config, ensuring a more comprehensive test.run-integration-teststarget inMakefilenow usespoetry run pytestinstead ofdocker compose run --rm --build backend poetry run pytest, simplifying the command and removing the need for Docker.DATABASE_URLinsrc/backend/pytest_integration.iniis updated to usepostgresql://postgres:postgres@localhost:5433, aligning with the changes in the test files.default_deploymentinsrc/backend/tests/unit/configuration.yamlis now set tocohere_platform.engine_chatfixture is added insrc/backend/tests/unit/conftest.pyto provide a SQLAlchemy engine for chat-related tests, ensuring proper isolation and setup for chat-specific database operations.