Skip to content

Fix #3 - Route Testing #13

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

Open
wants to merge 63 commits into
base: main
Choose a base branch
from

Conversation

GabrielTiveron
Copy link

@GabrielTiveron GabrielTiveron commented Aug 27, 2021

Issue

Related to issue #3

Notes

To begin with, some files were reallocated to let the imports to the test files working well.

In order to run the test set, you just need to run the command make test in the root folder.

The test environment consists of a new docker-compose file which has a database container without volumes, so the tests can run over and over without leaving data behind. You can also run the test docker to debug tests while developing new routes. To do so, you can run the test docker with the command sudo docker-compose -f test.docker-compose.yml up also in the root folder, and then run the tests with sudo docker-compose -f test.docker-compose.yml exec backend-tests pytest.

The routes to be tested are listed below:

  • accuracy_type
  • cpu
  • dataset
  • login
  • model
  • paper
  • paper_with_code_integration
  • sota
  • submission
  • task
  • tpu
  • user
  • util

@GabrielTiveron
Copy link
Author

GabrielTiveron commented Aug 30, 2021

Hi, @mansogf !

To make proper tests to user creation I suggest the creation of a route to delete users, so the tests can work more than once.

For example the create user test would fail if the user already exists.
This feature could be interesting to future usage of the application.

- install sqlalchemy-utils to create and drop database
- try to override the get-db, this is popping a lot of errors,we need to fix that
@aquiles23
Copy link
Contributor

aquiles23 commented Sep 3, 2021

i am trying to make the tests work inside a test database as stated in this discussion: fastapi/full-stack-fastapi-template#125

@aquiles23
Copy link
Contributor

so far we make the test database, user route and accuracy-type route are tested, there is more work to do.

@GabrielTiveron
Copy link
Author

Hey, @mansogf

As the issue #3, related to this pull request, has many tasks to cover all routes I suggest the creation of one issue to each route to test, as each route has many methods and functions to be tested.

Thanks in advance.

@aquiles23
Copy link
Contributor

papers route are done

@GabrielTiveron GabrielTiveron changed the title [WIP] Route Testing Fix #3 - Route Testing Oct 20, 2021
@GabrielTiveron
Copy link
Author

GabrielTiveron commented Oct 20, 2021

Hi, @mansogf and @andrewlucasgs !

The majority of routes tests were developed, as well as the test environment. Some routes seems to be test routes, that are not used in the project scope like the util's routes, and others we weren't able to test, like the sota, papers_with_code_itegration and model routes.
Lastly, I think that the work developed so far meets the needs of the issue. Any necessary changes you can tell us, and we'll resolve it as soon as possible.

@andrewlucasgs
Copy link
Collaborator

Hi @GabrielTiveron and @aquiles23, what a great work you've done!!

The sota and papers_with_code_itegration are used to retrieve data in specif structure. The Sota route serve models data with accuracy_values grouped by task and datasets, so this only work properly if you have inserted in your database, all entities related to this structure. The same happens with papers_with_code_itegration route, as it retrieves data used by paper with code about computing power for each of models.

@aquiles23
Copy link
Contributor

Hi @GabrielTiveron and @aquiles23, what a great work you've done!!

The sota and papers_with_code_itegration are used to retrieve data in specif structure. The Sota route serve models data with accuracy_values grouped by task and datasets, so this only work properly if you have inserted in your database, all entities related to this structure. The same happens with papers_with_code_itegration route, as it retrieves data used by paper with code about computing power for each of models.

ok @andrewlucasgs, how can i populate the models? its POST route aways return 500 status code to me and i don't know what a task_dataset_id is.

@andrewlucasgs
Copy link
Collaborator

Currently we don't have a post route on models, a model is created after the status of a submission is set to approved by updating it.

And task_dataset_id is the identifier of many to many association table between tasks and dastasets.

@aquiles23
Copy link
Contributor

@GabrielTiveron @andrewlucasgs we make route tests models, sota, the submission approve flow and paper_with_code_integration.
All done.

@GabrielTiveron
Copy link
Author

@mansogf @andrewlucasgs Hey! All routes are tested and this pull request is ready to be accepted!

There are some warnings after running the route tests, but it's related to functions in the development set.
image

The tests developed cover all the routes marked above, and most of them cover success and failure case tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants