Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit fc7e8ea

Browse files
committed
Fixed error with rounded file creation time.
1 parent 5b40bd0 commit fc7e8ea

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/test/isolation/expected/snapfs_get_snapshot_timestamp.out

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@ starting permutation: s1_mk_sn
44
step s1_mk_sn:
55
select 1 as "make_snapshot" from pg_make_snapshot();
66
create table foo as select 'test_data';
7-
select ( now() - ( select pg_get_snapshot_timestamp( ( select recent_snapshot from pg_control_snapshot() ) ) ) ) between '0 sec'::interval and '1 min'::interval as "timestamp_check"
7+
select (
8+
case
9+
when ( ( date_trunc( 'second', now() ) - ( select pg_get_snapshot_timestamp( ( select recent_snapshot from pg_control_snapshot() ) ) ) ) between '-1 sec'::interval and '3 sec'::interval )
10+
then 'passed'
11+
else 'Now:' || date_trunc( 'second', now() )::varchar || ' SN:' || ( select pg_get_snapshot_timestamp( ( select recent_snapshot from pg_control_snapshot() ) ) )
12+
end
13+
) as "timestamp_check"
814

915
make_snapshot
1016

1117
1
1218
timestamp_check
1319

14-
t
20+
passed

src/test/isolation/specs/snapfs_get_snapshot_timestamp.spec

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# The recent just created snapshot cannot be older than 1 minute :)
1+
# The recent just created snapshot cannot be older than 3 seconds
22

33
teardown {
44
select pg_remove_snapshot( ( select recent_snapshot from pg_control_snapshot() ) );
@@ -9,7 +9,13 @@ session "s1"
99
step "s1_mk_sn" {
1010
select 1 as "make_snapshot" from pg_make_snapshot();
1111
create table foo as select 'test_data';
12-
select ( now() - ( select pg_get_snapshot_timestamp( ( select recent_snapshot from pg_control_snapshot() ) ) ) ) between '0 sec'::interval and '1 min'::interval as "timestamp_check"
12+
select (
13+
case
14+
when ( ( date_trunc( 'second', now() ) - ( select pg_get_snapshot_timestamp( ( select recent_snapshot from pg_control_snapshot() ) ) ) ) between '-1 sec'::interval and '3 sec'::interval )
15+
then 'passed'
16+
else 'Now:' || date_trunc( 'second', now() )::varchar || ' SN:' || ( select pg_get_snapshot_timestamp( ( select recent_snapshot from pg_control_snapshot() ) ) )
17+
end
18+
) as "timestamp_check"
1319
}
1420

1521
permutation "s1_mk_sn"

0 commit comments

Comments
 (0)