test(daemon): drive the whole CLI suite against a daemon, and fix what it caught
SOULSEEK_E2E_MODE=daemon makes the existing e2e harness serve every session from a daemon instead of the command's own login, so the same 83 tests assert the same records and exit codes both ways. CI runs the suite twice. Two defects it found: serve judged whether anything was shared from this run's configuration rather than from the session, so routed to a daemon it would start with nothing to serve and report success. The TUI showed an empty conversation when attached, because the daemon's message history was never asked for. It is now a SessionApi method, empty locally, which puts the difference behind the seam. main.rs is now a thin entry point over the library rather than a second copy of every module, so the program compiles once instead of twice.
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
//! change is [`SessionApi::username`], which returns an owned `String`: a
|
||||
//! remote session has no borrowed client to hand a `&str` out of.
|
||||
|
||||
use crate::daemon::proto::ChatMessageDto;
|
||||
use soulseek_rs::types::{Download, DownloadMetadata};
|
||||
use soulseek_rs::{
|
||||
Client, DownloadStatus, Result, RoomEvent, SearchResult, SessionLoss,
|
||||
@@ -101,6 +102,17 @@ pub trait SessionApi: Send + Sync {
|
||||
fn request_user_info(&self, username: &str) -> Result<()>;
|
||||
fn user_info(&self, username: &str) -> Option<UserInfo>;
|
||||
|
||||
/// The conversation this session already knows about.
|
||||
///
|
||||
/// Empty locally, where the TUI's own snapshot on disk is the record. A
|
||||
/// daemon has been collecting private messages the whole time it has been
|
||||
/// running, including while nothing was attached, so an attaching client
|
||||
/// asks for the backlog rather than starting a conversation half-way
|
||||
/// through.
|
||||
fn message_history(&self) -> Vec<ChatMessageDto> {
|
||||
Vec::new()
|
||||
}
|
||||
|
||||
fn shared_counts(&self) -> (u32, u32);
|
||||
fn shared_directories(&self) -> Vec<String>;
|
||||
fn set_shared_directories(&self, directories: Vec<String>) -> Result<()>;
|
||||
|
||||
Reference in New Issue
Block a user