Hello community, here is the log from the commit of package openQA for openSUSE:Factory checked in at 2017-11-29 10:54:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/openQA (Old) and /work/SRC/openSUSE:Factory/.openQA.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "openQA" Wed Nov 29 10:54:09 2017 rev:5 rq:546170 version:4.5.1511814842.53907890 Changes: -------- --- /work/SRC/openSUSE:Factory/openQA/openQA.changes 2017-11-27 22:18:20.398789645 +0100 +++ /work/SRC/openSUSE:Factory/.openQA.new/openQA.changes 2017-11-29 10:54:11.617311728 +0100 @@ -1,0 +2,9 @@ +Tue Nov 28 06:03:39 UTC 2017 - [email protected] + +- Update to version 4.5.1511814842.53907890: + * Make barrier option to automatically destroy the barrier if jobs belonging to it fails (#1498) + * Improve web editor (#1510) + * Remove outdated imports of JSON module (#1509) + * Use Cpanel::JSON::XS in step/edit.html (#1508) + +------------------------------------------------------------------- Old: ---- openQA-4.5.1511709996.0670f622.tar.xz New: ---- openQA-4.5.1511814842.53907890.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ openQA.spec ++++++ --- /var/tmp/diff_new_pack.2YBRyk/_old 2017-11-29 10:54:12.381284011 +0100 +++ /var/tmp/diff_new_pack.2YBRyk/_new 2017-11-29 10:54:12.381284011 +0100 @@ -36,7 +36,7 @@ # runtime requirements that also the testsuite needs %define t_requires perl(DBD::SQLite) perl(DBIx::Class) perl(Config::IniFiles) perl(SQL::Translator) perl(Date::Format) perl(File::Copy::Recursive) perl(DateTime::Format::SQLite) perl(Net::OpenID::Consumer) perl(Mojolicious::Plugin::RenderFile) perl(Mojolicious::Plugin::AssetPack) perl(aliased) perl(Config::Tiny) perl(DBIx::Class::DynamicDefault) perl(DBIx::Class::Schema::Config) perl(DBIx::Class::Storage::Statistics) perl(IO::Socket::SSL) perl(Data::Dump) perl(DBIx::Class::OptimisticLocking) perl(Text::Markdown) perl(Net::DBus) perl(IPC::Run) perl(Archive::Extract) perl(CSS::Minifier::XS) perl(JavaScript::Minifier::XS) perl(Time::ParseDate) perl(Sort::Versions) perl(Mojo::RabbitMQ::Client) perl(BSD::Resource) perl(Cpanel::JSON::XS) Name: openQA -Version: 4.5.1511709996.0670f622 +Version: 4.5.1511814842.53907890 Release: 0 Summary: The openQA web-frontend, scheduler and tools License: GPL-2.0+ ++++++ openQA-4.5.1511709996.0670f622.tar.xz -> openQA-4.5.1511814842.53907890.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openQA-4.5.1511709996.0670f622/lib/OpenQA/Resource/Locks.pm new/openQA-4.5.1511814842.53907890/lib/OpenQA/Resource/Locks.pm --- old/openQA-4.5.1511709996.0670f622/lib/OpenQA/Resource/Locks.pm 2017-11-26 16:26:36.000000000 +0100 +++ new/openQA-4.5.1511814842.53907890/lib/OpenQA/Resource/Locks.pm 2017-11-27 21:34:02.000000000 +0100 @@ -24,6 +24,8 @@ use OpenQA::ResourceAllocator; use OpenQA::Utils qw(wakeup_scheduler log_debug); +my %final_states = map { $_ => 1 } OpenQA::Schema::Result::Jobs::NOT_OK_RESULTS(); + # In normal situation the lock is created by the parent (server) # and released when a service becomes available and the child (client) # can lock and use it. That's why the lock are checked for self and parent @@ -125,15 +127,25 @@ } sub barrier_wait { - my ($name, $jobid, $where) = @_; + my ($name, $jobid, $where, $check_dead_job) = @_; return -1 unless $name && $jobid; my $barrier = _get_lock($name, $jobid, $where); return -1 unless $barrier; + my $jobschema = OpenQA::ResourceAllocator->instance->schema()->resultset("Jobs"); my @jobs = split(/,/, $barrier->locked_by // ''); + + do { $barrier->delete; return -1 } + if $check_dead_job + && grep { $final_states{$_} } + + map { $jobschema->find($_)->result } + ($jobid, @jobs, map { scalar $_->id } ($barrier->owner->parents->all, $barrier->owner->children->all)); + if (grep { $_ eq $jobid } @jobs) { return 1 if (scalar @jobs eq $barrier->count); return 0; } + push @jobs, $jobid; $barrier->update({locked_by => join(',', @jobs)}); return 1 if (scalar @jobs eq $barrier->count); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openQA-4.5.1511709996.0670f622/lib/OpenQA/ResourceAllocator.pm new/openQA-4.5.1511814842.53907890/lib/OpenQA/ResourceAllocator.pm --- old/openQA-4.5.1511709996.0670f622/lib/OpenQA/ResourceAllocator.pm 2017-11-26 16:26:36.000000000 +0100 +++ new/openQA-4.5.1511814842.53907890/lib/OpenQA/ResourceAllocator.pm 2017-11-27 21:34:02.000000000 +0100 @@ -159,11 +159,11 @@ !!@$res[0]; } -dbus_method('barrier_wait', ['string', 'uint32', 'string'], ['int32']); +dbus_method('barrier_wait', ['string', 'uint32', 'string', 'uint32'], ['int32']); sub barrier_wait { my ($self, @args) = @_; my $res = safe_call 'OpenQA::Resource::Locks' => barrier_wait => @args; - !!@$res[0]; + @$res[0] if defined @$res[0]; } dbus_method('barrier_destroy', ['string', 'uint32', 'string'], ['bool']); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openQA-4.5.1511709996.0670f622/lib/OpenQA/Schema/Result/Jobs.pm new/openQA-4.5.1511814842.53907890/lib/OpenQA/Schema/Result/Jobs.pm --- old/openQA-4.5.1511709996.0670f622/lib/OpenQA/Schema/Result/Jobs.pm 2017-11-26 16:26:36.000000000 +0100 +++ new/openQA-4.5.1511814842.53907890/lib/OpenQA/Schema/Result/Jobs.pm 2017-11-27 21:34:02.000000000 +0100 @@ -76,6 +76,7 @@ use constant OK_RESULTS => (PASSED, SOFTFAILED); use constant INCOMPLETE_RESULTS => (INCOMPLETE, SKIPPED, OBSOLETED, PARALLEL_FAILED, PARALLEL_RESTARTED, USER_CANCELLED, USER_RESTARTED); +use constant NOT_OK_RESULTS => (INCOMPLETE_RESULTS, FAILED); # scenario keys w/o MACHINE. Add MACHINE when desired, commonly joined on # other keys with the '@' character diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openQA-4.5.1511709996.0670f622/lib/OpenQA/WebAPI/Controller/API/V1/Locks.pm new/openQA-4.5.1511814842.53907890/lib/OpenQA/WebAPI/Controller/API/V1/Locks.pm --- old/openQA-4.5.1511709996.0670f622/lib/OpenQA/WebAPI/Controller/API/V1/Locks.pm 2017-11-26 16:26:36.000000000 +0100 +++ new/openQA-4.5.1511814842.53907890/lib/OpenQA/WebAPI/Controller/API/V1/Locks.pm 2017-11-27 21:34:02.000000000 +0100 @@ -68,11 +68,14 @@ my $validation = $self->validation; $validation->optional('where')->like(qr/^[0-9]+$/); + $validation->optional('check_dead_job')->like(qr/^[0-9]+$/); + return $self->render(text => 'Bad request', status => 400) if ($validation->has_error); - my $where = $validation->param('where') // ''; + my $where = $validation->param('where') // ''; + my $check_dead_job = $validation->param('check_dead_job') // 0; my $ipc = OpenQA::IPC->ipc; - my $res = $ipc->resourceallocator('barrier_wait', $name, $jobid, $where); + my $res = $ipc->resourceallocator('barrier_wait', $name, $jobid, $where, $check_dead_job); return $self->render(text => 'ack', status => 200) if $res > 0; return $self->render(text => 'nack', status => 410) if $res < 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openQA-4.5.1511709996.0670f622/script/clean_needles new/openQA-4.5.1511814842.53907890/script/clean_needles --- old/openQA-4.5.1511709996.0670f622/script/clean_needles 2017-11-26 16:26:36.000000000 +0100 +++ new/openQA-4.5.1511814842.53907890/script/clean_needles 2017-11-27 21:34:02.000000000 +0100 @@ -69,7 +69,7 @@ use Getopt::Long; use OpenQA::Utils; use OpenQA::Scheduler::Scheduler; -use JSON "decode_json"; +use Cpanel::JSON::XS 'decode_json'; Getopt::Long::Configure("no_ignore_case"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openQA-4.5.1511709996.0670f622/t/13-joblocks.t new/openQA-4.5.1511814842.53907890/t/13-joblocks.t --- old/openQA-4.5.1511709996.0670f622/t/13-joblocks.t 2017-11-26 16:26:36.000000000 +0100 +++ new/openQA-4.5.1511814842.53907890/t/13-joblocks.t 2017-11-27 21:34:02.000000000 +0100 @@ -235,4 +235,91 @@ $t->ua->unsubscribe('start'); $t->delete_ok($b_prefix . '/barrier1')->status_is(403); + + +sub test_barrier_destroy { + + my ($state, $test) = @_; + # create barrier succeeds with 3 expected tasks + my $jA = job_create_with_worker('testA'); + my $jB = job_create_with_worker('testB', $jA); + my $jC = job_create_with_worker('testC', $jA); + + $test = eval "\$$test"; + set_token_header($t->ua, 'token' . $jA); + $t->post_ok($b_prefix, form => {name => 'barrier2', tasks => 3},)->status_is(200); + # barrier is not unlocked after one task + $t->post_ok($b_prefix . '/barrier2', form => {action => 'wait'})->status_is(409); + # barrier is not unlocked after two tasks + set_token_header($t->ua, 'token' . $jB); + $t->post_ok($b_prefix . '/barrier2', form => {action => 'wait', check_dead_job => 1})->status_is(409); + + my $job = $schema->resultset('Jobs')->find($test)->update({result => $state}); + + # barrier will be destroyed + set_token_header($t->ua, 'token' . $jA); + $t->post_ok($b_prefix . '/barrier2', form => {action => 'wait', check_dead_job => 1})->status_is(410); + # barrier is not there for all jobs + set_token_header($t->ua, 'token' . $jC); + $t->post_ok($b_prefix . '/barrier2', form => {action => 'wait'})->status_is(410); + set_token_header($t->ua, 'token' . $jA); + $t->post_ok($b_prefix . '/barrier2', form => {action => 'wait'})->status_is(410); + set_token_header($t->ua, 'token' . $jB); + $t->post_ok($b_prefix . '/barrier2', form => {action => 'wait'})->status_is(410); + return 1; +} + +test_barrier_destroy($_, "jA") + && test_barrier_destroy($_, "jB") + && test_barrier_destroy($_, "jC") + for OpenQA::Schema::Result::Jobs::NOT_OK_RESULTS(); + + +# create barrier succeeds with 3 expected tasks +$jA = job_create_with_worker('testA'); +$jB = job_create_with_worker('testB', $jA); +$jC = job_create_with_worker('testC', $jA); +diag "$jA $jB $jC"; +set_token_header($t->ua, 'token' . $jA); +$t->post_ok($b_prefix, form => {name => 'barrier2', tasks => 3},)->status_is(200); +# barrier is not unlocked after one task +$t->post_ok($b_prefix . '/barrier2', form => {action => 'wait', check_dead_job => 1})->status_is(409); +# barrier is not unlocked after two tasks +set_token_header($t->ua, 'token' . $jB); +$t->post_ok($b_prefix . '/barrier2', form => {action => 'wait', check_dead_job => 1})->status_is(409); + +my $job = $schema->resultset('Jobs')->find($jB)->update({result => 'INVALIDRESULT'}); + +set_token_header($t->ua, 'token' . $jB); +$t->post_ok($b_prefix . '/barrier2', form => {action => 'wait', check_dead_job => 1})->status_is(409); + +set_token_header($t->ua, 'token' . $jA); +$t->post_ok($b_prefix . '/barrier2', form => {action => 'wait', check_dead_job => 1})->status_is(409); +# barrier is not there for all jobs +set_token_header($t->ua, 'token' . $jC); +$t->post_ok($b_prefix . '/barrier2', form => {action => 'wait', check_dead_job => 1})->status_is(200); + + +# create barrier succeeds with 3 expected tasks +$jA = job_create_with_worker('testA'); +$jB = job_create_with_worker('testB', $jA); +$jC = job_create_with_worker('testC', $jA); + +set_token_header($t->ua, 'token' . $jA); +$t->post_ok($b_prefix, form => {name => 'barrier2', tasks => 3},)->status_is(200); +# barrier is not unlocked after one task +$t->post_ok($b_prefix . '/barrier2', form => {action => 'wait', check_dead_job => 1})->status_is(409); +# barrier is not unlocked after two tasks +set_token_header($t->ua, 'token' . $jB); +$t->post_ok($b_prefix . '/barrier2', form => {action => 'wait', check_dead_job => 1})->status_is(409); + +$schema->resultset('Jobs')->find($jB)->update({result => 'done'}); + +set_token_header($t->ua, 'token' . $jA); +$t->post_ok($b_prefix . '/barrier2', form => {action => 'wait', check_dead_job => 1})->status_is(409); +# barrier is not there for all jobs +set_token_header($t->ua, 'token' . $jC); +$t->post_ok($b_prefix . '/barrier2', form => {action => 'wait', check_dead_job => 1})->status_is(200); + + done_testing(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openQA-4.5.1511709996.0670f622/t/22-dashboard.t new/openQA-4.5.1511814842.53907890/t/22-dashboard.t --- old/openQA-4.5.1511709996.0670f622/t/22-dashboard.t 2017-11-26 16:26:36.000000000 +0100 +++ new/openQA-4.5.1511814842.53907890/t/22-dashboard.t 2017-11-27 21:34:02.000000000 +0100 @@ -27,7 +27,6 @@ use Test::Mojo; use Test::Warnings; use OpenQA::Test::Case; -use JSON qw(decode_json); # init test case my $test_case = OpenQA::Test::Case->new; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openQA-4.5.1511709996.0670f622/t/ui/12-needle-edit.t new/openQA-4.5.1511814842.53907890/t/ui/12-needle-edit.t --- old/openQA-4.5.1511709996.0670f622/t/ui/12-needle-edit.t 2017-11-26 16:26:36.000000000 +0100 +++ new/openQA-4.5.1511814842.53907890/t/ui/12-needle-edit.t 2017-11-27 21:34:02.000000000 +0100 @@ -28,11 +28,10 @@ use Test::Mojo; use Test::Warnings ':all'; use OpenQA::Test::Case; -use Cwd qw(abs_path); - +use Cwd 'abs_path'; +use Cpanel::JSON::XS 'decode_json'; use File::Path qw(make_path remove_tree); -use POSIX qw(strftime); -use JSON; +use POSIX 'strftime'; use OpenQA::WebSockets; use OpenQA::Scheduler; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openQA-4.5.1511709996.0670f622/templates/step/edit.html.ep new/openQA-4.5.1511814842.53907890/templates/step/edit.html.ep --- old/openQA-4.5.1511709996.0670f622/templates/step/edit.html.ep 2017-11-26 16:26:36.000000000 +0100 +++ new/openQA-4.5.1511814842.53907890/templates/step/edit.html.ep 2017-11-27 21:34:02.000000000 +0100 @@ -8,7 +8,7 @@ % content_for 'ready_function' => begin window.needles = {}; % for my $needle (@$needles) { - window.needles['<%= $needle->{name} %>'] = <%= b(JSON->new->pretty->encode($needle)) %>; + window.needles['<%= $needle->{name} %>'] = <%= b(Cpanel::JSON::XS->new->pretty->encode($needle)) %>; % } setup_needle_editor( <%= b(Cpanel::JSON::XS::encode_json($default_needle)) %> ); setupResultButtons(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openQA-4.5.1511709996.0670f622/templates/step/src.html.ep new/openQA-4.5.1511814842.53907890/templates/step/src.html.ep --- old/openQA-4.5.1511709996.0670f622/templates/step/src.html.ep 2017-11-26 16:26:36.000000000 +0100 +++ new/openQA-4.5.1511814842.53907890/templates/step/src.html.ep 2017-11-27 21:34:02.000000000 +0100 @@ -20,7 +20,9 @@ <script type="text/javascript"> var editor = CodeMirror.fromTextArea(document.getElementById("script"), { - lineNumbers: true + lineNumbers: true, + readOnly: true, + lineWrapping: true }); </script> </div>
