TestWorkflowEnvironment.sleep for Workflow.await vs Workflow.sleep

Hey team, I’m having an error while testing.

I saw this issue raised ages ago, but I think it’s the same: TestEnv Sleep Behavior

I want my workflow to do this (figuratively speaking, it’s a bit bigger):

while (!complete or attempts >= 10) {
    Workflow.await(Duration.ofDays(1)) { cmd != null }
    require(cmd != null) { "Cmd can't be null!" }
    complete = triggerChildWorkflow(cmd)
    Workflow.sleep(Duration.ofDays(1))
    attempts += 1
}

I’m having some bizarre behavior while testing, where I see my test hanging at Workflow.sleep and testWorkflowEnvironment.sleep, even though they’re for the same duration.

My question is:

  • Does Workflow.sleep() wait for timeskipping?
  • Is there some internal clock I need to be aware of while the rest of the test is executing to make sure I can align Workflow.sleep(Duration.ofDays(1)) and the same duration for testWorkflowEnvironment?