def test_add_documents_to_non_existent_index(self):
        """Same as test_add_documents_to_unknown_index but the other thread deletes the index.
        Instead of a 500 error, it should be an "index not found" error
        """
        # we need to rename this prevent infinite recursion inside mock_validate_doc
        from marqo.tensor_search.validation import validate_doc as og_validate_doc

        def mock_validate_doc(*args, **kwargs):
            # we want to slow this down slightly, so that the other thread can manipulate the index meta cache
            # validate_doc is between the initial get_index call and
            time.sleep(0.1)
            return og_validate_doc(*args, **kwargs)

        def delete_index():
            """This will sleep briefly, allowing add_documents to start. When it runs it should be between
            both index_info calls.
            """
            time.sleep(0.1)
            tensor_search.delete_index(config=self.config, index_name=self.index_name_3)

        @mock.patch("marqo.tensor_search.validation.validate_doc", mock_validate_doc)
        def run():
            tensor_search.create_vector_index(config=self.config, index_name=self.index_name_3,
                                              index_settings={"index_defaults": {"model": "random"}})
            clear_cache_thread = threading.Thread(target=delete_index)
            clear_cache_thread.start()
            try:
                self.add_documents(
                    **{"config": self.config},
                    add_docs_params=AddDocsParams(
                        **{
                            "index_name": self.index_name_3, "auto_refresh": True,  "device":"cpu",
                            "docs": [
                                {"Title": "Blah"}, {"Title": "blah2"},
                                {"Title": "Blah3"}, {"Title": "Blah4"}]
                        })
                )
                raise AssertionError
            except exceptions.IndexNotFoundError:
                pass
            return True

        assert run()
Same as test_add_documents_to_unknown_index but the other thread deletes the index.
        Instead of a 500 error, it should be an "index not found" error
        
tests/integ_tests/tensor_search/test_index_meta_cache.py