Skip to content

Improve tests - #80

Merged
eskombro merged 1 commit into
masterfrom
improve_tests
May 29, 2020
Merged

Improve tests#80
eskombro merged 1 commit into
masterfrom
improve_tests

Conversation

@eskombro

@eskombro eskombro commented May 27, 2020

Copy link
Copy Markdown
Contributor

This is a complete review / refacto of the whole module tests.

Every file and method has been checked, and I did my best to complete the very hard work that had already been done in this test set.

The main goal was to go a little bit deeper in testing every method, and I feel confident that this test set is enough for a guarantee of the quality of code we do and maintain.

Tests have also been classified in directories, corresponding to the package structure, so it is easier to navigate inside of it.

I know this is going to be hard to review, as it is a big fat Pull Request 😄

I want to say congrats to those who have worked on it before, a huge work was done on this before I came (cheers @bidoubiwa)

Closes #53

@eskombro
eskombro force-pushed the improve_tests branch 3 times, most recently from 3057ece to 398762d Compare May 27, 2020 13:12
@eskombro eskombro self-assigned this May 28, 2020
@eskombro
eskombro marked this pull request as ready for review May 28, 2020 01:48
@eskombro
eskombro requested a review from a team May 28, 2020 01:48

@curquiza curquiza left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thaaaaaaaaanks

Comment thread meilisearch/tests/index/test_index_document_meilisearch.py Outdated
Comment thread meilisearch/tests/settings/test_settings_displayed_attributes_meilisearch.py Outdated
Comment thread meilisearch/tests/settings/test_settings_ranking_rules_meilisearch.py Outdated
Comment thread meilisearch/tests/settings/test_settings_searchable_attributes_meilisearch.py Outdated
Comment thread setup.py
@bidoubiwa
bidoubiwa self-requested a review May 28, 2020 09:56
@eskombro

Copy link
Copy Markdown
Contributor Author

Thanks for the review @curquiza , I included all your changes. I will re-read all the files again to see if there are some simple mistakes that I haven't seen yet!

@bidoubiwa bidoubiwa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requests overview

  • Could you remove all the in MeiliSearch that are added in some comments? Those are unnecessary
  • Should comment have whitespace before and after the content of the comment? In which case could you do either one or the other?
  • Could you, on the tests you did not move (so I could not suggest modifications), change test an API call to ... to Tests getting/creating ...
  • Some search tests are missing

This is for consistency between every comment and because An API call is not useful information.
I tried to update as many as I could.

Example

  """Tests an API call to get an index's info in MeiliSearch with a wrong UID"""

Becomes

  """Tests getting an index's info with a wrong UID"""

Comment thread meilisearch/tests/index/test_index.py Outdated
Comment thread meilisearch/tests/client/test_client.py Outdated
Comment thread meilisearch/tests/client/test_client_stats_meilisearch.py Outdated
Comment thread meilisearch/tests/index/test_index.py Outdated
Comment thread meilisearch/tests/index/test_index.py Outdated
Comment thread meilisearch/tests/client/test_client.py Outdated
Comment thread meilisearch/tests/client/test_client_health_meilisearch.py Outdated
Comment thread meilisearch/tests/client/test_client_key_meilisearch.py Outdated
Comment thread meilisearch/tests/client/test_client_sysinfo_meilisearch.py Outdated
Comment thread meilisearch/tests/client/test_client_version_meilisearch.py Outdated

@bidoubiwa bidoubiwa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Could you remove all the in MeiliSearch that are added in some comments? Those are unnecessary
  • Should comment have whitespace before and after the content of the comment? In which case could you do either one or the other?

response = self.index.search('How to Train Your Dragon')
assert isinstance(response, object)
assert response['hits'][0]['id'] == '166428'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be three additionals tests that tests the following values during a search.

On the query parameters that accepts either an asterix, a string, or an array or string

  • One tests that tries query parameters with a "*" value
  • One tests that tries query parameters with a simple string value
  • One tests that tries query parameters with an array of string as value

Better explaination was made in the PHP sdk: meilisearch/meilisearch-php#19 (comment)

This explanation does not add the tests on a simple string, as it is potentially breaking I would prefer that it is also tested.
The reason I mentioned those tests is because of the hight probability that the codes act in a certain way depending on the type of data it expects. For example the JS library crashed on a simple string before those tests were done.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first two tests were added. The third one actually uncovered a bug, detailed in #85. Test was removed and will be integrated when that issue is solved.

Comment thread meilisearch/tests/index/test_index_stats_meilisearch.py Outdated
Comment thread meilisearch/tests/index/test_index_update_meilisearch.py Outdated
Comment thread meilisearch/tests/index/test_index_update_meilisearch.py Outdated
Comment thread meilisearch/tests/index/test_index_update_meilisearch.py Outdated
Comment thread meilisearch/tests/settings/test_settings_stop_words_meilisearch.py
Comment thread meilisearch/tests/settings/test_settings_stop_words_meilisearch.py
Comment thread meilisearch/tests/settings/test_settings_synonyms_meilisearch.py Outdated
Comment thread meilisearch/tests/settings/test_settings_synonyms_meilisearch.py Outdated
Comment thread meilisearch/tests/settings/test_settings_synonyms_meilisearch.py Outdated
@eskombro
eskombro merged commit a816019 into master May 29, 2020
@eskombro
eskombro deleted the improve_tests branch May 29, 2020 18:57
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.

Improve tests

3 participants