-
Notifications
You must be signed in to change notification settings - Fork 383
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
Fix integration and unit tests #912
Merged
Merged
Conversation
This file contains 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
tianjing-li
requested review from
EugeneLightsOn,
malexw,
ezawadski and
a team
as code owners
January 17, 2025 19:38
tianjing-li
requested a deployment
to
development
January 17, 2025 19:38 — with
GitHub Actions
Waiting
tianjing-li
requested a deployment
to
development
January 17, 2025 19:41 — with
GitHub Actions
Waiting
tianjing-li
requested a deployment
to
development
January 17, 2025 19:42 — with
GitHub Actions
Waiting
tianjing-li
changed the title
Fix integration and unit tests
[WIP] Fix integration and unit tests
Jan 17, 2025
EugeneLightsOn
had a problem deploying
to
development
January 22, 2025 12:16 — with
GitHub Actions
Failure
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. |
EugeneLightsOn
had a problem deploying
to
development
January 22, 2025 12:24 — with
GitHub Actions
Failure
EugeneLightsOn
requested a deployment
to
development
January 22, 2025 12:30 — with
GitHub Actions
Waiting
EugeneLightsOn
temporarily deployed
to
development
January 22, 2025 12:33 — with
GitHub Actions
Inactive
EugeneLightsOn
approved these changes
Jan 22, 2025
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
tianjing-li
changed the title
[WIP] Fix integration and unit tests
Fix integration and unit tests
Jan 22, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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.