Bug 37302: Set test to failed if swagger-cli missing

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Martin Renvoize 2024-07-10 11:12:56 +01:00
parent 82535a4887
commit be3924a70f
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -91,14 +91,13 @@ subtest 'The spec passes the swagger-cli validation' => sub {
plan tests => 1;
SKIP: {
skip "Skipping tests, swagger-cli missing", 1
unless can_run('swagger-cli');
if ( can_run('swagger-cli') ) {
my $spec_dir = "$FindBin::Bin/../api/v1/swagger";
my $var = qx{swagger-cli validate $spec_dir/swagger.yaml 2>&1};
is( $?, 0, 'Validation exit code is 0' )
or diag $var;
} else {
ok( 0, "Test skipped, swagger-cli missing" );
}
};