From e5afcda76bc709f0decc8184dc2a1c849c5ce7fb Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Fri, 22 Mar 2024 22:34:18 -0400 Subject: [PATCH] Explicitly use "" for KEY within the tests Causes the provided keystore to be used over our keystore. --- substrate/node/src/keystore.rs | 3 +++ tests/coordinator/src/lib.rs | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/substrate/node/src/keystore.rs b/substrate/node/src/keystore.rs index ca00e79b..f7b9110f 100644 --- a/substrate/node/src/keystore.rs +++ b/substrate/node/src/keystore.rs @@ -8,6 +8,9 @@ pub struct Keystore(sr25519::Pair); impl Keystore { pub fn from_env() -> Option { let mut key_hex = serai_env::var("KEY")?; + if key_hex.is_empty() { + None?; + } let mut key = hex::decode(&key_hex).expect("KEY from environment wasn't hex"); key_hex.zeroize(); diff --git a/tests/coordinator/src/lib.rs b/tests/coordinator/src/lib.rs index 0541c4fd..d09f4487 100644 --- a/tests/coordinator/src/lib.rs +++ b/tests/coordinator/src/lib.rs @@ -66,7 +66,9 @@ pub fn serai_composition(name: &str) -> TestBodySpecification { TestBodySpecification::with_image( Image::with_repository("serai-dev-serai").pull_policy(PullPolicy::Never), ) - .replace_env([("SERAI_NAME".to_string(), name.to_lowercase())].into()) + .replace_env( + [("SERAI_NAME".to_string(), name.to_lowercase()), ("KEY".to_string(), String::new())].into(), + ) .set_publish_all_ports(true) }