Skip to content

Commit afa58f3

Browse files
committed
fix tests
1 parent 5a8675d commit afa58f3

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

src/utils/proofs_api/parameters.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,15 @@ pub(super) async fn check_parameter_file(path: &Path, info: &ParameterData) -> a
9090
// environment variable is set.
9191
pub(super) fn param_dir(data_dir: &Path) -> PathBuf {
9292
std::env::var(PathBuf::from(PROOFS_PARAMETER_CACHE_ENV))
93-
.map(PathBuf::from)
94-
.unwrap_or_else(|_| data_dir.join(PARAM_DIR))
93+
.ok()
94+
.and_then(|v| {
95+
if v.is_empty() {
96+
None
97+
} else {
98+
Some(PathBuf::from(v))
99+
}
100+
})
101+
.unwrap_or_else(|| data_dir.join(PARAM_DIR))
95102
}
96103

97104
/// Forest uses a set of external crates for verifying the proofs generated by

tests/common/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ impl CommonEnv for Command {
4141
// Always downloads proofs to same location to lower the overall test time
4242
// (by reducing multiple "fetching param file" steps).
4343
fn common_env(&mut self) -> &mut Self {
44-
self.env("FIL_PROOFS_PARAMETER_CACHE", "/tmp/forest-test-fil-proofs")
44+
match std::env::var("FIL_PROOFS_PARAMETER_CACHE").ok() {
45+
Some(v) if !v.is_empty() => self,
46+
_ => self.env("FIL_PROOFS_PARAMETER_CACHE", "/tmp/forest-test-fil-proofs"),
47+
}
4548
}
4649
}
4750

tests/config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ fn test_download_location_of_proof_parameter_files_default() {
5555

5656
tool()
5757
.env("FOREST_CONFIG_PATH", config_file.path())
58+
.env("FIL_PROOFS_PARAMETER_CACHE", "")
5859
.arg("fetch-params")
5960
.arg("--keys")
6061
.arg("--dry-run")

0 commit comments

Comments
 (0)