Adding integration and unit tests for agent drain

[for #51936305]

Signed-off-by: Colin Humphreys <hatofmonkeys@gmail.com>