|
Revision 42, 1.3 kB
(checked in by btrott, 4 years ago)
|
|
Implemented FuncMap table, along with function ID to function name map,
and back. Mapping is cached within the $client object for each DSN. All
tests pass again, yay!
|
| Line | |
|---|
| 1 | # $Id$ |
|---|
| 2 | # -*-perl-*- |
|---|
| 3 | |
|---|
| 4 | use strict; |
|---|
| 5 | use warnings; |
|---|
| 6 | |
|---|
| 7 | require 't/lib/db-common.pl'; |
|---|
| 8 | |
|---|
| 9 | use TheSchwartz; |
|---|
| 10 | use Test::More tests => 16; |
|---|
| 11 | |
|---|
| 12 | run_tests(8, sub { |
|---|
| 13 | |
|---|
| 14 | my $client = test_client(dbs => ['ts1']); |
|---|
| 15 | |
|---|
| 16 | my $handle; |
|---|
| 17 | $handle = $client->insert("feedmajor", { scoops => 2, with => ['cheese','love'] }); |
|---|
| 18 | isa_ok $handle, 'TheSchwartz::JobHandle', "inserted job"; |
|---|
| 19 | |
|---|
| 20 | my $job = $handle->job; |
|---|
| 21 | isa_ok $job, 'TheSchwartz::Job'; |
|---|
| 22 | |
|---|
| 23 | ok($job->funcid, 'jobs have funcids'); |
|---|
| 24 | is $job->funcname, 'feedmajor', 'handle->job gives us the right job'; |
|---|
| 25 | |
|---|
| 26 | my $job2 = TheSchwartz::Job->new( |
|---|
| 27 | funcname => 'feedmajor', |
|---|
| 28 | run_after=> time() + 60, |
|---|
| 29 | priority => 7, |
|---|
| 30 | arg => { scoops => 2, with => ['cheese','love'] }, |
|---|
| 31 | coalesce => 'major', |
|---|
| 32 | jobid => int rand(5000), |
|---|
| 33 | ); |
|---|
| 34 | ok($job2); |
|---|
| 35 | |
|---|
| 36 | my $h2 = $client->insert($job2); |
|---|
| 37 | isa_ok $h2, 'TheSchwartz::JobHandle'; |
|---|
| 38 | |
|---|
| 39 | my $job2_back = $h2->job; |
|---|
| 40 | ok($job2->funcid, "internal: funcid present"); |
|---|
| 41 | is($job2->funcname, "feedmajor", "funcname mapping worked"); |
|---|
| 42 | |
|---|
| 43 | teardown_dbs('ts1'); |
|---|
| 44 | }); |
|---|