java icon indicating copy to clipboard operation
java copied to clipboard

test: replace Thread.sleep with sync primitives in tests

Open therealemmanueloppong opened this issue 8 months ago • 4 comments

Replace flaky Thread.sleep calls with proper synchronization:

  • SharedProcessorTest: use Semaphore(0).acquire() instead of Thread.sleep(10s) so the worker blocks until interrupted by shutdownNow(), making the test deterministic and instant.

  • KubernetesReconcilerCreatorTest: use Wait.poll() instead of Thread.sleep(500ms) to actively poll until the work queue is populated, making the test faster and non-flaky.

Addresses part of #1223.

therealemmanueloppong avatar Mar 06 '26 17:03 therealemmanueloppong

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: emmaeng700 Once this PR has been reviewed and has the lgtm label, please assign yue9944882 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

k8s-ci-robot avatar Mar 06 '26 17:03 k8s-ci-robot

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: emmaeng700 / name: Emmanuel Oppong (1db41dda582b71c919554f4ceb313732d7d3614c, ebe9ea9e33ed9b8234252749e00d6a78bdf58502, f0b06cf216b629c28b239bc930a59e08d38d8328)

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Jun 04 '26 19:06 k8s-triage-robot

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

k8s-ci-robot avatar Jun 07 '26 02:06 k8s-ci-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle rotten
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Jul 07 '26 02:07 k8s-triage-robot