Skip to content
This repository has been archived by the owner on Sep 4, 2021. It is now read-only.

scheduler: Fix test races #2961

Merged
merged 2 commits into from Jun 20, 2016
Merged

scheduler: Fix test races #2961

merged 2 commits into from Jun 20, 2016

Conversation

lmars
Copy link
Contributor

@lmars lmars commented Jun 20, 2016

See commit messages, hopefully fixes the recent flakiness in CI.

When a formation change happens, jobs are started and stopped in
goroutines which means there is no guarantee the tests will get
formation events before job events.

In most cases, the test just cares that a job event occurs. The fact
that it is due to a formation change is irrelevant, so there is no need
to explicitly wait for the formation event.

Signed-off-by: Lewis Marshall <lewis@lmars.net>
TestMultipleHosts starts and stops jobs whilst the scheduler is paused
and then relies on the scheduler seeing the started job before the
stopped one. This is so that the number of jobs involved is predictable
(if the scheduler sees the stopped job first, it starts a replacement
job, then sees another job started and kills the one it just started).

Since the scheduler has a goroutine per host, there is no guarantee
which goroutine will handle it's event first, so a hook has been added
to ensure the event from AddJob has made it to the scheduler before
returning.

Signed-off-by: Lewis Marshall <lewis@lmars.net>
@titanous
Copy link
Contributor

LGTM

@lmars lmars merged commit 2415ebb into master Jun 20, 2016
@lmars lmars deleted the scheduler-test-races branch June 20, 2016 02:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants