Skip to content

Commit

Permalink
[ci] improve debugging output in 0030_create_and_build_package.ts
Browse files Browse the repository at this point in the history
With this commit the output of 0030_create_and_build_package.ts in case of
an timeout should be improved, so you can see that a timeout occured and the
last building state of the project at a glance.

The variable OBS_TEST_TIMEOUT is required to reduce the timeout while
testing the script itself.

Esp. the mails/web output of kanku should be more meanful with this patch.
  • Loading branch information
M0ses committed Jun 12, 2018
1 parent 8691f99 commit 2c155d2
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions dist/t/osc/0030_create_and_build_package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ system('osc ci -m "initial version"');
ok(!$?,"Checking initial commit of package obs-testpackage");

# wait for building results
my $time_out = 60 * 60; # wait for at least an hour
my $time_out = $::ENV{OBS_TEST_TIMEOUT} || 60 * 60; # wait for at least an hour by default
my $start_time = time();
my $retry_timeout = 5; # retry after X seconds
my $succeed;
Expand Down Expand Up @@ -81,17 +81,35 @@ while (1) {
}
}

my $last_result = join q{}, @result;

# test reached timeout (e.g. stuck while signing)
last if (($start_time + $time_out) < time());
if (($start_time + $time_out) < time()) {
print STDERR <<"EOF"
TEST TIMEOUT REACHED ($time_out sec)!
Last result:
$last_result

EOF
;
last;
}

if (! $recalculation) {
# if all have succeeded and no recalculation is needed the test succeed
$succeed = 1 if (($states->{succeeded} + $states->{failed}) == @result);

# if any of the results is failed/broken the whole test is failed
my $bad_results = $states->{broken} + $states->{unresolvable};
if ($bad_results > 0) {
$succeed = 0;
print STDERR "@result";
print STDERR <<"EOF"
AN ERROR OCCOURED WHILE BUILDING:
Last result:
$last_result

EOF
;
}
}

Expand Down

0 comments on commit 2c155d2

Please sign in to comment.