From 34b2759f522de57d4a32e9dc24b9ccfc477e2de8 Mon Sep 17 00:00:00 2001 From: teor Date: Mon, 7 Jun 2021 18:59:23 +1000 Subject: [PATCH] Allow multi-digit alpha versions (#2250) This is a temporary fix for `alpha.10`, before a major refactor of the tests. --- zebrad/tests/acceptance.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/zebrad/tests/acceptance.rs b/zebrad/tests/acceptance.rs index bcb6e851..df6864d3 100644 --- a/zebrad/tests/acceptance.rs +++ b/zebrad/tests/acceptance.rs @@ -45,6 +45,11 @@ use zebrad::config::ZebradConfig; /// metrics or tracing test failures in Windows CI. const LAUNCH_DELAY: Duration = Duration::from_secs(10); +/// A regular expression that matches `zebrad` versions. +/// +/// `zebrad` uses [semantic versioning](https://semver.org/). +const ZEBRAD_VERSION_REGEX: &str = r"zebrad [0-9].[0-9].[0-9]-[A-Za-z]*.[0-9]+"; + fn default_test_config() -> Result { let auto_port_ipv4_local = zebra_network::Config { listen_addr: "127.0.0.1:0".parse()?, @@ -307,7 +312,7 @@ fn help_no_args() -> Result<()> { let output = output.assert_success()?; // First line haves the version - output.stdout_contains(r"zebrad [0-9].[0-9].[0-9]")?; + output.stdout_contains(ZEBRAD_VERSION_REGEX)?; // Make sure we are in help by looking usage string output.stdout_contains(r"USAGE:")?; @@ -573,7 +578,7 @@ fn version_no_args() -> Result<()> { let output = child.wait_with_output()?; let output = output.assert_success()?; - output.stdout_matches(r"^zebrad [0-9].[0-9].[0-9]-[A-Za-z]*.[0-9]\n$")?; + output.stdout_contains(ZEBRAD_VERSION_REGEX)?; Ok(()) }