Use skip_all if test precondition is not met

Subtests can't have zero checks.
This commit is contained in:
Richard Hansen 2024-07-10 20:12:18 -04:00
parent 01d2db06c1
commit 6af76afde9

View file

@ -41,7 +41,7 @@ subtest "get_ip_from_interface tests" => sub {
subtest "Get default interface and IP for test system (IPv4)" => sub { subtest "Get default interface and IP for test system (IPv4)" => sub {
my $interface = ddclient::get_default_interface(4); my $interface = ddclient::get_default_interface(4);
return if !$interface; plan(skip_all => 'no IPv4 interface') if !$interface;
isnt($interface, "lo", "Check for loopback 'lo'"); isnt($interface, "lo", "Check for loopback 'lo'");
isnt($interface, "lo0", "Check for loopback 'lo0'"); isnt($interface, "lo0", "Check for loopback 'lo0'");
my $ip1 = ddclient::get_ip_from_interface("default", 4); my $ip1 = ddclient::get_ip_from_interface("default", 4);
@ -52,7 +52,7 @@ subtest "Get default interface and IP for test system (IPv4)" => sub {
subtest "Get default interface and IP for test system (IPv6)" => sub { subtest "Get default interface and IP for test system (IPv6)" => sub {
my $interface = ddclient::get_default_interface(6); my $interface = ddclient::get_default_interface(6);
return if !$interface; plan(skip_all => 'no IPv6 interface') if !$interface;
isnt($interface, "lo", "Check for loopback 'lo'"); isnt($interface, "lo", "Check for loopback 'lo'");
isnt($interface, "lo0", "Check for loopback 'lo0'"); isnt($interface, "lo0", "Check for loopback 'lo0'");
my $ip1 = ddclient::get_ip_from_interface("default", 6); my $ip1 = ddclient::get_ip_from_interface("default", 6);