added ability to cancel retries in unit tests

This is needed for retries with arbitrary max attempts so that they are not able block workflows in unit tests that retry forever (or until a time out).