IntegrationTestCase#assert_file can take a string or regex.
Move metrics add on to separate file and write integration test.