def test_get_hosts_forgotten_draining( mock_get_hosts_past_maintenance_start, mock_get_draining_hosts, ): mock_get_draining_hosts.return_value = ['fake-host1', 'fake-host2'] mock_get_hosts_past_maintenance_start.return_value = ['fake-host2'] assert get_hosts_forgotten_draining() == ['fake-host2']
def test_get_hosts_forgotten_draining( mock_get_hosts_past_maintenance_start, mock_get_draining_hosts, ): mock_get_draining_hosts.return_value = ['fake-host1', 'fake-host2'] mock_get_hosts_past_maintenance_start.return_value = ['fake-host2'] assert get_hosts_forgotten_draining() == ['fake-host2']
def cleanup_forgotten_draining(): """Clean up hosts forgotten draining""" log.debug("Cleaning up hosts forgotten draining") hosts_forgotten_draining = get_hosts_forgotten_draining(grace=seconds_to_nanoseconds(10 * 60)) if hosts_forgotten_draining: undrain(hostnames=hosts_forgotten_draining) else: log.debug("No hosts forgotten draining")
def test_get_hosts_forgotten_draining(mock_get_hosts_past_maintenance_start, mock_get_draining_hosts): mock_get_draining_hosts.return_value = ["fake-host1", "fake-host2"] mock_get_hosts_past_maintenance_start.return_value = ["fake-host2"] assert get_hosts_forgotten_draining() == ["fake-host2"]