Skip to content

Conversation

refi64
Copy link
Collaborator

@refi64 refi64 commented Jul 30, 2025

As usual, only the last commit is new, depends on #58.

@refi64 refi64 requested a review from sjoerdsimons July 30, 2025 21:59
@refi64 refi64 force-pushed the wip/refi64/commander-tests branch from 2fa48b7 to 4ced142 Compare August 7, 2025 20:41
@sjoerdsimons
Copy link
Contributor

@refi64 as a first pass can you fix CI and the conflicts?

@refi64 refi64 force-pushed the wip/refi64/commander-tests branch from 4ced142 to cb034e3 Compare August 11, 2025 15:13
@refi64
Copy link
Collaborator Author

refi64 commented Aug 11, 2025

@sjoerdsimons conflicts fixed, I don't think clippy latest should matter for this change since it's not part of allgreen?

@refi64 refi64 force-pushed the wip/refi64/commander-tests branch 2 times, most recently from fe73a54 to fb9b128 Compare August 15, 2025 15:18
@refi64 refi64 force-pushed the wip/refi64/commander-tests branch from fb9b128 to 44c397f Compare August 29, 2025 16:20
@refi64 refi64 force-pushed the wip/refi64/commander-tests branch 2 times, most recently from 2e43c59 to 0a098a8 Compare September 16, 2025 13:51
Passing around `self` risks confusing the borrow checker if we need to
invoke a method on a field, and it's rather confusing to begin with.
All the generic command handling is now part of an `actions` module, and
logging happens through a rather cursed magic bridge in the new
`logging` module to remove the widespread use of outputln.
This is largely just a rename, as well as the slightly-silly
`obs-commander-test-support` crate that exists to avoid making the
primary `obs-commander` crate depend on testing dependencies.
Most of this logic is rather intricate and shareable between multiple
implementations, so it makes sense for them to be in a separate crate.
This necessitates quite a bit of refactoring of the test structure so
that the shared test code can actually run commands and inspect the
logs + artifacts. Since there are various somewhat strange requirements
around command execution (i.e. needing to use timeouts but still get the
result), that API was redone around a builder trait, which also makes it
easy for implementation-specific tests to have their own methods on it.
@refi64 refi64 force-pushed the wip/refi64/commander-tests branch from 0a098a8 to 0f81984 Compare September 16, 2025 20:53
resolver = "3"
members = [
"obs-commander",
"obs-commander-tests",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooi why both tests and test-support?


pub const MONITOR_TEST_OLD_STATUS_SLEEP_DURATION: Duration = Duration::from_millis(100);

pub const MONITOR_TEST_LOG_TAIL: u64 = 50;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline here but not between the other consts?

let srcmd5_prefix = format!(
"srcmd5 '{}' ",
if log_test == MonitorLogTest::Unavailable {
ZERO_REV_SRCMD5.to_owned()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick; why converting to an owned value if it's being formatting anyway?

Comment on lines +553 to +554
let prune = context.run().command("prune").go().await;
assert!(!prune.ok());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you use unwrap_err() instead when it fails it will dump what Ok value got returned. If that's not useful at least assert on is_err()`

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(same pattern in other places)

pub const EXECUTION_DEFAULT_TIMEOUT: Duration = Duration::from_secs(30);

#[async_trait]
pub trait RunBuilder<'context>: Send + Sync + Sized {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would really help if these traits had documentation wrt. to what their meant to do (both overall and the functions)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants