-
Notifications
You must be signed in to change notification settings - Fork 5
Refactor integration test core into a new 'obo-tests' crate #60
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
base: main
Are you sure you want to change the base?
Conversation
2fa48b7 to
4ced142
Compare
|
@refi64 as a first pass can you fix CI and the conflicts? |
4ced142 to
cb034e3
Compare
|
@sjoerdsimons conflicts fixed, I don't think |
fe73a54 to
fb9b128
Compare
fb9b128 to
44c397f
Compare
0a098a8 to
0f81984
Compare
| let srcmd5_prefix = format!( | ||
| "srcmd5 '{}' ", | ||
| if log_test == MonitorLogTest::Unavailable { | ||
| ZERO_REV_SRCMD5.to_owned() |
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.
nitpick; why converting to an owned value if it's being formatting anyway?
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.
The dir.srcmd5 in the other branch has its lifetime tied to the dir in the same block, so trying to borrow out of there messes with the lifetimes.
| let prune = context.run().command("prune").go().await; | ||
| assert!(!prune.ok()); |
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.
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()`
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.
(same pattern in other places)
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.
I added docs to the traits as mentioned in the other comment, but rough TL;DR prune isn't actually a Result, it's a custom type representing the result of a command. If it failed, it would have already logged that failure too.
10135e3 to
4661b3f
Compare
This is largely just a rename, as well as the slightly-silly `obo-test-support` crate that exists to be depended on by `obo-core` *and* `obs-gitlab-runner`.
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.
4661b3f to
9d78d16
Compare
As usual, only the last commit is new, depends on #58.