-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[sled-agent] Create an "Executor", which intercepts requests through std::process::Command #3442
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the excellent feedback, @jgallagher and @gjcolombo !
We chatted some about this PR offline. After some reflection, I have a few higher-level concerns about the broader goal of doing host-level emulation as an abstraction to enable testing in sled agent. Since this is such a big re-architecture of the sled agent, and I am going to be taking on more work in this area shortly, I would really like a chance to get to understand these changes (and maybe discuss more the goals here). I would appreciate getting some time to chat more about this when I am back from PTO (after Labor Day). And I am also happy to write down my thoughts here as well, and ideas for other designs I would consider. |
I would really like to move forward on this PR if I'm allowed to. Please let me know what I can do to unblock this. |
For posterity: I had some questions about the design and goals of the PR and was not attempting to allow or disallow anything; as I said before, I wanted to understand the approach and goals better. @smklein and I chatted offline and have some concrete action items to take to address my concerns, but I don't have any objections to merging this PR. |
Goal
illumos-utils
, which largely rely onstd::process::Command
.Executor
introduced in this PR to emulate "all aspects of the host we expect Sled Agent to manipulate", which may include abstraction around FFI calls as well.Implementation
illumos_utils::execute
withillumos_utils::host::Executor
, which provides an interface to take astd::process::Command
as input, execute it, and provide some output. This provides the following advantages:FakeExecutor
, so they can be explicitly tested. This allows us to reduce our usage on mocks, and also create tests that more clearly align to our system interface.illumos_utils/src/dladm.rs
illumos_utils/src/zone.rs
sled-agent/src/services.rs
mockall
dependency, as well astesting
feature flag forillumos-utils
.Follow-up work:
smf
andzone
crates) which also issuestd::process::Command
, and ensure they also can be "faked" (edit: DONE, see 0.2.2: Split running from returning commands, add pfexec smf#4 and 0.3.0: Provide access to zone commands instead of running them directly zone#22)Fixes #2422