mirror of
https://github.com/drwetter/testssl.sh.git
synced 2025-09-02 01:58:28 +02:00
Naming checks, exempt two checks for MacOS
This commit is contained in:
@ -13,9 +13,12 @@ my $check2run ="--ip=one --ids-friendly -q --color 0";
|
||||
my $uri="";
|
||||
my $json="";
|
||||
my $out="";
|
||||
my $cmd_timeout="--openssl-timeout=10";
|
||||
# Blacklists we use to trigger an error:
|
||||
my $socket_regex_bl='(e|E)rror|\.\/testssl\.sh: line |(f|F)atal|(c|C)ommand not found';
|
||||
my $openssl_regex_bl='(e|E)rror|(f|F)atal|\.\/testssl\.sh: line |Oops|s_client connect problem|(c|C)ommand not found';
|
||||
# that can be done better but I am a perl n00b ;-)
|
||||
my $os=`perl -e 'print "$^O";'`;
|
||||
|
||||
die "Unable to open $prg" unless -f $prg;
|
||||
|
||||
@ -33,6 +36,7 @@ my @errors=eval { decode_json($json) };
|
||||
is(@errors,0,"no errors");
|
||||
$tests++;
|
||||
|
||||
|
||||
#2
|
||||
printf "%s\n", ".. pretty JSON --> $uri ";
|
||||
$out = `./testssl.sh $check2run --jsonfile-pretty tmp.json $uri`;
|
||||
@ -44,7 +48,21 @@ $tests++;
|
||||
|
||||
|
||||
#3
|
||||
# This testssl.sh run deliberately does NOT work as travis-ci.org blocks port 25 egress.
|
||||
my $uri = "smtp-relay.gmail.com:587";
|
||||
printf "%s\n", " .. plain JSON and STARTTLS --> $uri ...";
|
||||
$out = `./testssl.sh --jsonfile tmp.json $check2run -t smtp $uri`;
|
||||
$json = json('tmp.json');
|
||||
unlink 'tmp.json';
|
||||
@errors=eval { decode_json($json) };
|
||||
is(@errors,0,"no errors");
|
||||
$tests++;
|
||||
|
||||
if ( $os eq "linux" ){
|
||||
# macos doesn't have a timout command, unless we install coreutils (gnu coreutils)
|
||||
# so we just silently skip this
|
||||
|
||||
#4
|
||||
# This testssl.sh run deliberately does NOT work as github actions block port 25 egress.
|
||||
# but the output should be fine. The idea is to have a unit test for a failed connection.
|
||||
printf "%s\n", ".. plain JSON for a failed run: '--mx $uri' ...";
|
||||
$out = `./testssl.sh --ssl-native --openssl-timeout=10 $check2run --jsonfile tmp.json --mx $uri`;
|
||||
@ -54,7 +72,7 @@ unlink 'tmp.json';
|
||||
is(@errors,0,"no errors");
|
||||
$tests++;
|
||||
|
||||
#4
|
||||
#5
|
||||
# Same as above but with pretty JSON
|
||||
printf "%s\n", ".. pretty JSON for a failed run '--mx $uri' ...";
|
||||
$out = `./testssl.sh --ssl-native --openssl-timeout=10 $check2run --jsonfile-pretty tmp.json --mx $uri`;
|
||||
@ -64,15 +82,9 @@ unlink 'tmp.json';
|
||||
is(@errors,0,"no errors");
|
||||
$tests++;
|
||||
|
||||
#5
|
||||
my $uri = "smtp-relay.gmail.com:587";
|
||||
printf "%s\n", " .. plain JSON and STARTTLS --> $uri ...";
|
||||
$out = `./testssl.sh --jsonfile tmp.json $check2run -t smtp $uri`;
|
||||
$json = json('tmp.json');
|
||||
unlink 'tmp.json';
|
||||
@errors=eval { decode_json($json) };
|
||||
is(@errors,0,"no errors");
|
||||
$tests++;
|
||||
} elif ( $os eq "darwin" ){
|
||||
printf "skipped two checks on MacOS\n\n";
|
||||
}
|
||||
|
||||
printf "\n";
|
||||
done_testing($tests);
|
||||
|
Reference in New Issue
Block a user