root/trunk/t/funcid.t @ 164

Revision 164, 1.3 kB (checked in by miyagawa, 7 months ago)

PostgreSQL patch from clkao

Line 
1# $Id$
2# -*-perl-*-
3
4use strict;
5use warnings;
6
7require 't/lib/db-common.pl';
8
9use TheSchwartz;
10use Test::More tests => 24;
11
12run_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});
Note: See TracBrowser for help on using the browser.