|
8 | 8 | use PostgreSQL::Test::Utils;
|
9 | 9 | use Test::More;
|
10 | 10 |
|
| 11 | +# Check the initial state of the data generated. Tables for tellers and |
| 12 | +# branches use NULL for their filler attribute. The table accounts uses |
| 13 | +# a non-NULL filler. The history table should have no data. |
| 14 | +sub check_data_state |
| 15 | +{ |
| 16 | + local $Test::Builder::Level = $Test::Builder::Level + 1; |
| 17 | + my $node = shift; |
| 18 | + my $type = shift; |
| 19 | + |
| 20 | + my $sql_result = $node->safe_psql('postgres', |
| 21 | + 'SELECT count(*) AS null_count FROM pgbench_accounts WHERE filler IS NULL LIMIT 10;' |
| 22 | + ); |
| 23 | + is($sql_result, '0', |
| 24 | + "$type: filler column of pgbench_accounts has no NULL data"); |
| 25 | + $sql_result = $node->safe_psql('postgres', |
| 26 | + 'SELECT count(*) AS null_count FROM pgbench_branches WHERE filler IS NULL;' |
| 27 | + ); |
| 28 | + is($sql_result, '1', |
| 29 | + "$type: filler column of pgbench_branches has only NULL data"); |
| 30 | + $sql_result = $node->safe_psql('postgres', |
| 31 | + 'SELECT count(*) AS null_count FROM pgbench_tellers WHERE filler IS NULL;' |
| 32 | + ); |
| 33 | + is($sql_result, '10', |
| 34 | + "$type: filler column of pgbench_tellers has only NULL data"); |
| 35 | + $sql_result = $node->safe_psql('postgres', |
| 36 | + 'SELECT count(*) AS data_count FROM pgbench_history;'); |
| 37 | + is($sql_result, '0', "$type: pgbench_history has no data"); |
| 38 | +} |
| 39 | + |
11 | 40 | # start a pgbench specific server
|
12 | 41 | my $node = PostgreSQL::Test::Cluster->new('main');
|
13 | 42 | # Set to untranslated messages, to be able to compare program output with
|
|
67 | 96 | ],
|
68 | 97 | 'pgbench scale 1 initialization',);
|
69 | 98 |
|
| 99 | +# Check data state, after client-side data generation. |
| 100 | +check_data_state($node, 'client-side'); |
| 101 | + |
70 | 102 | # Again, with all possible options
|
71 | 103 | $node->pgbench(
|
72 | 104 | '--initialize --init-steps=dtpvg --scale=1 --unlogged-tables --fillfactor=98 --foreign-keys --quiet --tablespace=regress_pgbench_tap_1_ts --index-tablespace=regress_pgbench_tap_1_ts --partitions=2 --partition-method=hash',
|
|
101 | 133 | ],
|
102 | 134 | 'pgbench --init-steps');
|
103 | 135 |
|
| 136 | +# Check data state, after server-side data generation. |
| 137 | +check_data_state($node, 'server-side'); |
| 138 | + |
104 | 139 | # Run all builtin scripts, for a few transactions each
|
105 | 140 | $node->pgbench(
|
106 | 141 | '--transactions=5 -Dfoo=bla --client=2 --protocol=simple --builtin=t'
|
|
0 commit comments