This is used across multiple tests, so let's move into the util file. Also, refactor it a bit to provide a better error message in case of a failure. Signed-off-by: David Porter <david@porter.me>