Skip to content

Commit 610aefd

Browse files
JayXonRebase bot
authored andcommitted
[mock-installer] Capture Suspend/Resume/Cancel requests
Bug: 127887 Change-Id: I2bd2e0f67d9c06d247c3306932910e0b9f65b81c Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/872026 Fuchsia-Auto-Submit: Sen Jiang <[email protected]> Commit-Queue: Auto-Submit <[email protected]> Reviewed-by: Ben Keller <[email protected]>
1 parent 03e9c6e commit 610aefd

File tree

1 file changed

+22
-4
lines changed
  • src/sys/pkg/testing/mock-installer/src

1 file changed

+22
-4
lines changed

src/sys/pkg/testing/mock-installer/src/lib.rs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ use {
2121
#[derive(PartialEq, Debug)]
2222
pub enum CapturedUpdateInstallerRequest {
2323
StartUpdate { url: String, options: Options, reboot_controller_present: bool },
24+
SuspendUpdate { attempt_id: Option<String> },
25+
ResumeUpdate { attempt_id: Option<String> },
26+
CancelUpdate { attempt_id: Option<String> },
2427
}
2528

2629
// Options does not impl Eq, but it is semantically Eq.
@@ -148,12 +151,27 @@ impl MockUpdateInstallerService {
148151
let response = self.start_update_response.lock();
149152
responder.send(response.as_deref().map_err(|e| *e)).unwrap();
150153
}
154+
InstallerRequest::SuspendUpdate { attempt_id, responder } => {
155+
self.captured_args
156+
.lock()
157+
.push(CapturedUpdateInstallerRequest::SuspendUpdate { attempt_id });
158+
responder.send(Ok(())).unwrap();
159+
}
160+
InstallerRequest::ResumeUpdate { attempt_id, responder } => {
161+
self.captured_args
162+
.lock()
163+
.push(CapturedUpdateInstallerRequest::ResumeUpdate { attempt_id });
164+
responder.send(Ok(())).unwrap();
165+
}
166+
InstallerRequest::CancelUpdate { attempt_id, responder } => {
167+
self.captured_args
168+
.lock()
169+
.push(CapturedUpdateInstallerRequest::CancelUpdate { attempt_id });
170+
responder.send(Ok(())).unwrap();
171+
}
151172
InstallerRequest::GetLastUpdateResult { .. }
152173
| InstallerRequest::GetUpdateResult { .. }
153-
| InstallerRequest::MonitorUpdate { .. }
154-
| InstallerRequest::SuspendUpdate { .. }
155-
| InstallerRequest::ResumeUpdate { .. }
156-
| InstallerRequest::CancelUpdate { .. } => {
174+
| InstallerRequest::MonitorUpdate { .. } => {
157175
panic!("unexpected request: {req:?}");
158176
}
159177
}

0 commit comments

Comments
 (0)