Skip to content

Commit

Permalink
Ensure envvars don't leak into parsing unit test environment
Browse files Browse the repository at this point in the history
Signed-off-by: Robert Detjens <[email protected]>
  • Loading branch information
detjensrobert committed Nov 18, 2024
1 parent b961214 commit 9591f26
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/tests/parsing/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use crate::configparser::config::*;
/// Test parsing RCDS config where all fields are specified in the yaml
fn all_yaml() {
figment::Jail::expect_with(|jail| {
jail.clear_env();
jail.create_file(
"rcds.yaml",
r#"
Expand Down Expand Up @@ -124,6 +125,7 @@ fn all_yaml() {
/// Test parsing RCDS config where some secrets are overridden by envvars
fn yaml_with_env_overrides() {
figment::Jail::expect_with(|jail| {
jail.clear_env();
jail.create_file(
"rcds.yaml",
r#"
Expand Down Expand Up @@ -202,6 +204,7 @@ fn yaml_with_env_overrides() {
/// Test parsing RCDS config where secrets are set in envvars and omitted from yaml
fn partial_yaml_with_env() {
figment::Jail::expect_with(|jail| {
jail.clear_env();
jail.create_file(
"rcds.yaml",
r#"
Expand Down Expand Up @@ -271,6 +274,7 @@ fn partial_yaml_with_env() {
/// Test attempting to parse missing config file
fn bad_no_file() {
figment::Jail::expect_with(|jail| {
jail.clear_env();
// don't create file

let config = parse();
Expand Down

0 comments on commit 9591f26

Please sign in to comment.