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
adding tests
krunal1f8c0d73dd35
diff --git a/include/raft_server.h b/include/raft_server.hindex dddaccb9..d5fcfec7 100644--- a/include/raft_server.h+++ b/include/raft_server.h@@ -142,8 +142,6 @@ private:butil::EndPoint peering_endpoint;- Option<bool> handle_gzip(const std::shared_ptr<http_req>& request);-public:static constexpr const char* log_dir_name = "log";@@ -241,6 +239,8 @@ public:std::string get_leader_url() const;+ static Option<bool> handle_gzip(const std::shared_ptr<http_req>& request);+private:friend class ReplicationClosure;diff --git a/test/core_api_utils_test.cpp b/test/core_api_utils_test.cppindex d24b44bf..080152d3 100644--- a/test/core_api_utils_test.cpp+++ b/test/core_api_utils_test.cpp@@ -4,6 +4,7 @@#include <collection_manager.h>#include <core_api.h>#include "core_api_utils.h"+#include "raft_server.h"class CoreAPIUtilsTest : public ::testing::Test {protected:@@ -1137,4 +1138,30 @@ TEST_F(CoreAPIUtilsTest, TestProxyInvalid) {ASSERT_EQ(400, resp->status_code);ASSERT_EQ("Headers must be a JSON object.", nlohmann::json::parse(resp->body)["message"]);+}++TEST_F(CoreAPIUtilsTest, SampleGzipIndexTest) {+ Collection *coll_hnstories;++ std::vector<field> fields = {field("title", field_types::STRING, false),+ field("points", field_types::INT32, false),};++ coll_hnstories = collectionManager.get_collection("coll_hnstories").get();+ if(coll_hnstories == nullptr) {+ coll_hnstories = collectionManager.create_collection("coll_hnstories", 4, fields, "title").get();+ }++ auto req = std::make_shared<http_req>();+ char buf[196605]; //chunk size limit+ std::ifstream infile(std::string(ROOT_DIR)+"test/resources/hnstories.jsonl.gz");++ while(infile >> buf) {+ req->body = buf;++ auto res = ReplicationState::handle_gzip(req);+ if(!res.error().empty()) {+ LOG(ERROR) << res.error();+ FAIL();+ }+ }}\ No newline at end of filediff --git a/test/resources/hnstories.jsonl.gz b/test/resources/hnstories.jsonl.gznew file mode 100644index 00000000..ce374189Binary files /dev/null and b/test/resources/hnstories.jsonl.gz differ