separate test utils to be shared with sentinel tests
(partial cherrypick of 32eedbe6, 17ba148c, 15879c9c, 215f2c11)