Sometimes `needs` might not be properly respected with `when`

For the following example:

build-a:
  stage: build
  script: sleep 60s

build-b:
  stage: build
  script: sleep 1s && false

test-a:
  stage: test
  needs: [build-a]
  script: sleep 1s
  when: on_success

test-b:
  stage: test
  script: sleep 1s

The test-a will not be run due to race condition.

It seems that we might want to transition test-a first.

We need to validate that.

Edited by Kamil Trzciński