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

WIP Report unexpected tests, discovered-but-unrun tests #67

Merged
merged 7 commits into from
Dec 16, 2016

Conversation

mistydemeo
Copy link
Contributor

@mistydemeo mistydemeo commented Dec 9, 2016

This is adapted from a couple of commits in @aroben's suite-files branch. This is definitely still broken, opening a PR to compare cibuild results to my local runs.

  1. In the "rename" test, the queue passed when Runner is instantiated at the beginning of the second test run contains both the old and new suite names, both associated with the same path. The old suite names are flagged as discovered-but-not-run.

  2. A couple of the rspec examples are broken, possibly due to example splitting.

@mistydemeo mistydemeo force-pushed the warn_skipped_unexpected_suites branch 2 times, most recently from 428eee7 to d0e0bc7 Compare December 10, 2016 01:19
@mistydemeo
Copy link
Contributor Author

Based on a discussion with @bhuga, I've tweaked discovery to always run even if the stats file contains all of the whitelisted tests.

@aroben
Copy link
Collaborator

aroben commented Dec 12, 2016

@mistydemeo Let me know when you're ready for review!

@mistydemeo
Copy link
Contributor Author

With the tests passing now, I think I'm ready for comments.

Copy link
Collaborator

@aroben aroben left a comment

Choose a reason for hiding this comment

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

Nice! It'll be great to have this error checking in place.

What do you think about going a step further and verifying that suites were run on the same worker we assigned them to? If we sent a hostname/pid pair in the POP message then we could keep track of which worker was assigned which suite, then check that against worker.suites at the end. Does that seem worthwhile? It seems like it might get us closer to figuring out exactly how things went wrong when these checks fail.

@@ -311,13 +338,17 @@ def enqueue_discovered_suite(suite_name, path)

if @original_queue.include?([suite_name, path])
# This suite was already added to the queue some other way.
# We still want to track it in the list of discovered suites though.
@discovered_suites << [suite_name, path]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd move this up to before the if and get rid of the comment. That will get rid of the duplication of this line after the block.

@@ -162,13 +168,34 @@ def summarize_internal
puts @failures
end

skipped_suites = @discovered_suites - run_suites
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm pretty sure we want to skip all this logic on remote masters (i.e., if relay? is true). Remote masters don't discover suites so @discovered_suites will always be empty, but run_suites will not be empty, so we'll always have "unexpected" suites. (If that turns out to be correct, it'd be great to have a test that verifies this if possible.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, I hadn't considered this. Updated.

@bhuga
Copy link
Collaborator

bhuga commented Dec 12, 2016

What do you think about going a step further and verifying that suites were run on the same worker we assigned them to?

Can this get weird if a suite is moved from one file to another, and a worker loads a file with an unassigned suite? Or is that all handled nicely?

@aroben
Copy link
Collaborator

aroben commented Dec 12, 2016

Can this get weird if a suite is moved from one file to another, and a worker loads a file with an unassigned suite? Or is that all handled nicely?

In response to POP, workers are told "load file foo/bar.rb then run suite BazTest which you should find inside it". If the worker loads that file and the suite is not inside it, two things can happen:

  1. Maybe the worker got lucky and already loaded a file that happens to have BazTest in it, in which case it will run BazTest even though it was in a different file. (Maybe this behavior should be changed; I'd be happy to think through it if someone has opinions.)
  2. If the worker has never heard of BazTest before, it just skips the suite and asks for another one. (This is needed to handle the case of deleted suites. They might be present in .test_queue_stats and thus in the queue but then we'll find they no longer exist.)

So I don't think we need to worry about loading a file with an unassigned suite; if the suite's name doesn't match it won't run it.

@bhuga
Copy link
Collaborator

bhuga commented Dec 12, 2016

So I don't think we need to worry about loading a file with an unassigned suite; if the suite's name doesn't match it won't run it.

Alright. Another thing to consider with host tracking with this we'd need to track assigned tests instead of discovered tests. This is a line more complicated, because we can assign tests that don't get run because tests are moved or deleted. So the algorithm needs to be:

  • Take all assigned tests
  • Reject tests not loaded by discovery process
  • Determine that all remaining assigned tests were reported by the host they were assigned to

@mistydemeo
Copy link
Contributor Author

Updated - it now reports on whether tests were run on the assigned hosts, as well as whether tests were missing or run unexpectedly.

Copy link
Collaborator

@aroben aroben left a comment

Choose a reason for hiding this comment

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

This looks great!

Copy link
Collaborator

@aroben aroben left a comment

Choose a reason for hiding this comment

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

Hm, CI is failing. See below for my guess why.

puts

@stats.save

summarize

estatus = @completed.inject(0){ |s, worker| s + worker.status.exitstatus }
estatus += 1 unless @discovered_suites.empty? && misrun_suites.empty? && unassigned_suites.empty?
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think unassigned_suites will be non-empty on remote masters because @discovered_suites will always be empty. Seems like maybe more of the work needs to move into the if !relay? block.

@mistydemeo
Copy link
Contributor Author

Updated to ignore that logic on relays.

Copy link
Collaborator

@aroben aroben left a comment

Choose a reason for hiding this comment

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

I pushed one tiny change to reduce some duplicated logic when computing the exit status. This looks great. Thank you!

@aroben aroben merged commit 1f50a7a into tmm1:master Dec 16, 2016
@mistydemeo mistydemeo deleted the warn_skipped_unexpected_suites branch December 16, 2016 20:30
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.

None yet

3 participants