This patch removes duplicate internal copies of constants in the structs
package which are also defined in the api package. The api.KVOp type
with all its values for the TXN endpoint and the api.HealthXXX constants
are now used throughout the codebase.
This resulted in some circular dependencies in the testutil package
which have been resolved by copying code and constants and moving the
WaitForLeader function into a separate testrpc package.
The last change here made the time overall theoretically the same, but the overhead of running so quickly before probably meant that we were spending longer. Tests seemed marginal in Travis so doubling this to see how things go.
On my laptop, I'm currently seeing a huge number of intermittent test
failures all related to WaitForLeader returning after the test node has
become a leader, but before it has actually finished starting up, in
particular, performing the serf/Raft reconciliation.
Waiting for the index to become nonzero makes the tests pass reliably,
by also blocking until the new leader has started committing state.