File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -611,8 +611,12 @@ sub is_qemu_running ($self) {
611
611
sub is_ovs_dbus_service_running ($self ) {
612
612
try { defined &Net::DBus::system or require Net::DBus }
613
613
catch ($e ) { return 0 }
614
- my $bus = ($self -> {_system_dbus } //= Net::DBus-> system (nomainloop => 1));
615
- try { return defined $bus -> get_service(' org.opensuse.os_autoinst.switch' ) }
614
+ unless (defined $self -> {_system_dbus }) {
615
+ $self -> {_system_dbus } = Net::DBus-> system (nomainloop => 1);
616
+ # this avoids piling up signals we never do anything with - POO #183833
617
+ $self -> {_system_dbus }-> get_bus_object-> disconnect_from_signal(' NameOwnerChanged' , 1);
618
+ }
619
+ try { return defined $self -> {_system_dbus }-> get_service(' org.opensuse.os_autoinst.switch' ) }
616
620
catch ($e ) { return 0 }
617
621
}
618
622
Original file line number Diff line number Diff line change @@ -80,11 +80,17 @@ my $guard = scope_guard sub { chdir $FindBin::Bin };
80
80
use Mojo::Base -base;
81
81
has availability_error => ' Cache service info error: Connection refused' ;
82
82
}
83
+ {
84
+ package Test::FakeDBusObject ;
85
+ use Mojo::Base -base, -signatures;
86
+ sub disconnect_from_signal ($self , $signal , $id ) { }
87
+ }
83
88
{
84
89
package Test::FakeDBus ; # uncoverable statement count:2
85
90
use Mojo::Base -base, -signatures;
86
91
has mock_service_value => 1;
87
92
sub get_service ($self , $service_name ) { $self -> mock_service_value }
93
+ sub get_bus_object ($self ) { Test::FakeDBusObject-> new }
88
94
}
89
95
90
96
my $dbus_mock = Test::MockModule-> new(' Net::DBus' , no_auto => 1);
You can’t perform that action at this time.
0 commit comments