1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! Shared helpers for the `decdn` CLI integration tests.
//!
//! Cargo compiles every file in `tests/` as its own crate, so this module is
//! `mod common;`-included per test file and not every helper is used by every
//! one — hence the blanket `dead_code` allow.
use Path;
use Command;
/// Spawn the built `decdn` binary with the developer's environment sealed off.
///
/// Two inherited channels reach the real `~/.decdn` and must be closed at every
/// spawn site, not just the ones that currently happen to care:
///
/// - **`HOME`**, from which the CLI resolves its default data dir and config
/// file (`dirs::home_dir()`). A flag always beats config
/// (`commands::chain_ctx`, flag > config > default), but config *fills in*
/// whatever the caller left unset — so a real `~/.decdn/node.toml` can supply
/// `blockchain.eth_keystore` to any invocation passing no `--keystore`, and
/// the binary then reads a developer's actual key material.
/// - **the `DECDN_*` namespace**, which clap folds into args at CLI precedence,
/// above any config file. An exported `DECDN_DATA_DIR` displaces the
/// `--data-dir` these tests pass.
///
/// Neither is a live defect in this crate's tests today: `channel list`
/// short-circuits config loading when `--data-dir` is given
/// (`commands::channel::list`), and `origin import` is never handed a
/// `config_path` at all (`commands::origin::origin_dispatch`). That safety is a
/// property of those two subcommands, though, not of the tests — it evaporates
/// if a subcommand changes or a new test drops the flag. `decdn-e2e` had the
/// same latent shape and it became a real, environment-dependent failure
/// (#1332); `setup_redacts_rpc_error` had already hit it here.
///
/// `home` must be absolute: `dirs` treats an empty `HOME` as *absent* and falls
/// back to `getpwuid`, landing straight back on the real home directory.
pub