diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-11-09 12:21:34 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-09 12:21:34 +0100 |
| commit | 2510d9ad5851c669ace7cfc16ea3ff9bf2c86106 (patch) | |
| tree | 71658ad4c291b2eec4779f2367ab0b65744b60d3 /plugins/t/check_smtp.t | |
| parent | 2eb22a87d2cb5467c5b031c720726c2531202055 (diff) | |
| parent | bc2720abddf8e379c4e1f23ed25f7702ef29ad08 (diff) | |
| download | monitoring-plugins-2510d9ad5851c669ace7cfc16ea3ff9bf2c86106.tar.gz | |
Merge pull request #2176 from RincewindsHat/modern_output/check_smtpHEADmastercoverity/master
check_smtp: modern output + some tls cert helper functions
Diffstat (limited to 'plugins/t/check_smtp.t')
| -rw-r--r-- | plugins/t/check_smtp.t | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/plugins/t/check_smtp.t b/plugins/t/check_smtp.t index 73b4a1fd..c2f53c3d 100644 --- a/plugins/t/check_smtp.t +++ b/plugins/t/check_smtp.t | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | # | 5 | # |
| 6 | 6 | ||
| 7 | use strict; | 7 | use strict; |
| 8 | use warnings; | ||
| 8 | use Test::More; | 9 | use Test::More; |
| 9 | use NPTest; | 10 | use NPTest; |
| 10 | 11 | ||
| @@ -24,7 +25,7 @@ my $hostname_invalid = getTestParameter( "NP_HOSTNAME_INVALID", | |||
| 24 | "An invalid (not known to DNS) hostname", "nosuchhost" ); | 25 | "An invalid (not known to DNS) hostname", "nosuchhost" ); |
| 25 | my $res; | 26 | my $res; |
| 26 | 27 | ||
| 27 | plan tests => 15; | 28 | plan tests => 13; |
| 28 | 29 | ||
| 29 | SKIP: { | 30 | SKIP: { |
| 30 | skip "No SMTP server defined", 4 unless $host_tcp_smtp; | 31 | skip "No SMTP server defined", 4 unless $host_tcp_smtp; |
| @@ -42,12 +43,11 @@ SKIP: { | |||
| 42 | 43 | ||
| 43 | TODO: { | 44 | TODO: { |
| 44 | local $TODO = "Output is over two lines"; | 45 | local $TODO = "Output is over two lines"; |
| 45 | like ( $res->output, qr/^SMTP WARNING/, "Correct error message" ); | ||
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | $res = NPTest->testCmd( "./check_smtp -H $host_tcp_smtp --ssl -p 25" ); | 48 | $res = NPTest->testCmd( "./check_smtp -H $host_tcp_smtp --ssl -p 25" ); |
| 49 | is ($res->return_code, 2, "Check rc of connecting to $host_tcp_smtp with TLS on standard SMTP port" ); | 49 | is ($res->return_code, 2, "Check rc of connecting to $host_tcp_smtp with TLS on standard SMTP port" ); |
| 50 | like ($res->output, qr/^CRITICAL - Cannot make SSL connection\./, "Check output of connecting to $host_tcp_smtp with TLS on standard SMTP port"); | 50 | like ($res->output, qr/cannot create TLS context/, "Check output of connecting to $host_tcp_smtp with TLS on standard SMTP port"); |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | SKIP: { | 53 | SKIP: { |
| @@ -68,7 +68,6 @@ SKIP: { | |||
| 68 | skip "No SMTP server with TLS defined", 1 unless $host_tcp_smtp_tls; | 68 | skip "No SMTP server with TLS defined", 1 unless $host_tcp_smtp_tls; |
| 69 | $res = NPTest->testCmd( "./check_smtp -H $host_tcp_smtp_tls --ssl" ); | 69 | $res = NPTest->testCmd( "./check_smtp -H $host_tcp_smtp_tls --ssl" ); |
| 70 | is ($res->return_code, 0, "Check rc of connecting to $host_tcp_smtp_tls with TLS" ); | 70 | is ($res->return_code, 0, "Check rc of connecting to $host_tcp_smtp_tls with TLS" ); |
| 71 | like ($res->output, qr/^SMTP OK - /, "Check output of connecting to $host_tcp_smtp_tls with TLS" ); | ||
| 72 | 71 | ||
| 73 | my $unused_port = 4465; | 72 | my $unused_port = 4465; |
| 74 | $res = NPTest->testCmd( "./check_smtp -H $host_tcp_smtp_tls -p $unused_port --ssl" ); | 73 | $res = NPTest->testCmd( "./check_smtp -H $host_tcp_smtp_tls -p $unused_port --ssl" ); |
