Skip to content
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 switch to log results to JSON file #630

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stormsilver
Copy link

@stormsilver stormsilver commented Apr 6, 2018

The --consolidated-results switch causes results like tests per process, time taken, and total failures
to be logged to a JSON file at the path supplied.

This is useful for us because we'd like to take these results and post them to our Github status checks.

The --consolidated-results switch causes results like tests per process, time taken, and total failures
to be logged to a JSON file at the path supplied.
end

def write_consolidated_results(consolidated_results, options)
return if options[:consolidated_results].nil? || options[:consolidated_results].empty?
Copy link
Owner

Choose a reason for hiding this comment

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

not a big fan of supporting "" ... can simplify to return unless options[:consolidated_results]

@@ -216,6 +236,7 @@ def parse_options!(argv)
opts.on("--unknown-runtime [FLOAT]", Float, "Use given number as unknown runtime (otherwise use average time)") { |time| options[:unknown_runtime] = time }
opts.on("--first-is-1", "Use \"1\" as TEST_ENV_NUMBER to not reuse the default test environment") { options[:first_is_1] = true }
opts.on("--verbose", "Print more output") { options[:verbose] = true }
opts.on("--consolidated-results [PATH]", "Location to write consolidated test results") { |path| options[:consolidated_results] = path }
Copy link
Owner

Choose a reason for hiding this comment

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

maybe json-summary or so ?

@grosser
Copy link
Owner

grosser commented Apr 8, 2018

hmm idk overall looks like a fair bit of added complexity to write a format that won't be useful to very many ... also missing any tests

seconds = ParallelTests.delta { yield }.to_i
puts "\nTook #{seconds} seconds#{detailed_duration(seconds)}"
message = "Took #{seconds} seconds#{detailed_duration(seconds)}"
consolidated_results[:time_taken] = {
Copy link
Owner

Choose a reason for hiding this comment

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

how long the command took is easily gathered by whatever process runs the parallel_tests command
also time_taken: seconds might be good enough, don't really need the custom format if this goes through post-processing anyway

@@ -28,7 +28,11 @@ def summarize_results(results)

output << super

output.join("\n\n")
consolidated_results[:summary] = {
Copy link
Owner

Choose a reason for hiding this comment

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

output is everything the command prints, not sure why it needs to be in the json ... will make kit so much bigger ...

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

Successfully merging this pull request may close these issues.

2 participants