Skip to content

Commit 1e8e64d

Browse files
neuronullpull[bot]
authored andcommitted
enhancement(host_metrics source): Add unit test with assert_source_compliance test helper (#14103)
<!-- **Your PR title must conform to the conventional commit spec!** <type>(<scope>)!: <description> * `type` = chore, enhancement, feat, fix, docs * `!` = OPTIONAL: signals a breaking change * `scope` = Optional when `type` is "chore" or "docs", available scopes https://github.com/vectordotdev/vector/blob/master/.github/semantic.yml#L20 * `description` = short description of the change Examples: * enhancement(file source): Add `sort` option to sort discovered files * feat(new source): Initial `statsd` source * fix(file source): Fix a bug discovering new files * chore(external docs): Clarify `batch_size` option --> part of #14055 part of #13995.
1 parent 563ea61 commit 1e8e64d

File tree

1 file changed

+15
-1
lines changed
  • src/sources/host_metrics

1 file changed

+15
-1
lines changed

src/sources/host_metrics/mod.rs

+15-1
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,8 @@ impl From<PatternWrapper> for String {
464464

465465
#[cfg(test)]
466466
pub(self) mod tests {
467-
use std::{collections::HashSet, future::Future};
467+
use crate::test_util::components::{run_and_assert_source_compliance, SOURCE_TAGS};
468+
use std::{collections::HashSet, future::Future, time::Duration};
468469

469470
use super::*;
470471

@@ -743,4 +744,17 @@ pub(self) mod tests {
743744
);
744745
}
745746
}
747+
748+
#[tokio::test]
749+
async fn source_compliance() {
750+
let config = HostMetricsConfig {
751+
scrape_interval_secs: 1.0,
752+
..Default::default()
753+
};
754+
755+
let events =
756+
run_and_assert_source_compliance(config, Duration::from_secs(2), &SOURCE_TAGS).await;
757+
758+
assert!(!events.is_empty());
759+
}
746760
}

0 commit comments

Comments
 (0)