From b3e3257d82a1e93d412cf7a48d9ec639967da6d3 Mon Sep 17 00:00:00 2001 From: Marius Kittler Date: Thu, 16 Mar 2023 11:13:02 +0100 Subject: [PATCH] Combine `openqa-cli api` options `-r` and `-m` * As requested in the review * Related ticket: https://progress.opensuse.org/issues/125720 --- lib/OpenQA/CLI/schedule.pm | 12 ++++++------ t/43-cli-schedule.t | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/OpenQA/CLI/schedule.pm b/lib/OpenQA/CLI/schedule.pm index 36b5ae3335a7..3b0c28315977 100644 --- a/lib/OpenQA/CLI/schedule.pm +++ b/lib/OpenQA/CLI/schedule.pm @@ -55,17 +55,17 @@ sub command ($self, @args) { 'param-file=s' => \my @param_file, 'm|monitor' => \my $monitor, 'i|poll-interval=i' => \my $poll_interval, - 'r|set-return-code' => \my $set_return_code; + ; @args = $self->decode_args(@args); my $client = $self->client($self->post_url); my @job_ids; my $create_res = $self->_create_jobs($client, \@args, \@param_file, \@job_ids); - return $create_res if $create_res != 0 || !($monitor || $set_return_code); + return $create_res if $create_res != 0 || !$monitor; my @job_results; my $monitor_res = $self->_monitor_jobs($client, $poll_interval // 10, \@job_ids, \@job_results); - return $monitor_res if $monitor_res != 0 || !$set_return_code; + return $monitor_res if $monitor_res != 0; return $self->_compute_return_code(\@job_results); } @@ -89,9 +89,9 @@ sub command ($self, @args) { from command line arguments. Multiple params may be specified by adding the option multiple times - -m, --monitor Wait until all jobs are done/cancelled + -m, --monitor Wait until all jobs are done/cancelled and return + non-zero exit code if at least on job has not + passed/softfailed -i, --poll-interval Specifies the poll interval used with --monitor - -r, --set-return-code Return non-zero exit code if at least one job - is not passed/softfailed (implies -m) =cut diff --git a/t/43-cli-schedule.t b/t/43-cli-schedule.t index 2cafeb8c7b8f..9bf96fa0ed81 100644 --- a/t/43-cli-schedule.t +++ b/t/43-cli-schedule.t @@ -50,7 +50,7 @@ subtest 'unknown options' => sub { }; # define different sets of CLI args to be used in further tests -my @options = ('--apikey', 'ARTHURKEY01', '--apisecret', 'EXCALIBUR', '--host', $host, '-r', '-i', 0); +my @options = ('--apikey', 'ARTHURKEY01', '--apisecret', 'EXCALIBUR', '--host', $host, '-m', '-i', 0); my @scenarios = ('--param-file', "SCENARIO_DEFINITIONS_YAML=$FindBin::Bin/data/09-schedule_from_file.yaml"); my @settings1 = (qw(DISTRI=example VERSION=0 FLAVOR=DVD ARCH=x86_64 TEST=simple_boot)); my @settings2 = (qw(DISTRI=opensuse VERSION=13.1 FLAVOR=DVD ARCH=i586 BUILD=0091 TEST=autoyast_btrfs));