Skip to content

Commit

Permalink
fix opensearch codec bug
Browse files Browse the repository at this point in the history
  • Loading branch information
conorbros committed Oct 30, 2023
1 parent 9e58c6d commit e235a0a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
18 changes: 17 additions & 1 deletion shotover-proxy/tests/opensearch_int_tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ use crate::shotover_process;
use opensearch::{
auth::Credentials,
cert::CertificateValidation,
http::response::Response,
http::{
headers::{HeaderName, HeaderValue},
response::Response,
transport::{SingleNodeConnectionPool, TransportBuilder},
Method, StatusCode, Url,
},
indices::{IndicesCreateParts, IndicesDeleteParts, IndicesExistsParts},
nodes::NodesInfoParts,
params::Refresh,
BulkOperation, BulkParts, DeleteParts, Error, IndexParts, OpenSearch, SearchParts,
};
Expand Down Expand Up @@ -224,6 +226,20 @@ async fn opensearch_test_suite(client: &OpenSearch) {

test_bulk(client).await;
test_delete_index(client).await;

// request a large message without compression that has to be processed in multiple batches on the codec side
let _ = assert_ok_and_get_json(
client
.nodes()
.info(NodesInfoParts::None)
.header(
HeaderName::from_lowercase(b"accept-encoding").unwrap(),
HeaderValue::from_str("").unwrap(),
)
.send()
.await,
)
.await;
}

#[tokio::test(flavor = "multi_thread")]
Expand Down
1 change: 1 addition & 0 deletions shotover/src/codec/opensearch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ impl Decoder for OpenSearchDecoder {
}

if src.len() < content_length {
self.state = State::ReadingBody(http_headers, content_length);
return Ok(None);
}

Expand Down

0 comments on commit e235a0a

Please sign in to comment.