-
Notifications
You must be signed in to change notification settings - Fork 4
/
unique.t
46 lines (37 loc) · 1.28 KB
/
unique.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# $Id$
# -*-perl-*-
use strict;
use warnings;
require 't/lib/db-common.pl';
use TheSchwartz;
use Test::More tests => 18;
#use Data::ObjectDriver;
#$Data::ObjectDriver::DEBUG = 1;
run_tests(6, sub {
my $client = test_client(dbs => ['ts1']);
my ($job, $handle);
# insert a job with unique
$job = TheSchwartz::Job->new(
funcname => 'feed',
uniqkey => "major",
);
ok($job, "made first feed major job");
$handle = $client->insert($job);
isa_ok $handle, 'TheSchwartz::JobHandle';
# insert again (notably to same db) and see it fails
$job = TheSchwartz::Job->new(
funcname => 'feed',
uniqkey => "major",
);
ok($job, "made another feed major job");
$handle = $client->insert($job);
ok(! $handle, 'no handle');
# insert same uniqkey, but different func
$job = TheSchwartz::Job->new(
funcname => 'scratch',
uniqkey => "major",
);
ok($job, "made scratch major job");
$handle = $client->insert($job);
isa_ok $handle, 'TheSchwartz::JobHandle';
});