Skip to content

Commit

Permalink
Bump version to 4.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nagisa committed Oct 21, 2021
1 parent 633c19d commit e698054
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "hedwig"
# TODO: When bumping to next major version, make sure to clean up the MRV and lints we allow in CI.
version = "4.1.0"
version = "4.1.1"
authors = [
"Aniruddha Maru <[email protected]>",
"Simonas Kazlauskas <[email protected]>"
Expand Down
10 changes: 7 additions & 3 deletions src/consume/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ use std::{
/// ## Message Decoding
///
/// Messages pulled from the service are assumed to have been created by some
#[cfg_attr(feature = "publish", doc = "[hedwig publisher](crate::publish::Publisher)")]
#[cfg_attr(
feature = "publish",
doc = "[hedwig publisher](crate::publish::Publisher)"
)]
#[cfg_attr(not(feature = "publish"), doc = "hedwig publisher")]
/// and therefore were validated against the included schema when publishing. It is the decoder's
/// responsibility (when provided to functions like [`consume`](Consumer::consume)) to check this
Expand Down Expand Up @@ -67,8 +70,9 @@ pub trait Consumer {
/// Create a stream of decoded messages from this consumer, using a decoder for the given
/// [decodable](DecodableMessage) message type.
fn consume<M>(self, decoder: M::Decoder) -> MessageStream<Self::Stream, M::Decoder, M>
where Self: Sized,
M: DecodableMessage,
where
Self: Sized,
M: DecodableMessage,
{
MessageStream {
stream: self.stream(),
Expand Down
24 changes: 13 additions & 11 deletions src/publish/publishers/googlepubsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -704,9 +704,8 @@ mod tests {
#[tokio::test]
async fn regression_for_double_suffix() {
let validator = validators::JsonSchemaValidator::new(SCHEMA).unwrap();
let small_message = JsonUserCreatedMessage::new_valid(
String::from_utf8(vec![b'a'; 512]).unwrap()
);
let small_message =
JsonUserCreatedMessage::new_valid(String::from_utf8(vec![b'a'; 512]).unwrap());
let oversized_message = JsonUserCreatedMessage::new_valid(
String::from_utf8(vec![b'a'; (10 * 1024 * 1024 - 512) * 3 / 4]).unwrap(),
);
Expand All @@ -715,20 +714,22 @@ mod tests {
oversized_message.encode(&validator).unwrap(),
];
let mut segmenter = GoogleMessageSegmenter::new("", msgs.iter());
let body1 = hyper::body::to_bytes(segmenter.next().unwrap().unwrap().request_body).await.unwrap();
let body1 = hyper::body::to_bytes(segmenter.next().unwrap().unwrap().request_body)
.await
.unwrap();
serde_json::from_slice::<serde_json::Value>(&body1[..]).unwrap();
let body2 = hyper::body::to_bytes(segmenter.next().unwrap().unwrap().request_body).await.unwrap();
let body2 = hyper::body::to_bytes(segmenter.next().unwrap().unwrap().request_body)
.await
.unwrap();
serde_json::from_slice::<serde_json::Value>(&body2[..]).unwrap();
}


#[cfg(feature = "json-schema")]
#[tokio::test]
async fn ensure_request_limits() {
let validator = validators::JsonSchemaValidator::new(SCHEMA).unwrap();
let small_message = JsonUserCreatedMessage::new_valid(
String::from_utf8(vec![b'a'; 512]).unwrap()
);
let small_message =
JsonUserCreatedMessage::new_valid(String::from_utf8(vec![b'a'; 512]).unwrap());
for i in 1225..1227 {
let oversized_message = JsonUserCreatedMessage::new_valid(
String::from_utf8(vec![b'a'; (10 * 1024 * 1024 - i) * 3 / 4]).unwrap(),
Expand All @@ -739,14 +740,15 @@ mod tests {
];
let mut segmenter = GoogleMessageSegmenter::new("", msgs.iter());
for segment in segmenter {
let body = hyper::body::to_bytes(segment.unwrap().request_body).await.unwrap();
let body = hyper::body::to_bytes(segment.unwrap().request_body)
.await
.unwrap();
assert!(body.len() < super::API_DATA_LENGTH_LIMIT);
serde_json::from_slice::<serde_json::Value>(&body[..]).unwrap();
}
}
}


#[cfg(feature = "json-schema")]
#[test]
fn oversized_single_msg_segmenter() {
Expand Down

0 comments on commit e698054

Please sign in to comment.