Migrate from Bacon to Minitest and modernize project#1
Draft
henrikbjorn wants to merge 17 commits intomasterfrom
Draft
Migrate from Bacon to Minitest and modernize project#1henrikbjorn wants to merge 17 commits intomasterfrom
henrikbjorn wants to merge 17 commits intomasterfrom
Conversation
Replace the unmaintained Bacon test framework with Minitest::Test. Rename spec/ to test/ following Ruby conventions (*_test.rb suffix). Use prepend-based test mocking instead of class reopening to avoid method redefinition warnings. Drop RR and Bacon gem dependencies. Also: rewrite README with table of contents, add GitHub Actions CI workflow (Ruby 3.1–3.4), migrate from EventMachine to async I/O, and fix Ruby 4.0 frozen string warnings in Response.
- Replace ListenerTestMock send_data/initialize overrides with a MockConnection object passed to .new, so the real send_data writes to the mock connection instead of being monkey-patched - Split test files to one test class per file - Move connection logic into Inbound.start/Outbound.start class methods - Standardize on parentheses in all method definitions - Update examples to match current API
Remove Base.self.new/allocate/post_init pattern inherited from EventMachine. Each class now uses a standard initialize that accepts connection as the first argument.
async-io is deprecated. Replace with io-endpoint and io-stream which provide the same API. Remove the Librevox::Connection wrapper class since IO::Stream supports write(flush: true), read_partial, and close directly. Add logger as a gemspec dependency since it was removed from Ruby's stdlib.
Async already handles SIGINT/SIGTERM by cleanly stopping child tasks and raising Interrupt. Calling task.stop from a trap context crashes because async uses mutexes internally.
Docker Compose and other process managers send SIGTERM (not SIGINT) when stopping containers. Catch SignalException alongside Interrupt for graceful shutdown in all environments.
Add park helper to Applications. Update README dialplan section to show both calling styles: sequential (without blocks) and nested (with blocks for completion callbacks).
Without event-lock, FreeSWITCH returns the command reply immediately rather than waiting for the application to finish executing. This caused callbacks for bridge, playback, record etc. to fire prematurely.
require 'io/endpoint' does not load the tcp method; needs require 'io/endpoint/host_endpoint' instead.
Replace stored @task module state with a local Async::Barrier, giving proper group lifecycle (wait/stop) for multi-listener setups. Introduce Runner class to keep the block form of Librevox.start working without shared state. Move endpoint creation outside the inbound reconnect loop.
Separate wire-protocol parsing from listener business logic by introducing Protocol::Connection (wraps IO::Stream with read_message/ write/close), Server (accepts outbound connections), and Client (connects inbound with reconnect). Listeners become pure session logic with thin self.start methods that delegate to Server/Client. Also unifies CommandSocket to use Protocol::Connection, extracts Runner to its own file, and switches Librevox.start to kwargs.
endpoint.accept passes (socket, address) — we were only accepting one argument, causing ArgumentError in production.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
spec/totest/, use*_test.rbsuffix andtest_helper.rbnaming.prependmodule (ListenerTestMock) instead of reopeningBaseclass and redefining methods. Configurableon_event_blockreplaces singleton method redefinitions.baconandrrgems, addminitest.attr_readerinstead ofattr_accessorinResponse(custom setters exist), eliminating method redefinition warnings.filtersAPI (wasfilter), removed stale links (IRC, mailing list, rdoc.info).CommandSocketspec.