Repository navigation
test(plugins): move the plugins' test harnesses onto FakeHost - #597
Open
botandbang wants to merge 5 commits into
Open
botandbang wants to merge 5 commits into
botandbang wants to merge 5 commits into
Conversation
Each first-party plugin's tests ran their own host over pipes: a Peer, threads, a hello, and a Canceller to cancel a hook mid-call. They now use loclib-plugin's FakeHost. FakeHost gains on_call, whose Response can answer, answer and then cancel the hook, or hold a call unanswered until the hook is cancelled; Sent::wait_timeout; and send keeps a context.scratch the params already give (null for a host without blobs). Canceller, which only those harnesses used, is removed. The tests keep their names, assertions and Hegel properties; each publishing plugin's harness checks on every case that the plugin called for nothing but net/fetch.
…oc-443-plugin-tests-fakehost
…sts-fakehost # Conflicts: # plugins/coverart/src/tests.rs # plugins/musicbrainz/src/tests.rs # plugins/youtube/src/tests/publishing.rs
bnb
previously approved these changes
Nov 12, 2026
…sts-fakehost # Conflicts: # plugins/sound/Cargo.toml # plugins/sound/src/tests.rs
bnb
approved these changes
Nov 13, 2026
plugins/mixcloud/src/tests/publishing.rs keeps main's new test of Mixcloud's rules for the music, which needs TracklistEntry, and this branch's imports, which drop what FakeHost now does (Cancel, Manifest, method).
This branch has not been deployed
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.
What and why
Fixes LOC-443.
Every first-party plugin's tests ran its own host over pipes, eleven copies of the same handshake, threads and cancel plumbing. They now use FakeHost, which the interop plugin already moved to. A plugin author outside the repo gets the same harness the first-party plugins use.
Added to FakeHost (behind
test-util, no protocol change):on_call(method, respond), whererespondreturns aResponse:Answer,AnswerThenCancel(answer the call, then cancel the hook, as a host does when the user stops it mid-call) orHold(never answer, until the hook is cancelled).on_readnow goes through it.Sent::wait_timeout(limit), for tests that check a hook stops.sendkeeps acontext.scratchthe params already give, includingnullfor a host without blobs, instead of always making a folder.Removed:
test_util::Canceller, which only these harnesses used.Changed, in the plugins' tests (demos, tracklist, sound, coverart, musicbrainz, archive, plyr, soundcloud, mixcloud, youtube, interop's Traktor reader):
on_call.net/fetch, as their per-call asserts did.describechecks are gone:FakeHost::startalready checksdescribeanswers the manifest.The README's "Testing a plugin" section and
apps/locallibrary/CONTRIBUTING.mddescribe the new calls.How it was tested
cargo nextest runon loclib-plugin and the 11 plugin crates: 476 passed.an_answer_then_cancel_reaches_the_plugin_first,a_held_call_waits_until_the_hook_is_cancelled,a_scratch_folder_given_is_kept, and the Hegel propertyprop_an_answer_reaches_the_plugin_unless_held. Each fails when its part is broken: cancelling before answering, answering a held call,wait_timeoutnever returning, or ignoring a given scratch folder.cargo clippy --all-targets -- -D warningson the same crates,--all-featureson loclib-plugin,cargo fmt --check, and the doctests.Checklist
docs/and--helpstill say what the code does (no changelog line: tests only)