Skip to content
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

Improve indexes names in tests #385

Merged

Conversation

thicolares
Copy link
Contributor

@thicolares thicolares commented Oct 31, 2022

Pull Request

Related issue

Fixes #355

What does this PR do?

  • Choose better names to index in tests.
  • I decided to use static index names instead of randomized ones -- as suggested.
    • It communicates the intent clearer and mitigates the chances of introducing a flaky test.
  • Using books in all cases seems tedious, but helps keep the same mental context across all tests.

PR checklist

Please check if your PR fulfills the following requirements:

  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!

Copy link
Member

@brunoocasali brunoocasali left a comment

Choose a reason for hiding this comment

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

Hi @thicolares thanks for your contribution!

@@ -2,11 +2,11 @@

RSpec.describe MeiliSearch::Index do
it 'fetch the info of the index' do
client.create_index!('new_index')
Copy link
Member

Choose a reason for hiding this comment

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

We also have some unclear names in the indexes_spec.rb and documents_spec.rb, can you update them as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@brunoocasali good call! It's done! ✅


indexes = client.indexes(limit: 1, offset: 2)

expect(indexes['results']).to be_a(Array)
expect(indexes['total']).to eq(3)
expect(indexes['limit']).to eq(1)
expect(indexes['offset']).to eq(2)
expect(indexes['results'].map(&:uid)).to eq(['third_index'])
expect(indexes['results'].map(&:uid)).to eq(['colors'])
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This looks strange but is correct. Apparently, we sort this before returning and the last one, in this case, is colors. third_index was also the third by coincidence 😉

Copy link
Member

@brunoocasali brunoocasali left a comment

Choose a reason for hiding this comment

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

Thanks a lot for your contribution @thicolares ❤️ 🇧🇷

bors merge

@meili-bors
Copy link
Contributor

meili-bors bot commented Oct 31, 2022

@meili-bors meili-bors bot merged commit 4cc6c2a into meilisearch:main Oct 31, 2022
@brunoocasali
Copy link
Member

This message is sent automatically

Thanks again for contributing to Meilisearch ❤️
If you are participating in Hacktoberfest, and you would like to receive some gift from Meilisearch too, please complete this form.

@brunoocasali brunoocasali added enhancement New feature or request skip-changelog The PR will not appear in the release changelogs labels Nov 26, 2022
meili-bors bot added a commit that referenced this pull request Nov 28, 2022
401: Update version for the next release (v0.21.0) r=brunoocasali a=brunoocasali

This version makes this package compatible with Meilisearch v0.30.0 🎉
Check out the changelog of [Meilisearch v0.30.0](https://github.com/meilisearch/meilisearch/releases/tag/v0.30.0) for more information on the changes.

## 🚀 Enhancements

- Add `MeilisearchClient#cancel_tasks` (#392) `@brunoocasali` 
- Add `MeilisearchClient#swap_indexes` (#393) `@brunoocasali` 
- Add `MeilisearchClient#delete_tasks` (#394) `@brunoocasali` 
- Add support to finite pagination by using `page` and `hits_per_page` like `index.search('', { page: 1, hits_per_page: 10 })`
- Add filters for tasks resources (#391) `@brunoocasali` 
  - `uids` filter parameter for `MeilisearchClient#get_tasks({ uids: [1, 2, 3] })`
  - `canceled_by` filter parameter for `MeilisearchClient#get_tasks({ canceled_by: [99, 100]})`
  - `before_enqueued_at` and `after_enqueued_at` filter parameter for `MeilisearchClient#get_tasks({ before_enqueued_at: DateTime.new(2022), after_enqueued_at: '2022-01-20' })`
  - `before_finished_at` and `after_finished_at` filter parameter for `MeilisearchClient#get_tasks({ before_finished_at: DateTime.new(2022), after_finished_at: '2022-01-20' })`
  - `before_started_at` and `after_started_at` filter parameter for `MeilisearchClient#get_tasks({ before_started_at: DateTime.new(2022), after_started_at: '2022-01-20' })`

## ⚠️  Breaking Changes

- Update filters for tasks resources (#391) `@brunoocasali` 
  - `index_uid` query parameter is renamed `index_uids` when querying `MeilisearchClient#get_tasks`
  - `type` query parameter is renamed `types` when querying `MeilisearchClient#get_tasks`
  - `status` query parameter is renamed `statuses` when querying `MeilisearchClient#get_tasks`

## 💅 Misc

* Fix broken CI after rubocop upgrade (#381) `@jonatanrdsantos`
* Add new code-samples for matching_strategy (#384) `@thicolares`
* Improve indexes names in tests (#385) `@thicolares`

Thanks again to `@brunoocasali,` `@dibashthapa,` `@jonatanrdsantos,` and `@thicolares!` 🎉


Co-authored-by: Bruno Casali <brunoocasali@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request skip-changelog The PR will not appear in the release changelogs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Choose better names to index in tests
2 participants