Commit Graph

51 Commits

Author SHA1 Message Date
James Phillips 66ec9c7a7d
Fixes HTTP header compare by including standard headers. 2017-06-08 14:10:46 -07:00
Frank Schröder 825f72f5ef agent: support custom header and method for http checks (#3106)
This patch adds support for custom headers and
method for HTTP checks.

Fixes #2474
Fixes #2657
Fixes #3106
2017-06-07 01:11:56 +02:00
Frank Schroeder aa92adcdd5
test: increase sleep time for test 2017-05-31 00:29:28 +02:00
Frank Schroeder 7c5892a196
test: use UniqueID prefix for check tests to unify log output 2017-05-31 00:29:28 +02:00
Frank Schroeder c5f565ee1a
test: remove output to stdout 2017-05-31 00:29:26 +02:00
Frank Schroeder 584693482d
test: fix data race in MockNotify
42 -> 32 data races
2017-05-31 00:29:25 +02:00
Frank Schroeder 308f9929b3
test: run agent tests in parallel
This brings down the test run from 108 sec to 15 sec.

There is an occasional port conflict because of the nature
the next port is chosen. So far it seems rare enough to live
with it.
2017-05-31 00:29:23 +02:00
James Phillips ddfa57765c
retry: Removes the description parameter. 2017-05-05 17:07:03 +02:00
Frank Schroeder 21a82a0a16
test: Refactor WaitForResult tests with retry
Refactor tests that use testutil.WaitForResult to use retry.

Since this requires refactoring the test functions in general this patch
also shows the use of the github.com/pascaldekloe/goe/verify library
which provides a good mechanism for comparing nested data structures.
Instead of just converting the tests from testutil.WaitForResult to
retry the tests that performing a nested comparison of data structures
are converted to the verify library at the same time.
2017-05-05 17:07:02 +02:00
Frank Schroeder 48fa2962eb Revert "test: Run command/agent tests in parallel"
This reverts commit 17be40a733.
2017-04-27 14:39:04 -07:00
Frank Schroeder 17be40a733 test: Run command/agent tests in parallel 2017-04-27 10:34:30 -07:00
Frank Schroeder eddb1af603 Remove duplicate constants
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.
2017-04-20 09:54:49 -07:00
Seth Vargo 0170a28ec9
Use new APIs 2017-03-23 18:48:13 -04:00
Yakau Bubnou e52fd6e0af Concurrent-safe notification mock
This patch provides additional attribute to the notification mock in
order to protect an access to the internal maps from multiple
go-routines. This is required to prevent panic errors caused by
inconsistent map state.
2016-12-07 19:31:44 +03:00
James Phillips 2f341738a1 Removes stale reference to reap lock which causes a panic. (#2490) 2016-11-09 09:52:07 -08:00
Kyle Havlovitz e665ec87aa Add WaitForResult to some flaky tests (#2477)
This replaces some hard sleeps with testutil.WaitForResult retry
logic in some recently added tests around TLSSkipVerify in checks.
2016-11-04 21:55:55 -07:00
Kyle McCullough 73b281a27c Add setting to skip ssl certificate verification for HTTP checks (#1984)
* http check: add setting to skip ssl certificate verification

* update http check documentation

* fix typo in documentation

* Add TLSSkipVerify to agent api
2016-11-03 13:17:30 -07:00
Kyle Havlovitz dce6702268 More flaky unit test fixes (#2449)
* More flaky unit test fixes
* Raise some test timeouts that were too low
2016-10-31 09:59:20 -07:00
Sean Chittenden 63adcbd5ef
Revert "Move `structs.CheckID` to a new top-level package, `types`."
This reverts commit 2bbd52e3b44ff1b60939a8400264d534662d6d51.
2016-06-07 16:59:02 -04:00
Sean Chittenden cbb945e76a
Move `structs.CheckID` to a new top-level package, `types`.
Per discussion w/ @slackpad, move this type to its own top-level package
2016-06-07 16:59:02 -04:00
Sean Chittenden f5ab25163e
Move `structs.CheckID` to a new top-level package, `types`.
Per discussion w/ @slackpad, move this type to its own top-level package
2016-06-07 16:59:02 -04:00
Sean Chittenden ddbe64a8c8
Float a type balloon. Some strings are square pegs in round holes.
This experiment was brought about because of variable naming
confusion where name and checkIDs were interchanged.  Gave CheckID
an Qualified Type Name and chased downstream changes.
2016-06-07 16:59:02 -04:00
James Phillips ceac68c5eb Merge pull request #1762 from mshean/script-timeout
Add Timeout field to CheckMonitor
2016-04-24 23:08:06 -07:00
Sean Chittenden e63d3a1275 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
Matt Shean fe4107019e add Timeout field to CheckMonitor 2016-04-20 11:41:30 -07:00
Ryan Uber 8cc16b8238 agent: limit HTTP check output to 4k 2016-04-14 14:28:07 -07:00
James Phillips 70575002d9 Retains the last output when a TTL check times out. 2016-03-02 17:58:01 -08:00
James Phillips 343838f12b Adds support for the reap lock. 2016-01-12 21:10:25 -08:00
James Phillips 95c708f65e Adds Docker checks support to client API.
Also changed `DockerContainerId` to `DockerContainerID`, and updated the agent
API docs to reflect their support for Docker checks.
2015-11-18 07:40:02 -08:00
Diptanu Choudhury 3d68d06ac7 Forcing the Env variable to empty while testing the default shell logic 2015-10-26 20:35:13 -07:00
Diptanu Choudhury 2fdcf1ae28 Added a test for selecting shell from env 2015-10-26 20:21:50 -07:00
Diptanu Choudhury 1e240b5c59 Fixed the tests 2015-10-26 18:20:02 -07:00
Diptanu Choudhury f0c783d1a8 Added a test to check if we are properly truncating docker exec outputs 2015-10-26 18:06:55 -07:00
Diptanu Choudhury 582786523a Added a test for exit code 1 with docker exec 2015-10-26 16:58:09 -07:00
Diptanu Choudhury 9efbd1affa Fixed the Fake Docker client to simulate Exec start failures 2015-10-26 16:54:51 -07:00
Diptanu Choudhury 31cdf4fe64 Added some tests for docker check 2015-10-26 12:59:40 -07:00
Peter Fern b023904298 Add TCP check type
Adds the ability to simply check whether a TCP socket accepts
connections to determine if it is healthy.  This is a light-weight -
though less comprehensive than scripting - method of checking network
service health.

The check parameter `tcp` should be set to the `address:port`
combination for the service to be tested.  Supports both IPv6 and IPv4,
in the case of a hostname that resolves to both, connections will be
attempted via both protocol versions, with the first successful
connection returning a successful check result.

Example check:

```json
{
  "check": {
    "id": "ssh",
    "name": "SSH (TCP)",
    "tcp": "example.com:22",
    "interval": "10s"
  }
}
```
2015-07-24 14:06:05 +10:00
Ryan Uber 952ec284a4 agent: disable HTTP keepalives for checks 2015-03-15 13:30:50 -07:00
arnaud briche bbb5f4696a - add tests for CheckHTTP with new timeout parameter && CheckType.Timeout parsing 2015-02-02 15:30:44 +07:00
Ryan Uber eda2171bbe agent: make check tests more reliable 2015-01-23 16:07:20 -08:00
Nicholas Capo 641476a822 command/agent: Add tests for HTTP Check 2015-01-13 00:09:42 +00:00
Ryan Breen f2bd641402 Clean up log line and reduce test time. 2014-12-18 09:00:51 -05:00
Ryan Breen d82ef7bb8c Test that staggered checks run within the defined interval. 2014-12-17 22:39:11 -05:00
Nelson Elhage 8af424fc4c tests: Don't generate binary output from checks.
The tests will end up logging the check output, and spewing random
binary all over a terminal never results in anything good.
2014-05-26 13:23:10 -07:00
William Tisäter 0e865daf4c Run checks more often in `expectStatus` 2014-05-09 03:41:10 +02:00
William Tisäter cdc59aa5d3 Fix race condition in `TestCheckTTL`
Apparently the execution of `TestCheckTTL` could sometime take > 10ms
causing it to fail. This commit will eliminate the race condition for
most modern hardware.
2014-05-06 20:54:49 +02:00
Armon Dadgar 64efde9be0 agent: Limit health check output to 4K. Fixes #83. 2014-04-29 15:28:56 -07:00
Armon Dadgar 410a0de0c8 Seperate localState from Agent 2014-01-21 11:52:25 -08:00
Armon Dadgar 7aa278e2ef Allow setting the health check notes 2014-01-20 17:19:20 -10:00
Armon Dadgar 939c381d87 Adding CheckTTL for TTL based checks 2014-01-20 17:12:40 -10:00