check_port: cover the Globalping verdict with tests - #3249
Merged
Conversation
The Globalping provider added in Novik#3245 read an open port out of rawOutput. Before it was corrected, the rule matched the tcp_conn=N attempt counter anywhere in the output, and Globalping prints that counter on its "No reply" lines too, so every port came back open -- including ports that never answered at all. Because Globalping runs last in the failover chain, that verdict reached the user exactly when no other provider could answer. Nothing held the corrected rule in place: the verdict was inline in check_port_globalping(), next to the HTTP call, so no test could reach it without the network. Move it to check_port_parse_globalping() in parse.php, beside check_port_parse_yougetsignal(), and cover it with the two rawOutput shapes the API actually returns -- a reply on 8.8.8.8:53 and no reply on 8.8.8.8:81 -- plus a refusal, an empty body, and output in an unfamiliar shape. Silence stays "unknown" rather than "closed": a probe that heard nothing cannot tell a filtered port from a closed one. Also check the shipped configuration against the provider registry. action.php skips any provider that is unknown or that does not claim the address family being checked, so a name that does not line up costs no error -- the provider is simply never tried, and the chain is quietly shorter than the comment in conf.php reads. Each case was confirmed to fail with the check it guards removed.
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.
The Globalping provider added in #3245 read an open port out of rawOutput. Before it was corrected, the rule matched the tcp_conn=N attempt counter anywhere in the output, and Globalping prints that counter on its "No reply" lines too, so every port came back open -- including ports that never answered at all. Because Globalping runs last in the failover chain, that verdict reached the user exactly when no other provider could answer.
Nothing held the corrected rule in place: the verdict was inline in check_port_globalping(), next to the HTTP call, so no test could reach it without the network.
Move it to check_port_parse_globalping() in parse.php, beside check_port_parse_yougetsignal(), and cover it with the two rawOutput shapes the API actually returns -- a reply on 8.8.8.8:53 and no reply on 8.8.8.8:81 -- plus a refusal, an empty body, and output in an unfamiliar shape. Silence stays "unknown" rather than "closed": a probe that heard nothing cannot tell a filtered port from a closed one.
Also check the shipped configuration against the provider registry. action.php skips any provider that is unknown or that does not claim the address family being checked, so a name that does not line up costs no error -- the provider is simply never tried, and the chain is quietly shorter than the comment in conf.php reads.
Each case was confirmed to fail with the check it guards removed.