Skip to content

Detect infinite render loops in unit tests #764

Open
@zach-klippenstein

Description

@zach-klippenstein

If you have a worker that is incorrectly implemented, in that it always returns false from doesSameWorkAs and its Flow completes immediately, your workflow will enter an infinite render loop.

This might seem like a weird thing to do, but if your worker is a Mockito mock and you forget to override doesSameWorkAs, it's exactly what will happen. We can detect this situation in the WorkflowTester API by counting render passes, and if you hit some extraordinarily high number of passes before even running the test block, fail the test with some message about this case.

cc @afollestad

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions