Skip to content

Commit

Permalink
test: ignore dogstatsd tests under miri (#661)
Browse files Browse the repository at this point in the history
* feat: Map over sketches attr instead of assigning in map, which Levi thinks avoids a memcpy

* fix: lint
  • Loading branch information
astuyve authored Oct 3, 2024
1 parent abc6cd6 commit 488ba28
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
20 changes: 18 additions & 2 deletions dogstatsd/src/aggregator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,14 @@ impl Aggregator {
.unwrap_or_default();
let mut sketch_payload = SketchPayload::new();

self.map
sketch_payload.sketches = self
.map
.iter()
.filter_map(|entry| match entry.value {
MetricValue::Distribution(_) => build_sketch(now, entry, &self.tags),
_ => None,
})
.for_each(|sketch| sketch_payload.sketches.push(sketch));
.collect();
sketch_payload
}

Expand Down Expand Up @@ -345,6 +346,7 @@ pub mod tests {
}

#[test]
#[cfg_attr(miri, ignore)]
fn insertion() {
let mut aggregator = Aggregator::new(EMPTY_TAGS, 2).unwrap();

Expand All @@ -359,6 +361,7 @@ pub mod tests {
}

#[test]
#[cfg_attr(miri, ignore)]
fn distribution_insertion() {
let mut aggregator = Aggregator::new(EMPTY_TAGS, 2).unwrap();

Expand All @@ -373,6 +376,7 @@ pub mod tests {
}

#[test]
#[cfg_attr(miri, ignore)]
fn overflow() {
let mut aggregator = Aggregator::new(EMPTY_TAGS, 2).unwrap();

Expand Down Expand Up @@ -402,6 +406,7 @@ pub mod tests {

#[test]
#[allow(clippy::float_cmp)]
#[cfg_attr(miri, ignore)]
fn clear() {
let mut aggregator = Aggregator::new(EMPTY_TAGS, 2).unwrap();

Expand Down Expand Up @@ -433,6 +438,7 @@ pub mod tests {
}

#[test]
#[cfg_attr(miri, ignore)]
fn to_series() {
let mut aggregator = Aggregator::new(EMPTY_TAGS, 2).unwrap();

Expand All @@ -454,6 +460,7 @@ pub mod tests {
}

#[test]
#[cfg_attr(miri, ignore)]
fn distributions_to_protobuf() {
let mut aggregator = Aggregator::new(EMPTY_TAGS, 2).unwrap();

Expand All @@ -471,6 +478,7 @@ pub mod tests {
}

#[test]
#[cfg_attr(miri, ignore)]
fn consume_distributions_ignore_single_metrics() {
let mut aggregator = Aggregator::new(EMPTY_TAGS, 1_000).unwrap();
assert_eq!(aggregator.distributions_to_protobuf().sketches.len(), 0);
Expand All @@ -487,6 +495,7 @@ pub mod tests {
}

#[test]
#[cfg_attr(miri, ignore)]
fn consume_distributions_batch_entries() {
let max_batch = 5;
let tot = 12;
Expand All @@ -511,6 +520,7 @@ pub mod tests {
}

#[test]
#[cfg_attr(miri, ignore)]
fn consume_distributions_batch_bytes() {
let expected_distribution_per_batch = 2;
let total_number_of_distributions = 5;
Expand Down Expand Up @@ -555,6 +565,7 @@ pub mod tests {
}

#[test]
#[cfg_attr(miri, ignore)]
fn consume_distribution_one_element_bigger_than_max_size() {
let max_bytes = 1;
let tot = 5;
Expand Down Expand Up @@ -589,6 +600,7 @@ pub mod tests {
}

#[test]
#[cfg_attr(miri, ignore)]
fn consume_series_ignore_distribution() {
let mut aggregator = Aggregator::new(EMPTY_TAGS, 1_000).unwrap();

Expand All @@ -613,6 +625,7 @@ pub mod tests {
}

#[test]
#[cfg_attr(miri, ignore)]
fn consume_series_batch_entries() {
let max_batch = 5;
let tot = 13;
Expand All @@ -638,6 +651,7 @@ pub mod tests {
}

#[test]
#[cfg_attr(miri, ignore)]
fn consume_metrics_batch_bytes() {
let expected_metrics_per_batch = 2;
let total_number_of_metrics = 5;
Expand Down Expand Up @@ -675,6 +689,7 @@ pub mod tests {
}

#[test]
#[cfg_attr(miri, ignore)]
fn consume_series_one_element_bigger_than_max_size() {
let max_bytes = 1;
let tot = 5;
Expand All @@ -701,6 +716,7 @@ pub mod tests {
}

#[test]
#[cfg_attr(miri, ignore)]
fn distribution_serialized_deserialized() {
let mut aggregator = Aggregator::new(EMPTY_TAGS, 1_000).unwrap();

Expand Down
3 changes: 3 additions & 0 deletions dogstatsd/src/dogstatsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ mod tests {
use std::sync::{Arc, Mutex};

#[tokio::test]
#[cfg_attr(miri, ignore)]
async fn test_dogstatsd_multi_distribution() {
let locked_aggregator = setup_dogstatsd(
"single_machine_performance.rouster.api.series_v2.payload_size_bytes:269942|d
Expand Down Expand Up @@ -150,6 +151,7 @@ single_machine_performance.rouster.metrics_max_timestamp_latency:1376.90870216|d
}

#[tokio::test]
#[cfg_attr(miri, ignore)]
async fn test_dogstatsd_multi_metric() {
let locked_aggregator = setup_dogstatsd(
"metric3:3|c|#tag3:val3,tag4:val4\nmetric1:1|c\nmetric2:2|c|#tag2:val2\n",
Expand All @@ -169,6 +171,7 @@ single_machine_performance.rouster.metrics_max_timestamp_latency:1376.90870216|d
}

#[tokio::test]
#[cfg_attr(miri, ignore)]
async fn test_dogstatsd_single_metric() {
let locked_aggregator = setup_dogstatsd("metric123:99123|c").await;
let aggregator = locked_aggregator.lock().expect("lock poisoned");
Expand Down
7 changes: 7 additions & 0 deletions dogstatsd/src/metric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ mod tests {
// For any valid name, tags et al the parse routine is able to parse an
// encoded metric line.
#[test]
#[cfg_attr(miri, ignore)]
fn parse_valid_inputs(
name in metric_name(),
values in metric_values(),
Expand Down Expand Up @@ -319,6 +320,7 @@ mod tests {
}

#[test]
#[cfg_attr(miri, ignore)]
fn parse_missing_name_and_value(
mtype in metric_type(),
tagset in metric_tagset()
Expand All @@ -334,6 +336,7 @@ mod tests {
}

#[test]
#[cfg_attr(miri, ignore)]
fn parse_invalid_name_and_value_format(
name in metric_name(),
values in metric_values(),
Expand All @@ -357,6 +360,7 @@ mod tests {
}

#[test]
#[cfg_attr(miri, ignore)]
fn parse_unsupported_metric_type(
name in metric_name(),
values in metric_values(),
Expand All @@ -381,6 +385,7 @@ mod tests {
// For any valid name, tags et al the parse routine is able to parse an
// encoded metric line.
#[test]
#[cfg_attr(miri, ignore)]
fn id_consistent(name in metric_name(),
mut tags in metric_tags()) {
let mut tagset1 = String::new();
Expand Down Expand Up @@ -412,6 +417,7 @@ mod tests {
}

#[test]
#[cfg_attr(miri, ignore)]
fn parse_too_many_tags() {
// 33
assert_eq!(parse("foo:1|g|#a:1,b:2,c:3,a:1,b:2,c:3,a:1,b:2,c:3,a:1,b:2,c:3,a:1,b:2,c:3,a:1,b:2,c:3,a:1,b:2,c:3,a:1,b:2,c:3,a:1,b:2,c:3,a:1,b:2,c:3,a:1,b:2,c:3").unwrap_err(),
Expand All @@ -428,6 +434,7 @@ mod tests {
}

#[test]
#[cfg_attr(miri, ignore)]
fn invalid_dogstatsd_no_panic() {
assert!(parse("somerandomstring|c+a;slda").is_err());
}
Expand Down

0 comments on commit 488ba28

Please sign in to comment.