Commit Graph

5 Commits

Author SHA1 Message Date
James Phillips 9572e504d3
Bumps the standard retry up. 2018-02-07 18:03:39 -08:00
James Phillips 6103198732
Tweaks some tests that were having a hard time in Travis CI and
bumps up the default retry time.
2017-05-09 06:48:26 -07:00
Frank Schroeder 0a7898f039
test: simplify tests that check for peers 2017-05-05 17:07:04 +02:00
James Phillips 7007c89870
retry: Removes the description parameter. 2017-05-05 17:07:03 +02:00
Frank Schroeder 9f369c93c7
retry: add retry package for retriable tests
The current retry framework in testutil/testprc.WaitForResult uses
a func() (bool, error) callback until it succeeds or times out.
It captures the last error and returns it.

    if err := testutil.WaitForResult(t, func() (bool, error) {
	if err := foo(); err != nil {
	    return false, err
	}
	...
	return true, nil
    }); err != nil {
	t.Fatal(err)
    }

This makes the test functions more complex than they need to be since
both the boolean and the error indicate a success or a failure.

The retry.Run framework uses a an approach similar to t.Run()
from the testing framework.

    retry.Run(t, func(r *retry.R) {
	if err := foo(); err != nil {
	    r.Fatal(err)
	}
    })

The behavior of the Run function is configurable so that different
timeouts can be used for different tests.
2017-05-05 17:07:02 +02:00