From 4e7eb550791afdb5d3e496a84be00286ccb6fb5b Mon Sep 17 00:00:00 2001 From: Danijel Tasov Date: Wed, 4 Oct 2023 11:34:25 +0200 Subject: add some basic tests for the new modes Signed-off-by: Danijel Tasov --- plugins-root/t/check_icmp.t | 48 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'plugins-root') diff --git a/plugins-root/t/check_icmp.t b/plugins-root/t/check_icmp.t index 9fb8fa06..4f9db868 100644 --- a/plugins-root/t/check_icmp.t +++ b/plugins-root/t/check_icmp.t @@ -12,7 +12,7 @@ my $allow_sudo = getTestParameter( "NP_ALLOW_SUDO", "no" ); if ($allow_sudo eq "yes" or $> == 0) { - plan tests => 20; + plan tests => 39; } else { plan skip_all => "Need sudo to test check_icmp"; } @@ -94,3 +94,49 @@ $res = NPTest->testCmd( ); is( $res->return_code, 0, "Try max packet size" ); like( $res->output, $successOutput, "Output OK - Didn't overflow" ); + +$res = NPTest->testCmd( + "$sudo ./check_icmp -H $host_responsive -R 100,100 -n 1 -t 2" + ); +is( $res->return_code, 0, "rta works" ); +like( $res->output, $successOutput, "Output OK" ); +$res = NPTest->testCmd( + "$sudo ./check_icmp -H $host_responsive -P 80,90 -n 1 -t 2" + ); +is( $res->return_code, 0, "pl works" ); +like( $res->output, '/lost 0%/', "Output OK" ); + +$res = NPTest->testCmd( + "$sudo ./check_icmp -H $host_responsive -J 80,90 -t 2" + ); +is( $res->return_code, 0, "jitter works" ); +like( $res->output, '/jitter \d/', "Output OK" ); + +$res = NPTest->testCmd( + "$sudo ./check_icmp -H $host_responsive -M 4,3 -t 2" + ); +is( $res->return_code, 0, "mos works" ); +like( $res->output, '/MOS \d/', "Output OK" ); + +$res = NPTest->testCmd( + "$sudo ./check_icmp -H $host_responsive -S 80,70 -t 2" + ); +is( $res->return_code, 0, "score works" ); +like( $res->output, '/Score \d/', "Output OK" ); + +$res = NPTest->testCmd( + "$sudo ./check_icmp -H $host_responsive -O -t 2" + ); +is( $res->return_code, 0, "order works" ); +like( $res->output, '/Packets in order/', "Output OK" ); + +$res = NPTest->testCmd( + "$sudo ./check_icmp -H $host_responsive -O -S 80,70 -M 4,3 -J 80,90 -P 80,90 -R 100,100 -t 2" + ); +is( $res->return_code, 0, "order works" ); +like( $res->output, '/Packets in order/', "Output OK" ); +like( $res->output, '/Score \d/', "Output OK" ); +like( $res->output, '/MOS \d/', "Output OK" ); +like( $res->output, '/jitter \d/', "Output OK" ); +like( $res->output, '/lost 0%/', "Output OK" ); +like( $res->output, $successOutput, "Output OK" ); -- cgit v1.2.3-74-g34f1