Commit | Line | Data |
e9b0b5f0 |
1 | use strict; |
0e3e3555 |
2 | use warnings FATAL => 'all'; |
3 | |
e9b0b5f0 |
4 | use Test::More; |
5 | use Test::Deep; |
6 | use Test::Exception; |
0e3e3555 |
7 | use t::common qw( new_dbm ); |
e9b0b5f0 |
8 | |
0e3e3555 |
9 | use_ok( 'DBM::Deep' ); |
e9b0b5f0 |
10 | |
9c87a079 |
11 | my $max_txns = 255; |
e9b0b5f0 |
12 | |
4f034d8f |
13 | if ( $ENV{NO_TEST_TRANSACTIONS} ) { |
14 | done_testing; |
15 | exit; |
16 | } |
17 | |
0e3e3555 |
18 | my $dbm_factory = new_dbm( |
19 | num_txns => $max_txns, |
20 | ); |
21 | while ( my $dbm_maker = $dbm_factory->() ) { |
22 | my @dbs = grep { $_ } map { |
23 | eval { $dbm_maker->() } |
24 | } 1 .. $max_txns; |
25 | |
26 | |
27 | cmp_ok( scalar(@dbs), '==', $max_txns, "We could open enough DB handles" ); |
28 | |
29 | my %trans_ids; |
30 | for my $n (0 .. $#dbs) { |
31 | lives_ok { |
32 | $dbs[$n]->begin_work |
33 | } "DB $n can begin_work"; |
34 | |
35 | my $trans_id = $dbs[$n]->_engine->trans_id; |
36 | ok( !exists $trans_ids{ $trans_id }, "DB $n has a unique transaction ID ($trans_id)" ); |
37 | $trans_ids{ $trans_id } = $n; |
38 | } |
e9b0b5f0 |
39 | } |
0e3e3555 |
40 | |
41 | done_testing; |