Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 18 additions & 3 deletions src/sinks/azure_blob/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,14 @@ async fn azure_blob_insert_json_into_blob() {
assert_eq!(blobs.len(), 1);
assert!(blobs[0].clone().ends_with(".log"));
let (blob, blob_lines) = config.get_blob(blobs[0].clone()).await;
assert_eq!(blob.properties.content_type, String::from("text/plain"));
assert_eq!(
blob.properties.content_encoding,
None
);
assert_eq!(
blob.properties.content_type,
String::from("application/x-ndjson")
);
let expected = events
.iter()
.map(|event| serde_json::to_string(&event.as_log().all_fields().unwrap()).unwrap())
Expand All @@ -138,9 +145,13 @@ async fn azure_blob_insert_lines_into_blob_gzip() {
assert_eq!(blobs.len(), 1);
assert!(blobs[0].clone().ends_with(".log.gz"));
let (blob, blob_lines) = config.get_blob(blobs[0].clone()).await;
assert_eq!(
blob.properties.content_encoding,
Some(String::from("gzip"))
);
assert_eq!(
blob.properties.content_type,
String::from("application/gzip")
String::from("text/plain")
);
assert_eq!(lines, blob_lines);
}
Expand Down Expand Up @@ -170,9 +181,13 @@ async fn azure_blob_insert_json_into_blob_gzip() {
assert_eq!(blobs.len(), 1);
assert!(blobs[0].clone().ends_with(".log.gz"));
let (blob, blob_lines) = config.get_blob(blobs[0].clone()).await;
assert_eq!(
blob.properties.content_encoding,
Some(String::from("gzip"))
);
assert_eq!(
blob.properties.content_type,
String::from("application/gzip")
String::from("application/x-ndjson")
);
let expected = events
.iter()
Expand Down
15 changes: 2 additions & 13 deletions src/sinks/azure_blob/request_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,9 @@ impl RequestBuilder<(String, Vec<Event>)> for AzureBlobRequestOptions {
AzureBlobRequest {
blob_data,
content_encoding: self.compression.content_encoding(),
content_type: self.compression.content_type(),
content_type: self.encoder.1.content_type(),
metadata: azure_metadata,
request_metadata,
}
}
}

impl Compression {
pub const fn content_type(self) -> &'static str {
match self {
Self::None => "text/plain",
Self::Gzip(_) => "application/gzip",
Self::Zlib(_) => "application/zlib",
Self::Zstd(_) => "application/zstd",
}
}
}
}
2 changes: 1 addition & 1 deletion src/sinks/azure_blob/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ fn azure_blob_build_request_with_compression() {

assert_eq!(request.metadata.partition_key, "blob.log.gz".to_string());
assert_eq!(request.content_encoding, Some("gzip"));
assert_eq!(request.content_type, "application/gzip");
assert_eq!(request.content_type, "text/plain");
}

#[test]
Expand Down