Don’t Be ‘Thread’-ened: Testing Multithreaded Code with Confidence
summary
Shows how separating core logic from threads — divide and conquer — turns about 80% of concurrency tests into simple single‑threaded specs, and tackles the remaining ~20% by replacing flaky sleeps with Ruby condition variables and concurrent-ruby CountdownLatch to wait for N events. Demonstrates method redefinition in tests to inject a latch without changing production code, producing deterministic CI‑friendly tests whose failures signal real bugs rather than timing luck.
AI-written summary · about
chapters (9)
- 0:00Introduction
- 1:14Flaky tests in multithreading
- 3:00Ruby client for NATS
- 4:24Divide and conquer testing
- 5:29Testing thread loops with latches
- 7:35Concurrent Ruby for tests
- 9:21Metaprogramming to test
- 10:29Countdown latches advantages
- 10:54Testing versus visa process
related talks
47mWhat All Rubyists Should Know About Threads
42mLook out! Gotchas of Using Threads in Ruby
39mConcurrent Systems in Ruby
30mAdvanced Multithreading in Ruby
45mUnit testing patterns for Concurrent code
36mModern Concurrency Practices in Ruby
54mConcurrency: Rubies, plural
33mDear God What Am I Doing? Concurrency and Parallel Processing
