Commit Graph

103 Commits

Author SHA1 Message Date
Seth Vargo efc1c8614b
Sleep for longer, but try less often
This fixes an issue where the system can quickly run out of file
descriptors because they are accumulating faster than the kernel can
release them.
2017-01-26 00:13:34 -05:00
Seth Vargo 4742adb36c
Check to see if TaggedAddresses have been populated
This ensures the node's anti-entropy checks have finished before
telling the client Consul is ready.
2017-01-26 00:13:03 -05:00
Seth Vargo 093fb59144 Omit empty node_meta 2017-01-17 20:17:20 -05:00
Kyle Havlovitz b3fdfb09d8
Minor formatting tweaks as a follow-up to #2654 2017-01-17 19:20:29 -05:00
Seth Vargo de0fa1a378 Do not skip tests when Consul is missing
This bit me on CI. The current behavior of the testutil server is to skip if consul isn't present. When lots of output is scrolling by, you're likely to miss the message that the test was skipped. Instead, I propose that we hard fatal if consul doesn't exist, and upstream consumers can skip the tests if they want.
2017-01-17 14:57:57 -05:00
Kyle Havlovitz 15f008b3e3
Update client api and docs for node metadata 2017-01-11 19:28:58 -05:00
Seth Vargo a3cd42bd68
Use a random port instead of idx in testutil
The testutil server uses an atomic incrementer to generate unique port
numbers. This works great until tests are run in parallel, _across
packages_. Because each package starts at the same "offset" idx, they
collide.

One way to overcome this is to run each packages' test in isolation, but
that makes the test suite much longer as it does not maximize
parallelization. Alternatively, instead of having "predictable" ports,
we can let the OS choose a random open port automatically.

This still has a (albeit smaller) race condition in that the OS could
return an open port twice, before the server has a chance to actually
start and occupy said port. In practice, I have not been able to hit
this race condition, so it either doesn't happen or it happens far less
frequently that the existing implementation.

