Skip to content

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

merge v0.26-facets

krunalab1179bec4bb
diff --cc test/core_api_utils_test.cpp
index 080152d3,acb597fd..82236699
--- a/test/core_api_utils_test.cpp
+++ b/test/core_api_utils_test.cpp
@@@ -1140,28 -1138,23 +1140,49 @@@ TEST_F(CoreAPIUtilsTest, TestProxyInval
ASSERT_EQ("Headers must be a JSON object.", nlohmann::json::parse(resp->body)["message"]);
}
+ TEST_F(CoreAPIUtilsTest, TestProxyTimeout) {
+ nlohmann::json body;
+
+ auto req = std::make_shared<http_req>();
+ auto resp = std::make_shared<http_res>(nullptr);
+
+ // test with url as empty string
+ body["url"] = "https://typesense.org/docs/";
+ body["method"] = "GET";
+ body["headers"] = nlohmann::json::object();
+ body["headers"]["timeout_ms"] = "1";
+ body["headers"]["num_retry"] = "1";
+
+ req->body = body.dump();
+
+ post_proxy(req, resp);
+
+ ASSERT_EQ(408, resp->status_code);
+ ASSERT_EQ("Server error on remote server. Please try again later.", 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();
+ }
+ }
}