Use " " instead of "" for the empty key so sh doesn't interpret it as falsy

This commit is contained in:
Luke Parker 2024-03-23 17:38:50 -04:00
parent 2a31d8552e
commit 5ea3b1bf97
No known key found for this signature in database
5 changed files with 5 additions and 5 deletions

View file

@ -32,7 +32,7 @@ macro_rules! serai_test {
.replace_env(
HashMap::from([
("RUST_LOG".to_string(), "runtime=debug".to_string()),
("KEY".to_string(), String::new()),
("KEY".to_string(), " ".to_string()),
])
)
.set_publish_all_ports(true)

View file

@ -15,7 +15,7 @@ async fn dht() {
Image::with_repository("serai-dev-serai").pull_policy(PullPolicy::Never),
)
.replace_env(
[("SERAI_NAME".to_string(), name.to_string()), ("KEY".to_string(), String::new())].into(),
[("SERAI_NAME".to_string(), name.to_string()), ("KEY".to_string(), " ".to_string())].into(),
)
.set_publish_all_ports(true)
.set_handle(handle(name))

View file

@ -102,7 +102,7 @@ async fn validator_set_rotation() {
])
.replace_env(HashMap::from([
("RUST_LOG".to_string(), "runtime=debug".to_string()),
("KEY".to_string(), String::new()),
("KEY".to_string(), " ".to_string()),
]))
.set_publish_all_ports(true)
.set_handle(handle(name))

View file

@ -8,7 +8,7 @@ pub struct Keystore(sr25519::Pair);
impl Keystore {
pub fn from_env() -> Option<Self> {
let mut key_hex = serai_env::var("KEY")?;
if key_hex.is_empty() {
if key_hex.trim().is_empty() {
None?;
}
let mut key = hex::decode(&key_hex).expect("KEY from environment wasn't hex");

View file

@ -67,7 +67,7 @@ pub fn serai_composition(name: &str) -> TestBodySpecification {
Image::with_repository("serai-dev-serai").pull_policy(PullPolicy::Never),
)
.replace_env(
[("SERAI_NAME".to_string(), name.to_lowercase()), ("KEY".to_string(), String::new())].into(),
[("SERAI_NAME".to_string(), name.to_lowercase()), ("KEY".to_string(), " ".to_string())].into(),
)
.set_publish_all_ports(true)
}