Skip to content

Commit

Permalink
Ensure that the settings load properly, and default to a None regex f…
Browse files Browse the repository at this point in the history
…ield

This was broken in 0.1.7 because I didn't run a manual integration test, oops

Yay automation
  • Loading branch information
rtyler committed May 11, 2020
1 parent 6dc8add commit becfefd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
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.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hotdog"
version = "0.1.7"
version = "0.1.8"
authors = ["R. Tyler Croy <rtyler+hotdog@brokenco.de>"]
edition = "2018"

Expand Down
11 changes: 10 additions & 1 deletion src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub enum Action {
pub struct Rule {
pub field: Field,
pub actions: Vec<Action>,
#[serde(with = "serde_regex")]
#[serde(with = "serde_regex", default = "default_none")]
pub regex: Option<regex::Regex>,
#[serde(default = "empty_str")]
pub jmespath: String,
Expand Down Expand Up @@ -152,10 +152,19 @@ fn kafka_timeout_default() -> Duration {
Duration::from_secs(30)
}

fn default_none<T>() -> Option<T> {
None
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_load_example_config() {
load("hotdog.yml");
}

#[test]
fn test_default_tls() {
assert_eq!(TlsType::None, TlsType::default());
Expand Down

0 comments on commit becfefd

Please sign in to comment.