GithubHelp home page GithubHelp logo

Comments (4)

sanders41 avatar sanders41 commented on May 21, 2024

I have looked into creating and deleting the index with each test and the problem I have run into is because the tests are running in threads, the tests still fail. The reason for this is multiple tests can be running at the same time trying to use the same index name. One solution to this is to run the tests all in a single thread with cargo test -- --test-threads=1. By doing this the tests no longer overlap and will pass, but the test take MUCH longer to run.

Some solutions I can currently think of are:

  1. Run all tests in a single thread
    • Advantage: All indexes can have the same name
    • Disadvantage: Slows down the tests
  2. Mock all the network calls
    • Advantages:
      • All indexes can have the same name
      • Tests run fast
    • Disadvantage: Since the main purpose of the client is to talk to Meilisearch through the API moving that to mocks seems like a bad idea.
  3. Give each index a unique name
    • Advantages:
      • Tests run fast
      • Can still use real network calls
    • Disadvantage:
      • Have to ensure that each index name across all files is unique.
      • Doesn't look as good in docs

from meilisearch-rust.

Mubelotix avatar Mubelotix commented on May 21, 2024

@sanders41 I have already thought about this issue. Your third solution has already been applied here and I plan to extend this structure to all other tests. However, there is another issue that you did not expect. For a reason I am unable to explain when tests make simultaneous requests to the MeiliSearch server, requests will hang and never get answers. So we cannot remove test-threads=1 anyway.

from meilisearch-rust.

sanders41 avatar sanders41 commented on May 21, 2024

For a reason I am unable to explain when tests make simultaneous requests to the MeiliSearch server, requests will hang and never get answers.

I have seen this issue also. I was guessing it was happening because of the index overlap, but sounds like your testing shows that isn’t the cause.

from meilisearch-rust.

irevoire avatar irevoire commented on May 21, 2024

Closed by #225

from meilisearch-rust.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.