Mocked activities retrying in workflow tests

Hey there,

I’m working on migrating from Cadence to Temporal, and one difference I’ve run up against is the default retry policy and how that affects mocked activities.

We have a number of workflow tests that mock the calls to activities therein. When we want to test that a workflow is performing certain logic when an activity returns an error, we’ll often mock the the activity and slap a .Once() on the activity; at least that’s how it was done when these workflows were written and tested against Cadence.

Moving to Temporal, the default retry policy runs up against our expectation that an activity will only be called once. So far, the solution seems to be to return non-retryable errors in our activity mocks. Alternatively we could remove the expectation that an activity is only called once, but that certainly adds a large amount of noise to what are already noisy test logs. Another possible solution would be to apply a different activity retry policy in our tests.

Regardless, I wanted to see if the community had any advice about this. For the most part, we don’t use retry policies for our activities, relying on the default retry policy that Temporal applies to activities.