vscode-bitbake icon indicating copy to clipboard operation
vscode-bitbake copied to clipboard

Integration test helpers can mask timeout failures

Open gcomneno opened this issue 2 months ago • 0 comments

assertWillComeTrue() currently awaits its predicate while polling, but the final assertion does not:

assert.ok(predicate())

Since the predicate returns a Promise<boolean>, the assertion checks the Promise object itself, which is truthy.

This means the normal happy path still works: if the predicate eventually becomes true, the polling loop exits normally. But if the predicate stays false until the timeout expires, the helper can incorrectly succeed instead of failing.

A focused regression test reproduces this with a predicate that always returns false:

  • before the fix, assertWillComeTrue() resolves instead of rejecting;
  • after changing the final assertion to assert.ok(await predicate()), it fails as intended.

There is a second parameter-wiring issue in assertWorkspaceWillBeOpen():

assertWillComeTrue(predicate, timeout)

The second argument of assertWillComeTrue() is the polling interval, not the timeout. Therefore the default 10000 value becomes a 10-second polling interval while the actual timeout remains the default 300 seconds.

So the two issues can reinforce each other:

  1. workspace polling may continue for much longer than intended;
  2. if the real timeout is eventually reached, the final Promise assertion can still mask the failure.

Proposed fix:

  • await the predicate in the final assertion;
  • pass the workspace timeout in the third argument slot;
  • add focused regression coverage for the timeout failure path;
  • correct the stale BITBAKE_TIMEOUT comment: 300000 ms is 5 minutes, not 3.

A local RED/GREEN reproduction confirms the behavior:

  • baseline: focused regression test fails because the expected rejection is missing;
  • fixed helper: the same regression test passes.

gcomneno avatar Sep 28 '26 17:09 gcomneno