Skip to content

Commit 9a96456

Browse files
committed
Add failing unit test
1 parent 058601a commit 9a96456

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Diff for: quickwit/quickwit-serve/src/index_api/rest_handler.rs

+23
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,29 @@ mod tests {
10341034
.default_search_fields,
10351035
["severity_text", "body"]
10361036
);
1037+
// test with index_uri at the root of a bucket
1038+
{
1039+
let resp = warp::test::request()
1040+
.path("/indexes")
1041+
.method("POST")
1042+
.json(&true)
1043+
.body(r#"{"version": "0.7", "index_id": "hdfs-logs2", "index_uri": "s3://my-bucket", "doc_mapping": {"field_mappings":[{"name": "timestamp", "type": "i64", "fast": true, "indexed": true}]},"search_settings":{"default_search_fields":["body"]}}"#)
1044+
.reply(&index_management_handler)
1045+
.await;
1046+
let body = std::str::from_utf8(resp.body()).unwrap();
1047+
assert_eq!(resp.status(), 200, "{body}",);
1048+
}
1049+
{
1050+
let resp = warp::test::request()
1051+
.path("/indexes/hdfs-logs2")
1052+
.method("PUT")
1053+
.json(&true)
1054+
.body(r#"{"version": "0.7", "index_id": "hdfs-logs2", "index_uri": "s3://my-bucket", "doc_mapping": {"field_mappings":[{"name": "timestamp", "type": "i64", "fast": true, "indexed": true}]},"search_settings":{"default_search_fields":["severity_text", "body"]}}"#)
1055+
.reply(&index_management_handler)
1056+
.await;
1057+
let body = std::str::from_utf8(resp.body()).unwrap();
1058+
assert_eq!(resp.status(), 200, "{body}",);
1059+
}
10371060
}
10381061

10391062
#[tokio::test]

0 commit comments

Comments
 (0)