Add HA configuration code and simplify tests.