-
Notifications
You must be signed in to change notification settings - Fork 375
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: unit test failing if not local db #3307
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
gabrielmbmb
added
the
type: bug
Indicates an unexpected problem or unintended behavior
label
Jul 3, 2023
gabrielmbmb
changed the title
Fix/unit test failing if not local db
fix: unit test failing if not local db
Jul 3, 2023
gabrielmbmb
force-pushed
the
fix/unit_test_failing_if_not_local_db
branch
from
July 3, 2023 14:32
fcd75ab
to
c12277a
Compare
gabrielmbmb
commented
Jul 3, 2023
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #3307 +/- ##
===========================================
- Coverage 90.31% 90.27% -0.04%
===========================================
Files 234 234
Lines 12642 12642
===========================================
- Hits 11417 11413 -4
- Misses 1225 1229 +4
☔ View full report in Codecov by Sentry. |
frascuchon
reviewed
Jul 3, 2023
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.
frascuchon
approved these changes
Jul 3, 2023
alvarobartt
pushed a commit
that referenced
this pull request
Jul 4, 2023
# Description The API startup event was using the `argilla.server.database.get_async_db` function to get a DB session to check if the default argilla user exists. We were overriding the `get_async_db` dependency for the API endpoints, but we were not mocking the function when being used from the API startup, and therefore the function was returning a session to the local sqlite DB (`$HOME/.argilla/argilla.db`). If the sqlite local db file didn't exist and the migrations hadn't been applied, then a `sqlalchemy.errors. OperationalError` was being raised as the `User` table didn't exist. **Type of change** (Please delete options that are not relevant. Remember to title the PR according to the type of change) - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Refactor (change restructuring the codebase without changing functionality) - [ ] Improvement (change adding some improvement to an existing functionality) - [ ] Documentation update **How Has This Been Tested** Running the tests without the `$HOME/.argilla/argilla.db` file doesn't raise an exception anymore. **Checklist** - [ ] I added relevant documentation - [x] follows the style guidelines of this project - [x] I did a self-review of my code - [ ] I made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I filled out [the contributor form](https://tally.so/r/n9XrxK) (see text above) - [x] I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/) --------- Co-authored-by: frascuchon <francis@argilla.io>
leiyre
pushed a commit
that referenced
this pull request
Jul 4, 2023
* develop: refactor: add `HuggingFaceDatasetMixIn` under `integrations` (#3326) feat: add list user workspaces endpoint (#3308) ci: Stop linking issues to team work project chore: add missing `greenlet` dependency in `server` extra (#3330) fix: unit test failing if not local db (#3307) ci: Optimize build + test pipeline (#3300) refactor: simplify old bulk endpoints to avoid create datasets if does not exists (#3306) 📝 Update doc site link (#3299) 🚑 Fix dependencies (#3302) feat: migrate to async SQLAlchemy engine (#3162)
leiyre
pushed a commit
that referenced
this pull request
Jul 5, 2023
* develop: fix: return all workspaces in system for owner users (#3343) fix: `rg.init` with argilla user using quickstart images raise an unexpected error (#3341) feat: add `Suggestion` endpoints (#3304) feat: add `list_user_workspaces` and `User.workspaces` property (#3334) refactor: add `HuggingFaceDatasetMixIn` under `integrations` (#3326) feat: add list user workspaces endpoint (#3308) ci: Stop linking issues to team work project chore: add missing `greenlet` dependency in `server` extra (#3330) docs: update developer docs (#3314) Docs/3312 docs 112 is not building correctly (#3313) fix: unit test failing if not local db (#3307) ci: Optimize build + test pipeline (#3300) refactor: simplify old bulk endpoints to avoid create datasets if does not exists (#3306)
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.
Description
The API startup event was using the
argilla.server.database.get_async_db
function to get a DB session to check if the default argilla user exists. We were overriding theget_async_db
dependency for the API endpoints, but we were not mocking the function when being used from the API startup, and therefore the function was returning a session to the local sqlite DB ($HOME/.argilla/argilla.db
). If the sqlite local db file didn't exist and the migrations hadn't been applied, then asqlalchemy.errors. OperationalError
was being raised as theUser
table didn't exist.Type of change
(Please delete options that are not relevant. Remember to title the PR according to the type of change)
How Has This Been Tested
Running the tests without the
$HOME/.argilla/argilla.db
file doesn't raise an exception anymore.Checklist