Skip to content

Commit

Permalink
Merge pull request os-autoinst#3718 from okurz/fix/coverage
Browse files Browse the repository at this point in the history
Mark uncoverage statements in OpenQA::Worker::WebUIConnection
  • Loading branch information
mergify[bot] committed Feb 14, 2021
2 parents 86968e7 + 4c2e8c8 commit 525d96f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/OpenQA/Worker/WebUIConnection.pm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# with this program; if not, see <http://www.gnu.org/licenses/>.

package OpenQA::Worker::WebUIConnection;
use Mojo::Base 'Mojo::EventEmitter';
use Mojo::Base 'Mojo::EventEmitter', -signatures;

use OpenQA::Log qw(log_error log_debug log_warning log_info);
use OpenQA::Utils qw(feature_scaling rand_range logistic_map_steps);
Expand Down Expand Up @@ -194,23 +194,22 @@ sub _setup_websocket_connection {
$command_handler->handle_command(@_);
});
$tx->on(
finish => sub {
finish => sub ($tx, $code, $reason = 'no reason') {
# uncoverable subroutine
# https://progress.opensuse.org/issues/55364
my (undef, $code, $reason) = @_;

# Subprocesses reset the event loop (which triggers this event),
# and since only the main worker process uses the WebSocket we
# can safely ignore this (and do not want to reconnect)
# uncoverable statement
return unless $websocket_pid == $$;

# ignore if the connection was disabled from our side
# uncoverable statement
return log_debug("Websocket connection to $websocket_url finished from our side.")
unless $self->websocket_connection;

$reason //= 'no reason';
$self->websocket_connection(undef);
$self->_set_status(
$self->websocket_connection(undef)->_set_status( # uncoverable statement
failed => {
error_message =>
"Websocket connection to $websocket_url finished by remote side with code $code, $reason"
Expand Down

0 comments on commit 525d96f

Please sign in to comment.