Hello community,
here is the log from the commit of package perl-TheSchwartz for
openSUSE:Factory checked in at 2020-01-30 09:41:41
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-TheSchwartz (Old)
and /work/SRC/openSUSE:Factory/.perl-TheSchwartz.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-TheSchwartz"
Thu Jan 30 09:41:41 2020 rev:4 rq:768345 version:1.15
Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-TheSchwartz/perl-TheSchwartz.changes
2019-10-21 12:29:54.692063458 +0200
+++
/work/SRC/openSUSE:Factory/.perl-TheSchwartz.new.26092/perl-TheSchwartz.changes
2020-01-30 09:42:22.841521568 +0100
@@ -1,0 +2,10 @@
+Wed Jan 29 03:21:08 UTC 2020 - <[email protected]>
+
+- updated to 1.15
+ see /usr/share/doc/packages/perl-TheSchwartz/Changes
+
+ 1.15 2020-01-28T06:19:54Z
+
+ - Fix tests on win32 GH#4 (@charsbar++)
+
+-------------------------------------------------------------------
Old:
----
TheSchwartz-1.14.tar.gz
New:
----
TheSchwartz-1.15.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-TheSchwartz.spec ++++++
--- /var/tmp/diff_new_pack.8uxdni/_old 2020-01-30 09:42:24.257522326 +0100
+++ /var/tmp/diff_new_pack.8uxdni/_new 2020-01-30 09:42:24.261522329 +0100
@@ -1,7 +1,7 @@
#
# spec file for package perl-TheSchwartz
#
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
Name: perl-TheSchwartz
-Version: 1.14
+Version: 1.15
Release: 0
%define cpan_name TheSchwartz
Summary: Reliable job queue
@@ -63,7 +63,7 @@
%prep
%setup -q -n %{cpan_name}-%{version}
-find . -type f ! -name \*.pl -print0 | xargs -0 chmod 644
+find . -type f ! -path "*/t/*" ! -name "*.pl" ! -path "*/bin/*" ! -path
"*/script/*" ! -name "configure" -print0 | xargs -0 chmod 644
%build
perl Build.PL --installdirs=vendor
++++++ TheSchwartz-1.14.tar.gz -> TheSchwartz-1.15.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/TheSchwartz-1.14/Changes new/TheSchwartz-1.15/Changes
--- old/TheSchwartz-1.14/Changes 2019-10-17 19:52:06.000000000 +0200
+++ new/TheSchwartz-1.15/Changes 2020-01-28 07:20:56.000000000 +0100
@@ -1,3 +1,7 @@
+1.15 2020-01-28T06:19:54Z
+
+ - Fix tests on win32 GH#4 (@charsbar++)
+
1.14 2019-10-17T17:51:40Z
- Added missing prereq Class::Accessor::Fast as suggested by CPANTS. GH#1
(@manwar++)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/TheSchwartz-1.14/META.json
new/TheSchwartz-1.15/META.json
--- old/TheSchwartz-1.14/META.json 2019-10-17 19:52:06.000000000 +0200
+++ new/TheSchwartz-1.15/META.json 2020-01-28 07:20:56.000000000 +0100
@@ -4,7 +4,7 @@
", Six Apart Ltd, [email protected]. All"
],
"dynamic_config" : 0,
- "generated_by" : "Minilla/v3.1.5",
+ "generated_by" : "Minilla/v3.1.8",
"license" : [
"perl_5"
],
@@ -58,7 +58,7 @@
"provides" : {
"TheSchwartz" : {
"file" : "lib/TheSchwartz.pm",
- "version" : "1.14"
+ "version" : "1.15"
},
"TheSchwartz::Error" : {
"file" : "lib/TheSchwartz/Error.pm"
@@ -90,13 +90,14 @@
"web" : "https://github.com/akiym/TheSchwartz"
}
},
- "version" : "1.14",
+ "version" : "1.15",
"x_authority" : "cpan:AKIYM",
"x_contributors" : [
"Akira Sawada <[email protected]>",
"Brad Fitzpatrick <[email protected]>",
"Jeff Fearn <[email protected]>",
"Jeff Fearn <[email protected]>",
+ "Kenichi Ishigaki <[email protected]>",
"Mohammad S Anwar <[email protected]>",
"Six Apart Ltd. <[email protected]>",
"Takumi Akiyama <[email protected]>"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/TheSchwartz-1.14/META.yml
new/TheSchwartz-1.15/META.yml
--- old/TheSchwartz-1.14/META.yml 2019-10-17 19:52:06.000000000 +0200
+++ new/TheSchwartz-1.15/META.yml 2020-01-28 07:20:56.000000000 +0100
@@ -7,7 +7,7 @@
configure_requires:
Module::Build::Tiny: '0.035'
dynamic_config: 0
-generated_by: 'Minilla/v3.1.5, CPAN::Meta::Converter version 2.150010'
+generated_by: 'Minilla/v3.1.8, CPAN::Meta::Converter version 2.150010'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -26,7 +26,7 @@
provides:
TheSchwartz:
file: lib/TheSchwartz.pm
- version: '1.14'
+ version: '1.15'
TheSchwartz::Error:
file: lib/TheSchwartz/Error.pm
TheSchwartz::ExitStatus:
@@ -49,13 +49,14 @@
bugtracker: https://github.com/akiym/TheSchwartz/issues
homepage: https://github.com/akiym/TheSchwartz
repository: git://github.com/akiym/TheSchwartz.git
-version: '1.14'
+version: '1.15'
x_authority: cpan:AKIYM
x_contributors:
- 'Akira Sawada <[email protected]>'
- 'Brad Fitzpatrick <[email protected]>'
- 'Jeff Fearn <[email protected]>'
- 'Jeff Fearn <[email protected]>'
+ - 'Kenichi Ishigaki <[email protected]>'
- 'Mohammad S Anwar <[email protected]>'
- 'Six Apart Ltd. <[email protected]>'
- 'Takumi Akiyama <[email protected]>'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/TheSchwartz-1.14/lib/TheSchwartz.pm
new/TheSchwartz-1.15/lib/TheSchwartz.pm
--- old/TheSchwartz-1.14/lib/TheSchwartz.pm 2019-10-17 19:52:06.000000000
+0200
+++ new/TheSchwartz-1.15/lib/TheSchwartz.pm 2020-01-28 07:20:56.000000000
+0100
@@ -6,7 +6,7 @@
use fields
qw( databases retry_seconds dead_dsns retry_at funcmap_cache verbose
all_abilities current_abilities current_job cached_drivers
driver_cache_expiration scoreboard prioritize floor batch_size
strict_remove_ability);
-our $VERSION = "1.14";
+our $VERSION = "1.15";
use Carp qw( croak );
use Data::ObjectDriver::Errors;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/TheSchwartz-1.14/t/cleanup.t
new/TheSchwartz-1.15/t/cleanup.t
--- old/TheSchwartz-1.14/t/cleanup.t 2019-10-17 19:52:06.000000000 +0200
+++ new/TheSchwartz-1.15/t/cleanup.t 2020-01-28 07:20:56.000000000 +0100
@@ -17,53 +17,61 @@
10,
sub {
my $client = test_client( dbs => ['ts1'] );
- my $dbh = DBI->connect( dsn_for("ts1"), $ENV{TS_DB_USER},
- $ENV{TS_DB_PASS} );
- $client->can_do("Worker::Fail");
- $client->can_do("Worker::Complete");
- # insert a job which will fail, then succeed.
{
- my $handle = $client->insert("Worker::Fail");
- isa_ok $handle, 'TheSchwartz::JobHandle', "inserted job";
-
- $client->work_until_done;
- is( $handle->failures, 1, "job has failed once" );
-
- my $min;
- my $rows
- = $dbh->selectrow_array("SELECT COUNT(*) FROM exitstatus");
- is( $rows, 1, "has 1 exitstatus row" );
-
- ok( $client->insert("Worker::Complete"),
- "inserting to-pass job" );
- $client->work_until_done;
- $rows = $dbh->selectrow_array("SELECT COUNT(*) FROM exitstatus");
- is( $rows, 2, "has 2 exitstatus rows" );
- ( $rows, $min )
- = $dbh->selectrow_array(
- "SELECT COUNT(*), MIN(jobid) FROM error");
- is( $rows, 1, "has 1 error rows" );
- is( $min, 1, "error jobid is the old one" );
-
- # wait for exit status to pass
- sleep 3;
-
- # now make another job fail to cleanup some errors
- $handle = $client->insert("Worker::Fail");
- $client->work_until_done;
-
- $rows = $dbh->selectrow_array("SELECT COUNT(*) FROM exitstatus");
- is( $rows, 1, "1 exit status row now" );
-
- ( $rows, $min )
- = $dbh->selectrow_array(
- "SELECT COUNT(*), MIN(jobid) FROM error");
- is( $rows, 1, "has 1 error row still" );
- is( $min, 3, "error jobid is only the new one" );
+ my $dbh = DBI->connect( dsn_for("ts1"), $ENV{TS_DB_USER},
+ $ENV{TS_DB_PASS} );
+ $client->can_do("Worker::Fail");
+ $client->can_do("Worker::Complete");
+
+ # insert a job which will fail, then succeed.
+ {
+ my $handle = $client->insert("Worker::Fail");
+ isa_ok $handle, 'TheSchwartz::JobHandle', "inserted job";
+
+ $client->work_until_done;
+ is( $handle->failures, 1, "job has failed once" );
+
+ my $min;
+ my $rows
+ = $dbh->selectrow_array(
+ "SELECT COUNT(*) FROM exitstatus");
+ is( $rows, 1, "has 1 exitstatus row" );
+
+ ok( $client->insert("Worker::Complete"),
+ "inserting to-pass job" );
+ $client->work_until_done;
+ $rows = $dbh->selectrow_array(
+ "SELECT COUNT(*) FROM exitstatus");
+ is( $rows, 2, "has 2 exitstatus rows" );
+ ( $rows, $min )
+ = $dbh->selectrow_array(
+ "SELECT COUNT(*), MIN(jobid) FROM error");
+ is( $rows, 1, "has 1 error rows" );
+ is( $min, 1, "error jobid is the old one" );
+
+ # wait for exit status to pass
+ sleep 3;
+
+ # now make another job fail to cleanup some errors
+ $handle = $client->insert("Worker::Fail");
+ $client->work_until_done;
+
+ $rows = $dbh->selectrow_array(
+ "SELECT COUNT(*) FROM exitstatus");
+ is( $rows, 1, "1 exit status row now" );
+
+ ( $rows, $min )
+ = $dbh->selectrow_array(
+ "SELECT COUNT(*), MIN(jobid) FROM error");
+ is( $rows, 1, "has 1 error row still" );
+ is( $min, 3, "error jobid is only the new one" );
+ }
}
+ $client->set_current_job(undef);
+
teardown_dbs('ts1');
}
);
@@ -79,7 +87,7 @@
}
sub keep_exit_status_for {
- 1
+ 1;
} # keep exit status for 20 seconds after on_complete
sub max_retries {0}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/TheSchwartz-1.14/t/coalesce.t
new/TheSchwartz-1.15/t/coalesce.t
--- old/TheSchwartz-1.14/t/coalesce.t 2019-10-17 19:52:06.000000000 +0200
+++ new/TheSchwartz-1.15/t/coalesce.t 2020-01-28 07:20:56.000000000 +0100
@@ -13,30 +13,34 @@
sub {
my $client = test_client( dbs => ['ts1'] );
- my @keys = qw(foo bar baz);
- my $n = 0;
- for ( 1 .. 10 ) {
- my $key = $keys[ $n++ % 3 ];
- my $job = TheSchwartz::Job->new(
- funcname => 'Worker::CoalesceTest',
- arg => { key => $key, num => $_ },
- coalesce => $key
- );
- my $h = $client->insert($job);
- ok( $h, "inserted $h ($_ = $key)" );
- }
-
- $client->reset_abilities;
- $client->can_do("Worker::CoalesceTest");
-
- Worker::CoalesceTest->set_client($client);
-
- for ( 1 .. 3 ) {
+ {
+ my @keys = qw(foo bar baz);
+ my $n = 0;
+ for ( 1 .. 10 ) {
+ my $key = $keys[ $n++ % 3 ];
+ my $job = TheSchwartz::Job->new(
+ funcname => 'Worker::CoalesceTest',
+ arg => { key => $key, num => $_ },
+ coalesce => $key
+ );
+ my $h = $client->insert($job);
+ ok( $h, "inserted $h ($_ = $key)" );
+ }
+
+ $client->reset_abilities;
+ $client->can_do("Worker::CoalesceTest");
+
+ Worker::CoalesceTest->set_client($client);
+
+ for ( 1 .. 3 ) {
+ my $rv = eval { $client->work_once; };
+ ok( $rv, "did stuff" );
+ }
my $rv = eval { $client->work_once; };
- ok( $rv, "did stuff" );
+ ok( !$rv, "nothing to do now" );
}
- my $rv = eval { $client->work_once; };
- ok( !$rv, "nothing to do now" );
+
+ $client->set_current_job(undef);
teardown_dbs('ts1');
}
@@ -79,7 +83,7 @@
}
sub keep_exit_status_for {
- 20
+ 20;
} # keep exit status for 20 seconds after on_complete
sub grab_for {10}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/TheSchwartz-1.14/t/declined.t
new/TheSchwartz-1.15/t/declined.t
--- old/TheSchwartz-1.14/t/declined.t 2019-10-17 19:52:06.000000000 +0200
+++ new/TheSchwartz-1.15/t/declined.t 2020-01-28 07:20:56.000000000 +0100
@@ -4,7 +4,7 @@
require './t/lib/db-common.pl';
use TheSchwartz;
-use Test::More tests => (5 + 21) * 3;
+use Test::More tests => ( 5 + 21 ) * 3;
our $decline = 1;
@@ -33,6 +33,8 @@
"didn't get a job, because job is 'held' not retrying" );
}
+ $client->set_current_job(undef);
+
teardown_dbs('ts1');
}
);
@@ -76,6 +78,8 @@
}
}
+ $client->set_current_job(undef);
+
teardown_dbs('ts2');
}
);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/TheSchwartz-1.14/t/evenly-distribute.t
new/TheSchwartz-1.15/t/evenly-distribute.t
--- old/TheSchwartz-1.14/t/evenly-distribute.t 2019-10-17 19:52:06.000000000
+0200
+++ new/TheSchwartz-1.15/t/evenly-distribute.t 2020-01-28 07:20:56.000000000
+0100
@@ -14,46 +14,50 @@
sub {
my $client = test_client( dbs => [ 'ts1', 'ts2' ] );
- my $n_jobs = 60;
- for ( 1 .. $n_jobs ) {
- my $handle = $client->insert("Worker::Foo");
- die unless $handle;
- }
+ {
+ my $n_jobs = 60;
+ for ( 1 .. $n_jobs ) {
+ my $handle = $client->insert("Worker::Foo");
+ die unless $handle;
+ }
+
+ my $db1 = DBI->connect( dsn_for("ts1"), $ENV{TS_DB_USER},
+ $ENV{TS_DB_PASS} );
+ my $db2 = DBI->connect( dsn_for("ts2"), $ENV{TS_DB_USER},
+ $ENV{TS_DB_PASS} );
+ die unless $db1 && $db2;
+
+ my $jobs1 = $db1->selectrow_array("SELECT COUNT(*) FROM job");
+ my $jobs2 = $db2->selectrow_array("SELECT COUNT(*) FROM job");
+ is( $jobs1 + $jobs2, $n_jobs, "inserted all $n_jobs" );
+
+ ok( $jobs1 > $n_jobs / 4,
+ "at least a quarter of jobs went to db1 ($jobs1 / $n_jobs)" );
+ ok( $jobs2 > $n_jobs / 4,
+ "at least a quarter of jobs went to db1 ($jobs2 / $n_jobs)" );
+
+ my $do_jobs = int( $n_jobs / 2 );
+ $client->can_do("Worker::Foo");
+ for ( 1 .. $do_jobs ) {
+ $client->work_once
+ or die;
+ }
+
+ my $jobs1b = $db1->selectrow_array("SELECT COUNT(*) FROM job");
+ my $jobs2b = $db2->selectrow_array("SELECT COUNT(*) FROM job");
+
+ my $remain_jobs = $n_jobs - $do_jobs;
+ is( $jobs1b + $jobs2b, $remain_jobs, "expected jobs remain" );
+
+ # deltas: how much work gone done each
+ my $jobs1d = $jobs1 - $jobs1b;
+ my $jobs2d = $jobs2 - $jobs2b;
- my $db1 = DBI->connect( dsn_for("ts1"), $ENV{TS_DB_USER},
- $ENV{TS_DB_PASS} );
- my $db2 = DBI->connect( dsn_for("ts2"), $ENV{TS_DB_USER},
- $ENV{TS_DB_PASS} );
- die unless $db1 && $db2;
-
- my $jobs1 = $db1->selectrow_array("SELECT COUNT(*) FROM job");
- my $jobs2 = $db2->selectrow_array("SELECT COUNT(*) FROM job");
- is( $jobs1 + $jobs2, $n_jobs, "inserted all $n_jobs" );
-
- ok( $jobs1 > $n_jobs / 4,
- "at least a quarter of jobs went to db1 ($jobs1 / $n_jobs)" );
- ok( $jobs2 > $n_jobs / 4,
- "at least a quarter of jobs went to db1 ($jobs2 / $n_jobs)" );
-
- my $do_jobs = int( $n_jobs / 2 );
- $client->can_do("Worker::Foo");
- for ( 1 .. $do_jobs ) {
- $client->work_once
- or die;
+ # difference in work done:
+ my $workdiff = abs( $jobs1d - $jobs2d );
}
- my $jobs1b = $db1->selectrow_array("SELECT COUNT(*) FROM job");
- my $jobs2b = $db2->selectrow_array("SELECT COUNT(*) FROM job");
-
- my $remain_jobs = $n_jobs - $do_jobs;
- is( $jobs1b + $jobs2b, $remain_jobs, "expected jobs remain" );
-
- # deltas: how much work gone done each
- my $jobs1d = $jobs1 - $jobs1b;
- my $jobs2d = $jobs2 - $jobs2b;
-
- # difference in work done:
- my $workdiff = abs( $jobs1d - $jobs2d );
+ $client->set_current_job(undef);
teardown_dbs( 'ts1', 'ts2' );
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/TheSchwartz-1.14/t/fail-working-multiple.t
new/TheSchwartz-1.15/t/fail-working-multiple.t
--- old/TheSchwartz-1.14/t/fail-working-multiple.t 2019-10-17
19:52:06.000000000 +0200
+++ new/TheSchwartz-1.15/t/fail-working-multiple.t 2020-01-28
07:20:56.000000000 +0100
@@ -13,30 +13,34 @@
sub {
my $client = test_client( dbs => ['ts1'] );
- my $job2h;
- for ( 1 .. 2 ) {
- my $job = TheSchwartz::Job->new(
- funcname => 'Worker::CoalesceTest',
- arg => { n => $_ },
- coalesce => "a$_",
- );
- my $h = $client->insert($job);
- $job2h = $h if $_ == 2;
- ok( $h, "inserted $h" );
- }
-
- $client->reset_abilities;
- $client->can_do("Worker::CoalesceTest");
+ {
+ my $job2h;
+ for ( 1 .. 2 ) {
+ my $job = TheSchwartz::Job->new(
+ funcname => 'Worker::CoalesceTest',
+ arg => { n => $_ },
+ coalesce => "a$_",
+ );
+ my $h = $client->insert($job);
+ $job2h = $h if $_ == 2;
+ ok( $h, "inserted $h" );
+ }
+
+ $client->reset_abilities;
+ $client->can_do("Worker::CoalesceTest");
+
+ my $job = $client->find_job_with_coalescing_prefix(
+ "Worker::CoalesceTest", "a1" );
+ Worker::CoalesceTest->work_safely($job);
- my $job = $client->find_job_with_coalescing_prefix(
- "Worker::CoalesceTest", "a1" );
- Worker::CoalesceTest->work_safely($job);
+ # this one should have succeeded:
+ is( $job->handle->failures, 0, "no failures on first job" );
- # this one should have succeeded:
- is( $job->handle->failures, 0, "no failures on first job" );
+ # the second one should have failures:
+ is( $job2h->failures, 1, "1 failure on second job" );
+ }
- # the second one should have failures:
- is( $job2h->failures, 1, "1 failure on second job" );
+ $client->set_current_job(undef);
teardown_dbs('ts1');
}
@@ -58,7 +62,7 @@
}
sub keep_exit_status_for {
- 20
+ 20;
} # keep exit status for 20 seconds after on_complete
sub grab_for {10}
sub max_retries {1}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/TheSchwartz-1.14/t/grab_and_work_on.t
new/TheSchwartz-1.15/t/grab_and_work_on.t
--- old/TheSchwartz-1.14/t/grab_and_work_on.t 2019-10-17 19:52:06.000000000
+0200
+++ new/TheSchwartz-1.15/t/grab_and_work_on.t 2020-01-28 07:20:56.000000000
+0100
@@ -13,34 +13,38 @@
sub {
my $client = test_client( dbs => ['ts1'] );
- my $available
- = TheSchwartz::Job->new( funcname => 'Worker::Grabber', );
- my $grabbed_until = time + 2;
- my $grabbed = TheSchwartz::Job->new(
- funcname => 'Worker::Grabber',
- grabbed_until => $grabbed_until,
- );
- my $available_handle = $client->insert($available);
- my $grabbed_handle = $client->insert($grabbed);
-
- $client->reset_abilities;
- $client->can_do("Worker::Grabber");
-
- Worker::Grabber->set_client($client);
-
- my $rv = $client->grab_and_work_on( $grabbed_handle->as_string );
- ok( !$rv, "we couldn't grab it" );
- is scalar $grabbed->failure_log, 0, "no errors";
- $grabbed->refresh;
- is $grabbed->grabbed_until, $grabbed_until, "Still grabbed";
-
- $rv = $client->grab_and_work_on( $available_handle->as_string );
- is scalar $available->failure_log, 0, "no errors";
- ok( $rv, "we worked on it" );
-
- $rv = $client->grab_and_work_on( $available_handle->as_string );
- is scalar $available->failure_log, 0, "no errors";
- ok( !$rv, "There is nothing to do for it now." );
+ {
+ my $available
+ = TheSchwartz::Job->new( funcname => 'Worker::Grabber', );
+ my $grabbed_until = time + 2;
+ my $grabbed = TheSchwartz::Job->new(
+ funcname => 'Worker::Grabber',
+ grabbed_until => $grabbed_until,
+ );
+ my $available_handle = $client->insert($available);
+ my $grabbed_handle = $client->insert($grabbed);
+
+ $client->reset_abilities;
+ $client->can_do("Worker::Grabber");
+
+ Worker::Grabber->set_client($client);
+
+ my $rv = $client->grab_and_work_on( $grabbed_handle->as_string );
+ ok( !$rv, "we couldn't grab it" );
+ is scalar $grabbed->failure_log, 0, "no errors";
+ $grabbed->refresh;
+ is $grabbed->grabbed_until, $grabbed_until, "Still grabbed";
+
+ $rv = $client->grab_and_work_on( $available_handle->as_string );
+ is scalar $available->failure_log, 0, "no errors";
+ ok( $rv, "we worked on it" );
+
+ $rv = $client->grab_and_work_on( $available_handle->as_string );
+ is scalar $available->failure_log, 0, "no errors";
+ ok( !$rv, "There is nothing to do for it now." );
+ }
+
+ $client->set_current_job(undef);
teardown_dbs('ts1');
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/TheSchwartz-1.14/t/insert-and-do.t
new/TheSchwartz-1.15/t/insert-and-do.t
--- old/TheSchwartz-1.14/t/insert-and-do.t 2019-10-17 19:52:06.000000000
+0200
+++ new/TheSchwartz-1.15/t/insert-and-do.t 2020-01-28 07:20:56.000000000
+0100
@@ -115,6 +115,8 @@
);
}
+ $client->set_current_job(undef);
+
teardown_dbs('ts1');
}
);
@@ -168,7 +170,7 @@
}
sub keep_exit_status_for {
- 20
+ 20;
} # keep exit status for 20 seconds after on_complete
sub grab_for {10}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/TheSchwartz-1.14/t/priority.t
new/TheSchwartz-1.15/t/priority.t
--- old/TheSchwartz-1.14/t/priority.t 2019-10-17 19:52:06.000000000 +0200
+++ new/TheSchwartz-1.15/t/priority.t 2020-01-28 07:20:56.000000000 +0100
@@ -53,6 +53,8 @@
my $rv = eval { $client->work_once; };
ok( !$rv, "nothing to do now" );
+ $client->set_current_job(undef);
+
teardown_dbs('ts1');
# test we get in jobid order for equal priority RT #99075
@@ -87,6 +89,8 @@
$rv = eval { $client2->work_once; };
ok( !$rv, "nothing to do now 1-5" );
+ $client2->set_current_job(undef);
+
teardown_dbs('ts2');
# test floor RT #50842
@@ -119,6 +123,8 @@
$rv = eval { $client2->work_once; };
ok( !$rv, "sub-floor jobs remaining but you can't have them" );
+ $client2->set_current_job(undef);
+
teardown_dbs('ts3');
$testnum = 0;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/TheSchwartz-1.14/t/replace-abort.t
new/TheSchwartz-1.15/t/replace-abort.t
--- old/TheSchwartz-1.14/t/replace-abort.t 2019-10-17 19:52:06.000000000
+0200
+++ new/TheSchwartz-1.15/t/replace-abort.t 2020-01-28 07:20:56.000000000
+0100
@@ -8,139 +8,165 @@
use TheSchwartz;
use Test::More tests => 13;
-run_tests_pgsql(13, sub {
- my $client1 = test_client(dbs => ['ts1']);
- my $client2 = test_client(dbs => ['ts1']);
-
- my $driver = $client1->driver_for( ($client1->shuffled_databases)[0] );
- my $dbh = $driver->rw_handle;
-
- is(
- query_sql($dbh, "SELECT COUNT(*) FROM job WHERE uniqkey IN
('1','2','3','4','5');"),
- 0,
- 'namespace empty',
- );
-
-
- $client1->can_do('Test::Job::Completed');
- $client2->can_do('Test::Job::Replace');
-
-# job 1
- $client1->insert(TheSchwartz::Job->new(
- funcname => 'Test::Job::Completed',
- uniqkey => 1,
- ));
-
- is(
- query_sql($dbh, "SELECT COUNT(*) FROM job WHERE uniqkey = '1';"),
- 1,
- 'Job 1 gepostet',
- );
-
-
-# Job 1
- $client1->work_once;
-
- is(
- query_sql($dbh, "SELECT COUNT(*) FROM job WHERE uniqkey = '1';"),
- 0,
- 'Job 1 abgearbeitet',
- );
-
-# Job 2
- $client2->insert(TheSchwartz::Job->new(
- funcname => 'Test::Job::Replace',
- uniqkey => 2,
- arg => 3,
- ));
-
- is(
- query_sql($dbh, "SELECT COUNT(*) FROM job WHERE uniqkey = '2';"),
- 1,
- 'Job 2 gepostet',
- );
-
-# Job 2
- $client2->work_once;
-
- is(
- query_sql($dbh, "SELECT COUNT(*) FROM job WHERE uniqkey = '2';"),
- 0,
- 'Job 2 abgearbeitet',
- );
- is(
- query_sql($dbh, "SELECT COUNT(*) FROM job WHERE uniqkey = '3';"),
- 1,
- 'Job 2 ersetzt durch Job 3',
- );
-
-# Job 4
- $client2->insert(TheSchwartz::Job->new(
- funcname => 'Test::Job::Replace',
- uniqkey => 4,
- arg => 3,
- ));
-
- is(
- query_sql($dbh, "SELECT COUNT(*) FROM job WHERE uniqkey = '4';"),
- 1,
- 'Job 4 gepostet',
- );
-
-# Job 4
- $client2->work_once;
-
- is(
- query_sql($dbh, "SELECT COUNT(*) FROM job WHERE uniqkey = '4';"),
- 1,
- 'Job 4 abgebrochen',
- );
- is(
- query_sql($dbh, "SELECT COUNT(*) FROM job WHERE uniqkey = '3';"),
- 1,
- 'Job 4 nicht durch Job 3 ersetzt',
- );
-
-# Job 3
- $client1->work_once;
-
- is(
- query_sql($dbh, "SELECT COUNT(*) FROM job WHERE uniqkey = '3';"),
- 0,
- 'Job 3 abgearbeitet',
- );
-
-# cleanup job.run_after & retry_at, so we dont have to wait
- $dbh->do("UPDATE job SET run_after = 0 WHERE uniqkey = '4';");
- $client2->{retry_at} = {};
-
-# Job 4
- $client2->work_once;
-
-
- is(
- query_sql($dbh, "SELECT COUNT(*) FROM job WHERE uniqkey = '4';"),
- 0,
- 'Job 4 abgearbeitet',
- );
- is(
- query_sql($dbh, "SELECT COUNT(*) FROM job WHERE uniqkey = '3';"),
- 1,
- 'Job 4 ersetzt durch Job 3',
- );
-
-# Job 5
- $client1->work_once;
-
- is(
- query_sql($dbh, "SELECT COUNT(*) FROM job WHERE uniqkey = '3';"),
- 0,
- 'Job 3 erneut abgearbeitet',
- );
-});
-
-
-
+run_tests_pgsql(
+ 13,
+ sub {
+ my $client1 = test_client( dbs => ['ts1'] );
+ my $client2 = test_client( dbs => ['ts1'] );
+
+ {
+ my $driver
+ = $client1->driver_for( ( $client1->shuffled_databases )[0] );
+ my $dbh = $driver->rw_handle;
+
+ is( query_sql(
+ $dbh,
+ "SELECT COUNT(*) FROM job WHERE uniqkey IN
('1','2','3','4','5');"
+ ),
+ 0,
+ 'namespace empty',
+ );
+
+ $client1->can_do('Test::Job::Completed');
+ $client2->can_do('Test::Job::Replace');
+
+ # job 1
+ $client1->insert(
+ TheSchwartz::Job->new(
+ funcname => 'Test::Job::Completed',
+ uniqkey => 1,
+ )
+ );
+
+ is( query_sql(
+ $dbh, "SELECT COUNT(*) FROM job WHERE uniqkey = '1';"
+ ),
+ 1,
+ 'Job 1 gepostet',
+ );
+
+ # Job 1
+ $client1->work_once;
+
+ is( query_sql(
+ $dbh, "SELECT COUNT(*) FROM job WHERE uniqkey = '1';"
+ ),
+ 0,
+ 'Job 1 abgearbeitet',
+ );
+
+ # Job 2
+ $client2->insert(
+ TheSchwartz::Job->new(
+ funcname => 'Test::Job::Replace',
+ uniqkey => 2,
+ arg => 3,
+ )
+ );
+
+ is( query_sql(
+ $dbh, "SELECT COUNT(*) FROM job WHERE uniqkey = '2';"
+ ),
+ 1,
+ 'Job 2 gepostet',
+ );
+
+ # Job 2
+ $client2->work_once;
+
+ is( query_sql(
+ $dbh, "SELECT COUNT(*) FROM job WHERE uniqkey = '2';"
+ ),
+ 0,
+ 'Job 2 abgearbeitet',
+ );
+ is( query_sql(
+ $dbh, "SELECT COUNT(*) FROM job WHERE uniqkey = '3';"
+ ),
+ 1,
+ 'Job 2 ersetzt durch Job 3',
+ );
+
+ # Job 4
+ $client2->insert(
+ TheSchwartz::Job->new(
+ funcname => 'Test::Job::Replace',
+ uniqkey => 4,
+ arg => 3,
+ )
+ );
+
+ is( query_sql(
+ $dbh, "SELECT COUNT(*) FROM job WHERE uniqkey = '4';"
+ ),
+ 1,
+ 'Job 4 gepostet',
+ );
+
+ # Job 4
+ $client2->work_once;
+
+ is( query_sql(
+ $dbh, "SELECT COUNT(*) FROM job WHERE uniqkey = '4';"
+ ),
+ 1,
+ 'Job 4 abgebrochen',
+ );
+ is( query_sql(
+ $dbh, "SELECT COUNT(*) FROM job WHERE uniqkey = '3';"
+ ),
+ 1,
+ 'Job 4 nicht durch Job 3 ersetzt',
+ );
+
+ # Job 3
+ $client1->work_once;
+
+ is( query_sql(
+ $dbh, "SELECT COUNT(*) FROM job WHERE uniqkey = '3';"
+ ),
+ 0,
+ 'Job 3 abgearbeitet',
+ );
+
+ # cleanup job.run_after & retry_at, so we dont have to wait
+ $dbh->do("UPDATE job SET run_after = 0 WHERE uniqkey = '4';");
+ $client2->{retry_at} = {};
+
+ # Job 4
+ $client2->work_once;
+
+ is( query_sql(
+ $dbh, "SELECT COUNT(*) FROM job WHERE uniqkey = '4';"
+ ),
+ 0,
+ 'Job 4 abgearbeitet',
+ );
+ is( query_sql(
+ $dbh, "SELECT COUNT(*) FROM job WHERE uniqkey = '3';"
+ ),
+ 1,
+ 'Job 4 ersetzt durch Job 3',
+ );
+
+ # Job 5
+ $client1->work_once;
+
+ is( query_sql(
+ $dbh, "SELECT COUNT(*) FROM job WHERE uniqkey = '3';"
+ ),
+ 0,
+ 'Job 3 erneut abgearbeitet',
+ );
+
+ }
+
+ $client1->set_current_job(undef);
+ $client2->set_current_job(undef);
+
+ teardown_dbs('ts1');
+ }
+);
# TheSchwartz Worker/Jobs
package Test::Job::Completed;
@@ -148,7 +174,7 @@
use base qw(TheSchwartz::Worker);
sub work {
- my ($client, $job) = @_;
+ my ( $client, $job ) = @_;
$job->completed;
}
sub max_retries { 10; }
@@ -158,11 +184,13 @@
use base qw(TheSchwartz::Worker);
sub work {
- my ($client, $job) = @_;
- $job->replace_with(TheSchwartz::Job->new(
- funcname => 'Test::Job::Completed',
- uniqkey => $job->arg,
- ));
+ my ( $client, $job ) = @_;
+ $job->replace_with(
+ TheSchwartz::Job->new(
+ funcname => 'Test::Job::Completed',
+ uniqkey => $job->arg,
+ )
+ );
}
sub max_retries { 10; }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/TheSchwartz-1.14/t/replace-with.t
new/TheSchwartz-1.15/t/replace-with.t
--- old/TheSchwartz-1.14/t/replace-with.t 2019-10-17 19:52:06.000000000
+0200
+++ new/TheSchwartz-1.15/t/replace-with.t 2020-01-28 07:20:56.000000000
+0100
@@ -13,24 +13,30 @@
sub {
my $client = test_client( dbs => ['ts1'] );
- my $handle = $client->insert( "Worker::Foo", { cluster => 'all' } );
- ok($handle);
+ {
+ my $handle
+ = $client->insert( "Worker::Foo", { cluster => 'all' } );
+ ok($handle);
+
+ my $job = Worker::Foo->grab_job($client);
+ ok( $job, "no addition jobs to be grabbed" );
+
+ Worker::Foo->work_safely($job);
+
+ $client->can_do("Worker::Foo");
+ $client->work_until_done; # should process 5 jobs.
+
+ # finish a job by replacing it with nothing
+ $handle
+ = $client->insert( "Worker::Foo",
+ { cluster => 'gibberish' } );
+ ok( $handle->is_pending, "job is still pending" );
+ $job = $handle->job;
+ $job->replace_with();
+ ok( !$handle->is_pending, "job no longer pending" );
+ }
- my $job = Worker::Foo->grab_job($client);
- ok( $job, "no addition jobs to be grabbed" );
-
- Worker::Foo->work_safely($job);
-
- $client->can_do("Worker::Foo");
- $client->work_until_done; # should process 5 jobs.
-
- # finish a job by replacing it with nothing
- $handle
- = $client->insert( "Worker::Foo", { cluster => 'gibberish' } );
- ok( $handle->is_pending, "job is still pending" );
- $job = $handle->job;
- $job->replace_with();
- ok( !$handle->is_pending, "job no longer pending" );
+ $client->set_current_job(undef);
teardown_dbs('ts1');
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/TheSchwartz-1.14/t/retry-delay.t
new/TheSchwartz-1.15/t/retry-delay.t
--- old/TheSchwartz-1.14/t/retry-delay.t 2019-10-17 19:52:06.000000000
+0200
+++ new/TheSchwartz-1.15/t/retry-delay.t 2020-01-28 07:20:56.000000000
+0100
@@ -42,6 +42,8 @@
is( $handle->exit_status, 0, "job succeeded" );
}
+ $client->set_current_job(undef);
+
teardown_dbs('ts1');
}
);
@@ -63,7 +65,7 @@
}
sub keep_exit_status_for {
- 20
+ 20;
} # keep exit status for 20 seconds after on_complete
sub max_retries {2}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/TheSchwartz-1.14/t/scoreboard.t
new/TheSchwartz-1.15/t/scoreboard.t
--- old/TheSchwartz-1.14/t/scoreboard.t 2019-10-17 19:52:06.000000000 +0200
+++ new/TheSchwartz-1.15/t/scoreboard.t 2020-01-28 07:20:56.000000000 +0100
@@ -33,15 +33,16 @@
pass => $ENV{TS_DB_PASS},
prefix => $pfx,
}
- } @$dbs
+ } @$dbs
]
);
my $sb_file = $client->scoreboard;
{
- ( undef, my ( $sb_dir, $sb_name ) )
+ my ( $sb_volume, $sb_dir, $sb_name )
= File::Spec->splitpath($sb_file);
- ok( -e $sb_dir, "Looking for dir $sb_dir" );
+ ok( -e File::Spec->catpath( $sb_volume, $sb_dir ),
+ "Looking for dir $sb_dir" );
}
{
@@ -62,7 +63,7 @@
my %info = map { chomp; /^([^=]+)=(.*)$/ } <FH>;
close(FH);
- ok( $info{pid} == $$, 'Has our PID' );
+ ok( $info{pid} == $$, 'Has our PID' );
ok( $info{funcname} eq 'Worker::Addition', 'Has our funcname' );
ok( $info{started} =~ /\d+/, 'Started time is a number' );
ok( $info{started} <= time, 'Started time is in the past' );
@@ -76,6 +77,8 @@
'Scoreboard file goes away when worker finishes' );
}
+ $client->set_current_job(undef);
+
teardown_dbs('ts1');
}
);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/TheSchwartz-1.14/t/server-time.t
new/TheSchwartz-1.15/t/server-time.t
--- old/TheSchwartz-1.14/t/server-time.t 2019-10-17 19:52:06.000000000
+0200
+++ new/TheSchwartz-1.15/t/server-time.t 2020-01-28 07:20:56.000000000
+0100
@@ -13,11 +13,16 @@
sub {
my $client = test_client( dbs => ['ts1'] );
- my $driver
- = $client->driver_for( ( $client->shuffled_databases )[0] );
- isa_ok $driver, 'Data::ObjectDriver::Driver::DBI';
+ {
+ my $driver
+ = $client->driver_for( ( $client->shuffled_databases )[0] );
+ isa_ok $driver, 'Data::ObjectDriver::Driver::DBI';
- cmp_ok $client->get_server_time($driver), '>', 0, 'got server time';
+ cmp_ok $client->get_server_time($driver), '>', 0,
+ 'got server time';
+ }
+
+ $client->set_current_job(undef);
teardown_dbs('ts1');
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/TheSchwartz-1.14/t/work-before-funcids-exist.t
new/TheSchwartz-1.15/t/work-before-funcids-exist.t
--- old/TheSchwartz-1.14/t/work-before-funcids-exist.t 2019-10-17
19:52:06.000000000 +0200
+++ new/TheSchwartz-1.15/t/work-before-funcids-exist.t 2020-01-28
07:20:56.000000000 +0100
@@ -14,15 +14,19 @@
sub {
my $client = test_client( dbs => ['ts1'] );
- my $handle = $client->insert("Worker::Dummy");
- ok( $handle, "inserted job" );
+ {
+ my $handle = $client->insert("Worker::Dummy");
+ ok( $handle, "inserted job" );
- $client->can_do("Worker::Dummy");
- $client->can_do("Worker::Dummy2");
- $client->can_do("Worker::Dummy3");
- $client->work_until_done;
+ $client->can_do("Worker::Dummy");
+ $client->can_do("Worker::Dummy2");
+ $client->can_do("Worker::Dummy3");
+ $client->work_until_done;
- ok( !$handle->is_pending, "job is done" );
+ ok( !$handle->is_pending, "job is done" );
+ }
+
+ $client->set_current_job(undef);
teardown_dbs('ts1');
}