Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ rootfs
roundrobin
rpmbuild
rpms
rstest
rsyslog
rsyslogd
servlet
Expand Down
36 changes: 36 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ proptest = "1.2"
quickcheck = "1.0.3"
lookup = { package = "vector-lookup", path = "lib/vector-lookup", features = ["test"] }
reqwest = { version = "0.11", features = ["json"] }
rstest = {version = "0.18.2"}
tempfile = "3.6.0"
test-generator = "0.3.1"
tokio = { version = "1.32.0", features = ["test-util"] }
Expand Down
10 changes: 0 additions & 10 deletions src/config/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,6 @@ where
#[cfg(test)]
mod tests {
use super::*;
use proptest::prelude::*;

impl Arbitrary for Format {
type Parameters = ();
fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy {
prop_oneof![Just(Format::Toml), Just(Format::Json), Just(Format::Yaml),].boxed()
}

type Strategy = BoxedStrategy<Self>;
}

/// This test ensures the logic to guess file format from the file path
/// works correctly.
Expand Down
28 changes: 15 additions & 13 deletions src/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ fn write_config(filepath: &Path, body: &str) -> Result<(), crate::Error> {
mod tests {
use super::*;
use crate::config::ConfigBuilder;
use proptest::prelude::*;
use rstest::rstest;

fn generate_and_deserialize(expression: String, format: Format) {
let opts = Opts {
Expand All @@ -410,20 +410,22 @@ mod tests {
}
}

proptest! {
#[test]
fn generate_all(format in any::<Format>()) {
for name in SourceDescription::types() {
generate_and_deserialize(format!("{}//", name), format);
}
#[rstest]
#[case(Format::Toml)]
#[case(Format::Json)]
#[case(Format::Yaml)]
#[test]
fn generate_all(#[case] format: Format) {
for name in SourceDescription::types() {
generate_and_deserialize(format!("{}//", name), format);
}

for name in TransformDescription::types() {
generate_and_deserialize(format!("/{}/", name), format);
}
for name in TransformDescription::types() {
generate_and_deserialize(format!("/{}/", name), format);
}

for name in SinkDescription::types() {
generate_and_deserialize(format!("//{}", name), format);
}
for name in SinkDescription::types() {
generate_and_deserialize(format!("//{}", name), format);
}
}

Expand Down