Commit Graph

36 Commits

Author SHA1 Message Date
Alex Dadgar a6dfffa4fa Add testing interfaces 2018-02-15 13:59:00 -08:00
Michael Schurter ade29ecbed Improve check watcher logging and add tests
Also expose a mock Consul Agent to allow testing ServiceClient and
checkWatcher from TaskRunner without actually talking to a real Consul.
2017-09-14 16:47:41 -07:00
Alex Dadgar d86b3977b9 Fix alloc health with checks using interpolation
Fixes an issue in which the allocation health watcher was checking for
allocations health based on un-interpolated services and checks. Change
the interface for retrieving check information from Consul to retrieving
all registered services and checks by allocation. In the future this
will allow us to output nicer messages.

Fixes https://github.com/hashicorp/nomad/issues/2969
2017-08-07 16:27:08 -07:00
Alex Dadgar 067ed86a47 Client watches for allocation health using task state and Consul checks
This PR adds watching of allocation health at the client. The client can
watch for health based on the tasks running on time and also based on
the consul checks passing.
2017-07-07 12:10:04 -07:00
Michael Schurter c0eff81383 Fix Service.AddressMode changes during task updates 2017-06-21 17:19:08 -07:00
Michael Schurter 67d154a274 Test driver network advertisement and checks 2017-06-21 17:19:08 -07:00
Michael Schurter f286b6b798 Build new env from new alloc before interpolating 2017-05-04 15:06:15 -07:00
Michael Schurter 83f9591d75 Thanks go vet! 2017-04-19 13:05:41 -07:00
Michael Schurter c8d3e869c6 Unregister from Consul when waiting for restart 2017-04-19 12:42:48 -07:00
Michael Schurter a3fc157233 Fix circular test imports 2017-04-19 12:42:47 -07:00
Michael Schurter e204a287ed Refactor Consul Syncer into new ServiceClient
Fixes #2478 #2474 #1995 #2294

The new client only handles agent and task service advertisement. Server
discovery is mostly unchanged.

The Nomad client agent now handles all Consul operations instead of the
executor handling task related operations. When upgrading from an
earlier version of Nomad existing executors will be told to deregister
from Consul so that the Nomad agent can re-register the task's services
and checks.

Drivers - other than qemu - now support an Exec method for executing
abritrary commands in a task's environment. This is used to implement
script checks.

Interfaces are used extensively to avoid interacting with Consul in
tests that don't assert any Consul related behavior.
2017-04-19 12:42:47 -07:00
Diptanu Choudhury 54a5e795a5 Hooking up the executor in all drivers 2016-03-23 13:19:45 -07:00
Abhishek Chanda 34d3deff9b Run a bunch of tests in parallel 2016-02-21 19:42:03 -08:00
Diptanu Choudhury 2eb03e1d23 Renamed serviceId to serviceID 2015-12-14 15:57:56 -08:00
Diptanu Choudhury 6b6d74e2eb Fixed tests 2015-12-14 15:47:01 -08:00
Diptanu Choudhury 0c4b76e0ef Changing the prefix of the service 2015-12-14 11:14:22 -08:00
Diptanu Choudhury f932c5f9df Refactored test and added some comments 2015-12-11 14:14:04 -08:00
Diptanu Choudhury 1b942c158d Removing extra lines 2015-12-11 14:06:51 -08:00
Diptanu Choudhury c7c0748cea Making a struct to hold consul service config 2015-12-11 14:06:51 -08:00
Diptanu Choudhury d9fc07fb08 Added a test for the filtering logic of service and clients 2015-12-11 14:06:51 -08:00
Diptanu Choudhury a53e035b49 Deregister services and checks which are managed by Nomad 2015-12-11 14:06:51 -08:00
Diptanu Choudhury d54ccfb0ec Muted the consul debug messages 2015-12-11 09:06:03 -08:00
Diptanu Choudhury 86a45b5b39 Added a mock consul api client 2015-11-26 01:03:16 -08:00
Diptanu Choudhury 01ca982f92 Added a test for modifying check 2015-11-25 18:37:51 -08:00
Diptanu Choudhury db8c4170b3 Fixed merge conflicts 2015-11-25 18:32:37 -08:00
Diptanu Choudhury 5eb8a26376 Fixed tests 2015-11-25 18:23:47 -08:00
Diptanu Choudhury 3f82deff60 Added options for adding more consul configuration 2015-11-25 13:39:16 -08:00
Diptanu Choudhury 95942b4179 Improved tests 2015-11-25 12:06:14 -08:00
Diptanu Choudhury 576a6f402e Added a test to make sure we are adding a check to a service 2015-11-25 11:20:36 -08:00
Diptanu Choudhury f72027277d Dried the tests 2015-11-24 17:33:04 -08:00
Diptanu Choudhury 2c0822284b Tracking the tasks too 2015-11-24 17:26:30 -08:00
Diptanu Choudhury 919f763ca8 Added a test to re-sync services 2015-11-24 14:37:14 -08:00
Diptanu Choudhury 135006699b Renamed consul client to service 2015-11-24 12:34:26 -08:00
Diptanu Choudhury f525d86958 Added a test to ensure invalid services are not registered 2015-11-18 17:29:12 -08:00
Diptanu Choudhury 9592fd3912 Added a check for accpeting protocol information in consul check 2015-11-18 14:29:55 -08:00
Diptanu Choudhury 5608531143 Added a test to check check creation 2015-11-18 14:29:55 -08:00