Skip to content

Disable the SSH eviction thread in tests#1721

Merged
djmb merged 1 commit intomainfrom
fix-mocha-background-thread-errors
Nov 26, 2025
Merged

Disable the SSH eviction thread in tests#1721
djmb merged 1 commit intomainfrom
fix-mocha-background-thread-errors

Conversation

@djmb
Copy link
Collaborator

@djmb djmb commented Nov 26, 2025

Sometimes we get errors like this in tests:

/home/runner/work/kamal/kamal/vendor/bundle/ruby/3.2.0/gems/sshkit-1.24.0/lib/sshkit/backends/connection_pool.rb:139:in `block in run_eviction_loop': #<AnyInstance:Object> was instantiated in CliProxyTest#test_upgrade but it is receiving invocations within
another test. This can lead to unintended interactions between tests and hence unexpected test failures. Ensure that every test correctly cleans up any state that it introduces. (Mocha::StubbingError)
    from /home/runner/work/kamal/kamal/vendor/bundle/ruby/3.2.0/gems/sshkit-1.24.0/lib/sshkit/backends/connection_pool.rb:135:in `loop'
    from /home/runner/work/kamal/kamal/vendor/bundle/ruby/3.2.0/gems/sshkit-1.24.0/lib/sshkit/backends/connection_pool.rb:135:in `run_eviction_loop'
    from /home/runner/work/kamal/kamal/vendor/bundle/ruby/3.2.0/gems/sshkit-1.24.0/lib/sshkit/backends/connection_pool.rb:51:in `block in initialize'

The tests still pass, but lets disable the eviction thread to avoid the error.

Sometimes we get errors like this in tests:

```
/home/runner/work/kamal/kamal/vendor/bundle/ruby/3.2.0/gems/sshkit-1.24.0/lib/sshkit/backends/connection_pool.rb:139:in `block in run_eviction_loop': #<AnyInstance:Object> was instantiated in CliProxyTest#test_upgrade but it is receiving invocations within
another test. This can lead to unintended interactions between tests and hence unexpected test failures. Ensure that every test correctly cleans up any state that it introduces. (Mocha::StubbingError)
    from /home/runner/work/kamal/kamal/vendor/bundle/ruby/3.2.0/gems/sshkit-1.24.0/lib/sshkit/backends/connection_pool.rb:135:in `loop'
    from /home/runner/work/kamal/kamal/vendor/bundle/ruby/3.2.0/gems/sshkit-1.24.0/lib/sshkit/backends/connection_pool.rb:135:in `run_eviction_loop'
    from /home/runner/work/kamal/kamal/vendor/bundle/ruby/3.2.0/gems/sshkit-1.24.0/lib/sshkit/backends/connection_pool.rb:51:in `block in initialize'
```

The tests still pass, but lets disable the eviction thread to avoid
the error.
@djmb djmb merged commit 6394511 into main Nov 26, 2025
9 of 10 checks passed
@djmb djmb deleted the fix-mocha-background-thread-errors branch November 26, 2025 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant