Commit Graph

35 Commits

Author SHA1 Message Date
Michael Schurter
3db835cb8f 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
3b300925a2 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
f72bbaa370 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
4117c8b3a2 Fix Service.AddressMode changes during task updates 2017-06-21 17:19:08 -07:00
Michael Schurter
8a7df57227 Test driver network advertisement and checks 2017-06-21 17:19:08 -07:00
Michael Schurter
3999b57e7d Build new env from new alloc before interpolating 2017-05-04 15:06:15 -07:00
Michael Schurter
b9ea2765ec Thanks go vet! 2017-04-19 13:05:41 -07:00
Michael Schurter
8e0c97e52f Unregister from Consul when waiting for restart 2017-04-19 12:42:48 -07:00
Michael Schurter
db8aabe1c3 Fix circular test imports 2017-04-19 12:42:47 -07:00
Michael Schurter
10cb924b2c 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
701a1bd9bc Hooking up the executor in all drivers 2016-03-23 13:19:45 -07:00
Abhishek Chanda
34b5dcbc50 Run a bunch of tests in parallel 2016-02-21 19:42:03 -08:00
Diptanu Choudhury
f089e249c8 Renamed serviceId to serviceID 2015-12-14 15:57:56 -08:00
Diptanu Choudhury
ed04b11862 Fixed tests 2015-12-14 15:47:01 -08:00
Diptanu Choudhury
68b1dd032e Changing the prefix of the service 2015-12-14 11:14:22 -08:00
Diptanu Choudhury
6a1e615991 Refactored test and added some comments 2015-12-11 14:14:04 -08:00
Diptanu Choudhury
45bdd1c5e5 Removing extra lines 2015-12-11 14:06:51 -08:00
Diptanu Choudhury
568006247d Making a struct to hold consul service config 2015-12-11 14:06:51 -08:00
Diptanu Choudhury
df14c98b3f Added a test for the filtering logic of service and clients 2015-12-11 14:06:51 -08:00
Diptanu Choudhury
f182c13729 Deregister services and checks which are managed by Nomad 2015-12-11 14:06:51 -08:00
Diptanu Choudhury
6af01d2d6f Muted the consul debug messages 2015-12-11 09:06:03 -08:00
Diptanu Choudhury
0534c4a640 Added a mock consul api client 2015-11-26 01:03:16 -08:00
Diptanu Choudhury
cdb28bf46f Added a test for modifying check 2015-11-25 18:37:51 -08:00
Diptanu Choudhury
75d95a4c83 Fixed merge conflicts 2015-11-25 18:32:37 -08:00
Diptanu Choudhury
f2f5f7ee36 Fixed tests 2015-11-25 18:23:47 -08:00
Diptanu Choudhury
ee14aa2781 Added options for adding more consul configuration 2015-11-25 13:39:16 -08:00
Diptanu Choudhury
e9019d1256 Improved tests 2015-11-25 12:06:14 -08:00
Diptanu Choudhury
92c635d278 Added a test to make sure we are adding a check to a service 2015-11-25 11:20:36 -08:00
Diptanu Choudhury
fdb26ae6a0 Dried the tests 2015-11-24 17:33:04 -08:00
Diptanu Choudhury
78555b509a Tracking the tasks too 2015-11-24 17:26:30 -08:00
Diptanu Choudhury
3051958323 Added a test to re-sync services 2015-11-24 14:37:14 -08:00
Diptanu Choudhury
b0c8cf6e36 Renamed consul client to service 2015-11-24 12:34:26 -08:00
Diptanu Choudhury
6c399ac5b9 Added a test to ensure invalid services are not registered 2015-11-18 17:29:12 -08:00
Diptanu Choudhury
bcfda2687e Added a check for accpeting protocol information in consul check 2015-11-18 14:29:55 -08:00
Diptanu Choudhury
0c5ddfae6b Added a test to check check creation 2015-11-18 14:29:55 -08:00