pub struct RecordingControls { /* private fields */ }Expand description
A ControlFactory that registers nothing and remembers everything.
Public rather than #[cfg(test)] on purpose. f3 builds three commands on
ServiceOperations and has to be able to test them without a service
manager, and a double that lived behind #[cfg(test)] here would be
invisible from another crate — which would leave f3 either untested or
writing a second double that drifts from this one.
It is not a simulator. It stores what it was asked to register and reports it back, which is exactly enough to exercise the logic that sits above a service manager: the lock refusal, the record, the stale-path detection, the start-mode switch, and the promise that uninstall deletes nothing else.
Implementations§
Source§impl RecordingControls
impl RecordingControls
Sourcepub fn calls(&self) -> Vec<String>
pub fn calls(&self) -> Vec<String>
Every call made through this factory, in order, as
"<operation> <name> (<mode>)".
Sourcepub fn registrations(&self) -> Vec<(StartMode, String, Registration)>
pub fn registrations(&self) -> Vec<(StartMode, String, Registration)>
Every registration currently held, with the domain it is in.
Sourcepub fn definition(&self, name: &str) -> Option<ServiceDefinition>
pub fn definition(&self, name: &str) -> Option<ServiceDefinition>
The definition applied for a registration, if it is held.
Sourcepub fn edit(&self, name: &str, edit: impl FnOnce(&mut Registration))
pub fn edit(&self, name: &str, edit: impl FnOnce(&mut Registration))
Edits a held registration, as something outside this product would.
This is how the divergence and start-type problems are made reachable
from a test: sc config, launchctl and systemctl can all change a
registration after installation, and a status command that could not be
shown detecting that would be a status command nobody had tested against
the case it exists for.
Does nothing when no registration of that name is held.
Trait Implementations§
Source§impl Clone for RecordingControls
impl Clone for RecordingControls
Source§fn clone(&self) -> RecordingControls
fn clone(&self) -> RecordingControls
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more