{"action":"closed","issue":{"url":"https://api.github.com/repos/coreos/fleet/issues/1504","repository_url":"https://api.github.com/repos/coreos/fleet","labels_url":"https://api.github.com/repos/coreos/fleet/issues/1504/labels{/name}","comments_url":"https://api.github.com/repos/coreos/fleet/issues/1504/comments","events_url":"https://api.github.com/repos/coreos/fleet/issues/1504/events","html_url":"https://github.com/coreos/fleet/issues/1504","id":140705805,"number":1504,"title":"Intermittent failure in TestScheduleOneWayConflict","user":{"login":"antrik","id":19555,"avatar_url":"https://avatars.githubusercontent.com/u/19555?v=3","gravatar_id":"","url":"https://api.github.com/users/antrik","html_url":"https://github.com/antrik","followers_url":"https://api.github.com/users/antrik/followers","following_url":"https://api.github.com/users/antrik/following{/other_user}","gists_url":"https://api.github.com/users/antrik/gists{/gist_id}","starred_url":"https://api.github.com/users/antrik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antrik/subscriptions","organizations_url":"https://api.github.com/users/antrik/orgs","repos_url":"https://api.github.com/users/antrik/repos","events_url":"https://api.github.com/users/antrik/events{/privacy}","received_events_url":"https://api.github.com/users/antrik/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/coreos/fleet/labels/area/testing","name":"area/testing","color":"bfe5bf"},{"url":"https://api.github.com/repos/coreos/fleet/labels/kind/bug","name":"kind/bug","color":"ff0000"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-03-14T15:21:56Z","updated_at":"2016-04-05T13:33:09Z","closed_at":"2016-04-05T13:33:09Z","body":"This test sometimes fails (see https://semaphoreci.com/coreos/fleet/branches/pull-request-1501/builds/3 ) due to a race condition in the test case. There is actually a [comment](https://github.com/coreos/fleet/blob/master/functional/scheduling_test.go#L286) in there saying:\r\n\r\n```\r\n// TODO(jonboulle): fix this race. Since we no longer immediately\r\n// remove unit state on unit destruction (and instead wait for\r\n// UnitStateGenerator/UnitStatePublisher to clean up), the old unit\r\n// shows up as active for quite some time.\r\n```\r\n\r\nI guess it could be fixed by using a similar loop as the one in [WaitForNActiveUnits()](https://github.com/coreos/fleet/blob/master/functional/platform/nspawn.go#L107). I wonder though whether checking the number of known units like that before checking the active units is really necessary? Maybe it could just be moved after the active units check -- or even dropped altogether?.."}}