-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add ability to wrap test execution + check for quarantining #31
Conversation
f62f6b6
to
11bb9ff
Compare
11bb9ff
to
f0aa1fc
Compare
💊 0 quarantined ✅ 10 passed 🕐 10 new ⋅ (learn more) |
b7d232c
to
36259d8
Compare
36259d8
to
5db8281
Compare
@@ -45,7 +45,7 @@ jobs: | |||
|
|||
- name: Upload results using action from ${{ matrix.target }} | |||
env: | |||
TRUNK_API_ADDRESS: https://api.trunk-staging.io/v1/metrics/createBundleUpload | |||
TRUNK_API_ADDRESS: https://api.trunk-staging.io |
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.
We'll need to update our own repo to match once this is live.
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.
should we still call this TRUNK_API_ADDRESS? maybe TRUNK_API_ORIGIN would be more appropriate?
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.
TRUNK_API_ADDRESS
is a pattern we use elsewhere.
if let Err(e) = run(cli).await { | ||
log::error!("Error: {:?}", e); | ||
std::process::exit(exitcode::SOFTWARE); | ||
match run(cli).await { |
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.
Maybe I'm missing something but if we already have result which can be either success or failure, why do we also need to return exit code? What would Ok(EXIT_FAILURE)
mean? Does it mean we successfully captured failure of a test run and we want to propagate it to the caller of cli?
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.
We need to pipe the original exit code up so that we surface the expected results to the caller. Since the plan is to wrap test executions, we don't want to hide it if the results weren't quarantined.
let file = std::fs::File::open(&file.original_path)?; | ||
let reader = std::io::BufReader::new(file); | ||
let junitxml = junit_parser::from_reader(reader)?; | ||
for suite in junitxml.suites { |
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.
Feel free to do it in the next PR, testing parsing of XMLs is totally something we should test before rolling this out.
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.
Running into issues getting tests running on my machine. Will address in a follow-up.
command: &String, | ||
args: Vec<&String>, | ||
output_paths: Vec<&String>, | ||
) -> anyhow::Result<RunResult> { |
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 this function fails to process output of the command, what will happen? Do we ever want to override exit code of the child command?
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.
We should only override the exit code if the only failures parsed were quarantined.
Overall – LGTM. |
// Tokio-retry uses base ^ retry * factor formula. | ||
// This will give us 8ms, 64ms, 512ms, 4096ms, 32768ms | ||
const RETRY_BASE_MS: u64 = 8; | ||
const RETRY_FACTOR: u64 = 1; | ||
const RETRY_COUNT: usize = 5; | ||
const RETRY_COUNT: usize = 3; |
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.
5 was causing very long delays when there were issues with the api.
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've brought this up with Vlad before and he suggested keeping it at 5 because this gives the backend enough time to auto-resolve issues, expensive queries to finish, etc. Not sure if this is still a concern though cc @zaycev
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 delay is very long with 5 (10+ seconds). I think we need a lower number.
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.
Yeah, I'd mentioned that to Vlad as well. Will let him comment on this
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.
5 was causing very long delays when there were issues with the api.
That was the original point for adding this delay - wait enough for transient issue to resolve. What are the down sites of it?
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.
It feels broken when nothing happens for 20 seconds. If every api call has this retry logic then we end up wasting a lot of time.
@@ -45,7 +45,7 @@ jobs: | |||
|
|||
- name: Upload results using action from ${{ matrix.target }} | |||
env: | |||
TRUNK_API_ADDRESS: https://api.trunk-staging.io/v1/metrics/createBundleUpload | |||
TRUNK_API_ADDRESS: https://api.trunk-staging.io |
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.
should we still call this TRUNK_API_ADDRESS? maybe TRUNK_API_ORIGIN would be more appropriate?
// Tokio-retry uses base ^ retry * factor formula. | ||
// This will give us 8ms, 64ms, 512ms, 4096ms, 32768ms | ||
const RETRY_BASE_MS: u64 = 8; | ||
const RETRY_FACTOR: u64 = 1; | ||
const RETRY_COUNT: usize = 5; | ||
const RETRY_COUNT: usize = 3; |
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've brought this up with Vlad before and he suggested keeping it at 5 because this gives the backend enough time to auto-resolve issues, expensive queries to finish, etc. Not sure if this is still a concern though cc @zaycev
This is ready for a re-review. |
LGTM |
In order to be able to quarantine tests we need to wrap the test execution and inspect the results of the test. If a test fails and that test is quarantined then we will override the exit code, otherwise we will return the original exit code.
Example: