Skip to content

Commit

Permalink
Combine openqa-cli api options -r and -m
Browse files Browse the repository at this point in the history
* As requested in the review
* Related ticket: https://progress.opensuse.org/issues/125720
  • Loading branch information
Martchus committed Mar 16, 2023
1 parent 8b9c98f commit b3e3257
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions lib/OpenQA/CLI/schedule.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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
2 changes: 1 addition & 1 deletion t/43-cli-schedule.t
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit b3e3257

Please sign in to comment.