File tree Expand file tree Collapse file tree 2 files changed +33
-3
lines changed Expand file tree Collapse file tree 2 files changed +33
-3
lines changed Original file line number Diff line number Diff line change 1
1
BEGIN ;
2
2
-- Plan the tests.
3
- SELECT plan(2 );
3
+ SELECT plan(3 );
4
4
5
5
INSERT INTO rate_limit .sessions (id, name_, type_)
6
6
SELECT
7
7
' 00000000-0000-0000-0000-000000000000' ::uuid AS id,
8
8
' dedicated-test' ::text AS name_,
9
- ' aggregated' ::text AS type_;
9
+ ' aggregated' ::text AS type_
10
+ UNION
11
+ SELECT
12
+ ' 00000000-1111-1111-1111-000000000000' ::uuid AS id,
13
+ ' dedicated-test-2' ::text AS name_,
14
+ ' aggregated' ::text AS type_;;
10
15
11
16
INSERT INTO rate_limit .records_aggregated (key, session_id)
12
17
SELECT
@@ -23,6 +28,16 @@ SELECT results_eq(
23
28
' rate_limit.agg_increment returns correct count for new key'
24
29
);
25
30
31
+ SELECT results_eq(
32
+ $have$
33
+ SELECT agg_increment AS count FROM rate_limit .agg_increment (' new-key' , ' 00000000-1111-1111-1111-000000000000' )
34
+ $have$,
35
+ $want$
36
+ SELECT 1 ::int AS count;
37
+ $want$,
38
+ ' rate_limit.agg_increment returns correct count for new key on different session'
39
+ );
40
+
26
41
SELECT results_eq(
27
42
$have$
28
43
SELECT agg_increment AS count FROM rate_limit .agg_increment (' existing-key' , ' 00000000-0000-0000-0000-000000000000' )
Original file line number Diff line number Diff line change 1
1
BEGIN ;
2
2
-- Plan the tests.
3
- SELECT plan(3 );
3
+ SELECT plan(4 );
4
4
5
5
INSERT INTO rate_limit .sessions (id, name_, type_)
6
6
SELECT
7
7
' 00000000-0000-0000-0000-000000000000' ::uuid AS id,
8
8
' dedicated-test' ::text AS name_,
9
+ ' individual' ::text AS type_
10
+ UNION
11
+ SELECT
12
+ ' 00000000-1111-1111-1111-000000000000' ::uuid AS id,
13
+ ' dedicated-test-2' ::text AS name_,
9
14
' individual' ::text AS type_;
10
15
11
16
INSERT INTO rate_limit .individual_records (key, session_id)
@@ -23,6 +28,16 @@ SELECT results_eq(
23
28
' rate_limit.ind_increment returns correct count for new key'
24
29
);
25
30
31
+ SELECT results_eq(
32
+ $have$
33
+ SELECT ind_increment AS count FROM rate_limit .ind_increment (' new-key' , ' 00000000-1111-1111-1111-000000000000' )
34
+ $have$,
35
+ $want$
36
+ SELECT 1 ::int AS count;
37
+ $want$,
38
+ ' rate_limit.ind_increment returns correct count for new key on another session'
39
+ );
40
+
26
41
SELECT results_eq(
27
42
$have$
28
43
SELECT ind_increment AS count FROM rate_limit .ind_increment (' existing-key' , ' 00000000-0000-0000-0000-000000000000' )
You can’t perform that action at this time.
0 commit comments