open-nomad/nomad/drainer
Tim Gross 977c88dcea
drainer: test refactoring to clarify behavior around delete/down nodes (#16612)
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.
2023-03-23 14:07:09 -04:00
..
drain_heap.go Add gosimple linter (#9590) 2020-12-09 11:05:18 -08:00
drain_heap_test.go ci: swap ci parallelization for unconstrained gomaxprocs 2022-03-15 12:58:52 -05:00
drain_testing.go drainer: test refactoring to clarify behavior around delete/down nodes (#16612) 2023-03-23 14:07:09 -04:00
drainer.go cleanup: replace TypeToPtr helper methods with pointer.Of (#14151) 2022-08-17 18:26:34 +02:00
drainer_util.go drain: improve tests and fix spelling 2018-04-02 16:40:47 -07:00
drainer_util_test.go ci: swap ci parallelization for unconstrained gomaxprocs 2022-03-15 12:58:52 -05:00
draining_node.go CSI: node drain should end once only plugins remain (#12846) 2022-05-03 10:20:22 -04:00
draining_node_test.go build: run gofmt on all go source files 2022-08-16 11:14:11 -05:00
watch_jobs.go drainer: test refactoring to clarify behavior around delete/down nodes (#16612) 2023-03-23 14:07:09 -04:00
watch_jobs_test.go cleanup: replace TypeToPtr helper methods with pointer.Of (#14151) 2022-08-17 18:26:34 +02:00
watch_nodes.go drainer: test refactoring to clarify behavior around delete/down nodes (#16612) 2023-03-23 14:07:09 -04:00
watch_nodes_test.go drainer: test refactoring to clarify behavior around delete/down nodes (#16612) 2023-03-23 14:07:09 -04:00