~axwalk/juju-core/lp1303195-manual-ubuntuuser-bash

Viewing all changes in revision 1279.

  • Committer: Tarmac
  • Author(s): John Arbash Meinel
  • Date: 2013-06-13 11:53:15 UTC
  • mfrom: (1278.1.4 timing-test)
  • Revision ID: tarmac-20130613115315-e58eqa122kc07o1a
[r=jameinel] cmd/juju: Make a test deterministic

TestGatherDescriptionsInParallel was timing dependent, and occasionally failed on my system. Rather than just increasing the timeout arbitrarily, I changed the code to be more 'event' based. Each plugin requires another plugin to have started before that plugin will return. Thus, if we don't start the plugins in parallel, the plugin will deadlock.

Because the failure mode is 'deadlock', I wrapped the call in a select timeout. This means that if it *does* fail, we have a garbage goroutine and process lying around (but it should never fail).

On the plus side, this makes it actually run faster, since each subprocess
doesn't waste time sleeping just so we can measure it. (from 350ms down to normally around 15ms.)

This is the only test that was failing (based on occasional timing hiccups) for me, which allows us to have this in tarmac.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: