test(cli): hand a config command's session flags to the daemon
cli_with_config passed every flag to the client, so in daemon mode the wishlist serve tests started their daemons with no --shared-dir. Those daemons fell back to sharing ~/Downloads/Soulseek, and the tests only passed because an earlier download test happened to create that folder; run alone, shuffled, or on a machine without it, both failed with "nothing to share". Session flags now go to the daemon the way cli() already routes them.
This commit is contained in:
@@ -884,21 +884,28 @@ fn split_session_flags(args: &[&str]) -> (Vec<String>, Vec<String>) {
|
|||||||
///
|
///
|
||||||
/// `--no-config` is dropped for the obvious reason, and `--quiet` with it:
|
/// `--no-config` is dropped for the obvious reason, and `--quiet` with it:
|
||||||
/// these commands report the schedule the *server* chose on stderr, which is
|
/// these commands report the schedule the *server* chose on stderr, which is
|
||||||
/// the only place a test can see it.
|
/// the only place a test can see it. Session flags go to the daemon, as in
|
||||||
|
/// [`cli`].
|
||||||
fn cli_with_config(
|
fn cli_with_config(
|
||||||
server: &TestServer,
|
server: &TestServer,
|
||||||
user: &str,
|
user: &str,
|
||||||
config: &Path,
|
config: &Path,
|
||||||
args: &[&str],
|
args: &[&str],
|
||||||
) -> Output {
|
) -> Output {
|
||||||
|
let (session_flags, command_args) = match mode() {
|
||||||
|
Mode::Local => {
|
||||||
|
(Vec::new(), args.iter().map(|a| (*a).to_string()).collect())
|
||||||
|
}
|
||||||
|
Mode::Daemon => split_session_flags(args),
|
||||||
|
};
|
||||||
let mut all: Vec<String> = server
|
let mut all: Vec<String> = server
|
||||||
.args(user)
|
.args_with(user, &session_flags)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter(|arg| arg != "--no-config" && arg != "--quiet")
|
.filter(|arg| arg != "--no-config" && arg != "--quiet")
|
||||||
.collect();
|
.collect();
|
||||||
all.push("--config".to_string());
|
all.push("--config".to_string());
|
||||||
all.push(config.to_str().expect("utf-8 path").to_string());
|
all.push(config.to_str().expect("utf-8 path").to_string());
|
||||||
all.extend(args.iter().map(|a| (*a).to_string()));
|
all.extend(command_args);
|
||||||
let refs: Vec<&str> = all.iter().map(String::as_str).collect();
|
let refs: Vec<&str> = all.iter().map(String::as_str).collect();
|
||||||
run(&refs)
|
run(&refs)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user