Skip to content

test: raise the thread pool minimum for the concurrency tests - #1379

Merged
hjgraca merged 2 commits into
developfrom
test/concurrency-threadpool-min
Nov 26, 2026
Merged

hjgraca merged 2 commits into
developfrom
test/concurrency-threadpool-min

Conversation

@hjgraca

@hjgraca hjgraca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Issue number: closes #1377

Summary

Changes

AWS.Lambda.Powertools.ConcurrencyTests now raises the thread-pool minimum to 64 worker threads in a module initializer, before any test runs.

The assembly runs its test classes in parallel and has about 225 blocking calls (Barrier.SignalAndWait, Wait(), Thread.Sleep). On small GitHub runners, the thread pool only adds threads slowly, so short Task.Run work can wait for seconds. That's why MetricsAsyncContextTests.FlushDuringBackgroundWork_ShouldNotThrowException failed with "Background tasks did not start in time". Its tasks only increment a counter before any Metrics code runs.

A small ThreadPoolSetupTests guard checks that the initializer ran.

User experience

No library change, test infrastructure only. The concurrency suite runs about twice as fast locally (about 30 s instead of 55 s per framework), because the test classes now really run at the same time.

Testing

Merge danger: two-way door. Blast radius: the AWS.Lambda.Powertools.ConcurrencyTests test project only.

Checklist

Please leave checklist items unchecked if they do not apply to your change.

Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@hjgraca hjgraca added the internal Maintenance changes label Nov 26, 2026
@boring-cyborg boring-cyborg Bot added the tests label Nov 26, 2026
@powertools-for-aws-oss-automation powertools-for-aws-oss-automation Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 26, 2026
@codecov

codecov Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.78%. Comparing base (358c3fc) to head (b0d20bb).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1379   +/-   ##
========================================
  Coverage    80.78%   80.78%           
========================================
  Files          306      306           
  Lines        13102    13102           
  Branches      1563     1563           
========================================
  Hits         10585    10585           
  Misses        2076     2076           
  Partials       441      441           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sonarqubecloud

Copy link
Copy Markdown

@hjgraca
hjgraca merged commit 75edaa3 into develop Nov 26, 2026
11 checks passed
@hjgraca
hjgraca deleted the test/concurrency-threadpool-min branch November 26, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Maintenance changes size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky test: MetricsAsyncContextTests.FlushDuringBackgroundWork fails when the CI thread pool is starved

1 participant