I'm not sure how I feel about the panic, but this is just test code, so
I'm including to say it's okay?
2016-12-01 17:24:26 +02:00
Kyle Havlovitz dd05afb32e Add reload/leave http endpoints (#2516) 2016-11-30 13:29:42 -05:00
Kyle Havlovitz 2d37a07476 Add keyring http endpoints 2016-11-22 20:10:43 -05:00
James Phillips b339b0d2fc
Adds performance tuning capability for Raft, detuned defaults, and supplemental docs. 2016-08-24 21:58:37 -07:00
Sean Chittenden 72f7a4061c
Misc comment improvements 2016-06-20 15:29:38 -07:00
Sean Chittenden 3c909585df Clean up the test example in README
This works without an import cycle and has been `go fmt`'ified
2016-04-23 20:18:45 -07:00
Sean Chittenden 65f9017c63 Update Check API to use constants
Use constants where appropriate to advocate their use.  Also add a deprecation notice re: `updateTTL`.
2016-04-23 16:01:59 -07:00
kaskavalci cbc4b9d6c2 Make testutil.TestServer work correctly on Windows. 2016-04-15 15:44:30 +03:00
James Phillips 323a1682ac Merge pull request #1846 from TeaBough/master
Define a TestingT interface in server.go
2016-03-19 08:56:46 -07:00
Miquel Sabaté Solà 79d49336a8 Used 'unconvert' to remove unneeded conversions
I've removed unneeded conversions by performing the following commands:

    $ go get -u github.com/mdempsky/unconvert
    $ go list ./... | grep -v vendor | xargs unconvert -apply

Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
2016-03-18 16:12:56 +01:00
Thibault Vigouroux e0ebd0c913 Define a TestingT interface in server.go 2016-03-18 12:27:59 +01:00
Jeff Mitchell 9267f956a2 Update cleanhttp repo location 2015-10-22 14:14:22 -04:00
Jeff Mitchell 06bb9d5f36 Use cleanhttp to get rid of DefaultTransport 2015-10-22 10:47:50 -04:00
Jeff Mitchell 9cddc187b5 Don't use http.DefaultClient
Two of the changes are in tests; the one of consequence is in the API.
As explained in #1308 this can cause conflicts with downstream programs.

Fixes #1308.
2015-10-15 17:49:35 -04:00
Dale Wijnand c5168e1263 Fix a bunch of typos. 2015-09-15 13:22:08 +01:00
Robert Gogolok 7f637987dd testutil: support ACLMasterToken, ACLDatacenter and ACLDefaultPolicy 2015-06-11 11:25:05 +02:00
Seth Vargo bcb974a3d2 Allow the user to control the output of the test server 2015-06-08 10:16:11 -04:00
Ryan Uber 2fb1bc931e testutil: key leader wait on bootstrap flag 2015-05-08 18:16:35 -07:00
Ryan Uber 952fedf3d6 testutil: allow skipping leader wait, update example 2015-05-08 18:11:25 -07:00
Ryan Uber 2773926285 testutil: add a readme with sample usage 2015-04-22 20:46:59 -07:00
Ryan Uber 4f2f9534c4 testutil: error instead of panic 2015-04-22 20:35:27 -07:00
Ryan Uber 6851b36e88 Change node name based on idx 2015-03-30 23:45:44 -07:00
Ryan Uber 5b08cd712e testutil: add ListKV method 2015-03-23 22:47:34 -07:00
Ryan Uber bfa432064c testutil: disable checkpoint, fix waitForLeader 2015-03-23 19:27:59 -07:00
Ryan Uber b73382341e testutil: bind to localhost address 2015-03-23 18:59:45 -07:00
Ryan Uber a7c7350505 testutil: helpers return responses 2015-03-21 06:45:26 -07:00
Ryan Uber 3282c9f7fa testutil: test server supports domain sockets 2015-03-19 17:44:04 -07:00
Ryan Uber fb08a230ae testutil: support retrieving kv pairs 2015-03-19 17:03:07 -07:00
Ryan Uber 3ce57f8da6 testutil: support joining and specifying datacenters 2015-03-19 17:03:07 -07:00
Ryan Uber 73a2799b0d testutil: Use HTTPAddr 2015-03-19 17:03:07 -07:00
Ryan Uber 41efd8861a testutil: server comments 2015-03-19 17:03:07 -07:00
Ryan Uber 4fac64331f testutil: Support creating additional checks 2015-03-19 17:03:07 -07:00
Ryan Uber 2c95e425b4 testutil: allow creation of services 2015-03-19 17:03:06 -07:00
Ryan Uber cda925b742 testutil: working on helpers 2015-03-19 17:03:06 -07:00
Ryan Uber 64c1b1b446 testutil: exposing the API address from the test server 2015-03-19 17:03:06 -07:00
Ryan Uber 0af4bd8b23 testutil: initial pass at moving test server harness into testutil 2015-03-19 17:03:06 -07:00
Armon Dadgar 8b7417a043 testutil: Using the correct RPC struct 2014-06-10 19:12:36 -07:00
Nelson Elhage 87231e5234 WaitForLeader: Also wait for a non-zero index.
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.
2014-05-26 13:26:42 -07:00
Armon Dadgar 9470f9a5a2 gofmt 2014-05-20 16:25:29 -07:00
William Tisäter f7a33c2731 Speed up test runs in `WaitForResult` 2014-05-09 03:00:43 +02:00
William Tisäter e1471576a4 Increase timeout for `WaitForResult` 2014-05-09 02:43:48 +02:00
William Tisäter 1ee709ba38 Require datacenter argument for `WaitForLeader` 2014-05-09 01:17:35 +02:00
William Tisäter 20eb682ef6 Add test file for testutil 2014-05-07 23:42:15 +02:00
William Tisäter bdbe97545a Drop client arguments from `WaitForLeader` 2014-05-07 23:41:14 +02:00
William Tisäter 2019f454d0 Fix `TestCatalogListNodes_StaleRaad` with `WaitForLeader` 2014-05-07 13:53:29 +02:00
William Tisäter 82ec4e5fba Add `testutils.WaitForLeader` and truly wait 2014-05-07 11:43:42 +02:00
William Tisäter 81b572cb31 Proof of concept using `WaitForResult` in tests 2014-05-07 02:48:25 +02:00