Repository navigation
fix(channels): test the telegram webhook defaults without assuming a free port - #779
Merged
Merged
Conversation
… a free port The default address and path for the Telegram webhook were covered only by a test that expected the default port to be taken. That assumption held on the machine it was written on and failed in CI, so the test now supplies its own address — which left the default branch unexercised. Address and path selection move into `webhook_addr` / `webhook_path`, and a test asserts both branches directly: a config without a webhook block keeps the defaults, an explicit block wins, and a partial block keeps whichever half it does not name. No test depends on the default port being free or taken. Verified: `cargo test -p future-channel --lib providers::telegram` (69 passed), `cargo fmt --check` and `clippy --all-targets -- -D warnings` on the pinned toolchain, and `bash scripts/chan-cov.sh --check channels/src/providers/telegram.rs` reporting 0 uncovered lines.
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
channels/src/providers/telegram.rshad one uncovered line onmain(line 939, the default webhook address). The cause is a regression from my own CI fix in #778:127.0.0.1:8787was unavailable because a local service held it on the machine it was written on — on a clean machine the bind succeeds and the run loop never returns, which is how it failed CI;The change
Address and path selection move out of the run loop into
webhook_addr/webhook_path, so both branches are asserted directly rather than through a bind attempt:webhook_addrwebhook_pathwebhookblock127.0.0.1:8787/telegramsecret_tokenNo test depends on a port being free or taken, so it behaves the same on a laptop and on a CI runner.
Verification
This is the first item of the residual-coverage list in #778 (comment); the rest (slack 11, mattermost 5, imessage 2, qq 1, plus the documented exemptions) is unchanged.