-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Pinecone testing strategy #2644
Comments
@ZanSara I think of all the solutions you suggested, only instantiating a new index for each runner could work, but the index creation time of ~20-30 seconds may be problematic? Alternatively, we have But for now, does increasing the |
Hello @jamescalam, thanks for your reply. Definitely we can't consider adding 20-30s to each tests. Such change would make the current suite of just 30 tests take more than half a hour to run. On the other hand I don't see why you believe no mocking or caching is viable. Remember we're not testing Pinecone here, we're only testing the Haystack code: one or two integration tests calling a real Pinecone instance can stay, but all others should be just fine with a mocked response. Can you explain a bit more what makes you think it's a bad idea? Regarding your suggestion about pods and replicas, I'm afraid they wouldn't help. It's not really about availability or throughput (often it's the GH runners that lose internet access, so I believe Pinecone's availability is alright already), but about the concurrent and conflicting requests. Making the test instance more powerful won't help preventing this. Unless |
@ZanSara sure I assumed that would make tests too long. I assume the primary failures here are due to multiple runs being performed in parallel from different places, all calling the same Pinecone instance? I didn't realize this before. Would it be possible to add a unique identifier to the index from each runner to the index name to avoid overlap from these different instances? Because you can host many indexes in Pinecone, and in this case each instance would be calling to a unique index and avoiding these concurrent and conflicting requests being made to the same index. This would not solve the issue with slow testing from an index being created for each test. I do see your point on mocking/caching now. I'm not against doing that and if the above doesn't help then I think as you suggest, a mock Pinecone client could be best. What would this need to look like exactly? Like a pinecone-client-mock that replicates pinecone-client responses without calling Pinecone itself? You're correct that |
Actually both of your suggestions would be great! 😊 In practice I propose:
How to we split this task? I understand you are going to submit a PR soon, so if you prefer to take care of these tests I'll leave them to you. Otherwise I will give it a try myself in the next days, but I might need some help along the way, especially for the mock. Thanks again for your time! |
I'm not too familiar with Haystack's testing suite so it may be faster for you to work on, but I can build the mock Pinecone client. I've submitted #2657 for the unary queries, we do need this to be merged before modifying/adding the integration tests as the structure of responses has changed as per Are there any mock clients in Haystack already that I can refer to? If not is there a preferred location for something like that? |
Sounds like a plan! I'll take care of adapting the tests once the mock is merged 👍 Unfortunately for what I know we have no similar mocks (I think Pinecone is the only SaaS vector db we support), so feel free to take the approach you're more familiar with. In another occasion we mocked HTTP requests with Lines 471 to 498 in 54518ac
About the location, AFAIK you don't have a |
@ZanSara I'll prioritize this to hopefully have it ready for the next release. In the example you're using I'm not familiar with the tests so I'm not sure about the best approach here, I thought the best may be to create a mock Pinecone client class with the same methods as the real client - but with mock responses, does this seem reasonable to you? My only thought is how will the real pinecone client in the doc store be replaced with this mock client? Unless we added an optional argument at init to pass the pinecone client in to the doc store, maybe you have a better idea. Either way, I've started work on the mock client |
Thank you! 😊
Yes, that's how I would do it 👍
With monkeypatching. If you're not familiar with it I can totally help! The concept is that right before the test, we reassign |
Problem
Analysis
Solution
At a first glance I could not identify a suitable test strategy for Pinecone. Possible solutions could be:
responses
(good for unit tests, but kind of voids the point of an integration test)@jamescalam: can you recommend a general direction here? I will be happy to do the heavy lifting once we decide how to proceed, but I am unsure which way would be best.
The text was updated successfully, but these errors were encountered: