Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences
C++ algoliadatastoreelasticsearchenterprise-searchfacetingfull-text-searchfuzzy-searchgeosearchin-memoryinstantsearchmerchandisingpineconesearchsearch-enginesemantic-searchsimilarity-searchsite-searchsynonymstypo-tolerancevector-search
Tear down test suite state properly.
kishorence9557bf233b1
diff --git a/test/collection_faceting_test.cpp b/test/collection_faceting_test.cppindex 5db5bac6..2df584c4 100644--- a/test/collection_faceting_test.cpp+++ b/test/collection_faceting_test.cpp@@ -15,7 +15,7 @@ protected:std::vector<sort_by> sort_fields;void setupCollection() {- std::string state_dir_path = "/tmp/typesense_test/collection_sorting";+ std::string state_dir_path = "/tmp/typesense_test/collection_faceting";LOG(INFO) << "Truncating and creating: " << state_dir_path;system(("rm -rf "+state_dir_path+" && mkdir -p "+state_dir_path).c_str());@@ -29,6 +29,7 @@ protected:}virtual void TearDown() {+ collectionManager.dispose();delete store;}};diff --git a/test/collection_grouping_test.cpp b/test/collection_grouping_test.cppindex b6d99948..8a9a3849 100644--- a/test/collection_grouping_test.cpp+++ b/test/collection_grouping_test.cpp@@ -11,11 +11,8 @@ protected:Store *store;CollectionManager & collectionManager = CollectionManager::get_instance();- std::vector<std::string> query_fields;- std::vector<sort_by> sort_fields;-void setupCollection() {- std::string state_dir_path = "/tmp/typesense_test/collection_sorting";+ std::string state_dir_path = "/tmp/typesense_test/collection_grouping";LOG(INFO) << "Truncating and creating: " << state_dir_path;system(("rm -rf "+state_dir_path+" && mkdir -p "+state_dir_path).c_str());@@ -29,12 +26,13 @@ protected:}virtual void TearDown() {+ collectionManager.dispose();delete store;}};TEST_F(CollectionGroupingTest, GroupingOnOptionalIntegerArray) {- Collection *coll1;+ Collection *coll_group;std::vector<field> fields = {field("title", field_types::STRING, false),@@ -45,9 +43,9 @@ TEST_F(CollectionGroupingTest, GroupingOnOptionalIntegerArray) {field("is_valid", field_types::BOOL, false, true),};- coll1 = collectionManager.get_collection("coll1");- if(coll1 == nullptr) {- coll1 = collectionManager.create_collection("coll1", fields, "max").get();+ coll_group = collectionManager.get_collection("coll_group");+ if(coll_group == nullptr) {+ coll_group = collectionManager.create_collection("coll_group", fields, "max").get();}std::ifstream infile(std::string(ROOT_DIR)+"test/optional_fields.jsonl");@@ -55,7 +53,7 @@ TEST_F(CollectionGroupingTest, GroupingOnOptionalIntegerArray) {std::string json_line;while (std::getline(infile, json_line)) {- auto add_op = coll1->add(json_line);+ auto add_op = coll_group->add(json_line);if(!add_op.ok()) {std::cout << add_op.error() << std::endl;}@@ -66,6 +64,6 @@ TEST_F(CollectionGroupingTest, GroupingOnOptionalIntegerArray) {// first must be able to fetch all records (i.e. all must have been index)- auto res = coll1->search("*", {"title"}, "", {}, {}, 0, 10, 1, FREQUENCY, false).get();+ auto res = coll_group->search("*", {"title"}, "", {}, {}, 0, 10, 1, FREQUENCY, false).get();ASSERT_EQ(6, res["found"].get<size_t>());}\ No newline at end of filediff --git a/test/collection_manager_test.cpp b/test/collection_manager_test.cppindex f2b1f03a..4c8ecfbb 100644--- a/test/collection_manager_test.cpp+++ b/test/collection_manager_test.cpp@@ -40,6 +40,7 @@ protected:virtual void TearDown() {collectionManager.drop_collection("collection1");+ collectionManager.dispose();delete store;}};diff --git a/test/collection_override_test.cpp b/test/collection_override_test.cppindex 8aca5069..30d223da 100644--- a/test/collection_override_test.cpp+++ b/test/collection_override_test.cpp@@ -49,6 +49,7 @@ protected:virtual void TearDown() {collectionManager.drop_collection("coll_mul_fields");+ collectionManager.dispose();delete store;}};diff --git a/test/collection_sorting_test.cpp b/test/collection_sorting_test.cppindex 93caff5b..bd983a05 100644--- a/test/collection_sorting_test.cpp+++ b/test/collection_sorting_test.cpp@@ -29,6 +29,7 @@ protected:}virtual void TearDown() {+ collectionManager.dispose();delete store;}};diff --git a/test/collection_test.cpp b/test/collection_test.cppindex 51865d89..ec5c3649 100644--- a/test/collection_test.cpp+++ b/test/collection_test.cpp@@ -56,6 +56,7 @@ protected:virtual void TearDown() {collectionManager.drop_collection("collection");+ collectionManager.dispose();delete store;}};