977c88dcea
This changeset refactors the tests of the draining node watcher so that we don't mock the node watcher's `Remove` and `Update` methods for its own tests. Instead we'll mock the node watcher's dependencies (the job watcher and deadline notifier) and now unit tests can cover the real code. This allows us to remove a bunch of TODOs in `watch_nodes.go` around testing and clarify some important behaviors: * Nodes that are down or disconnected will still be watched until the scheduler decides what to do with their allocations. This will drive the job watcher but not the node watcher, and that lets the node watcher gracefully handle cases where a heartbeat fails but the node heartbeats again before its allocs can be evicted. * Stop watching nodes that have been deleted. The blocking query for nodes set the maximum index to the highest index of a node it found, rather than the index of the nodes table. This misses updates to the index from deleting nodes. This was done as an performance optimization to avoid excessive unblocking, but because the query is over all nodes anyways there's no optimization to be had here. Remove the optimization so we can detect deleted nodes without having to wait for an update to an unrelated node. |
||
---|---|---|
.. | ||
drain_heap.go | ||
drain_heap_test.go | ||
drain_testing.go | ||
drainer.go | ||
drainer_util.go | ||
drainer_util_test.go | ||
draining_node.go | ||
draining_node_test.go | ||
watch_jobs.go | ||
watch_jobs_test.go | ||
watch_nodes.go | ||
watch_nodes_test.go |