summaryrefslogtreecommitdiff
path: root/src/test/modules/injection_points/specs/basic.spec
blob: 47db676c0c19b47169b4cf80b9172848004529b6 (plain)
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
# Basic isolation test for injection points.
#
# This checks the interactions between wakeup, wait and detach.
# Feel free to use it as a template when implementing an isolation
# test with injection points.

setup
{
	CREATE EXTENSION injection_points;
}
teardown
{
	DROP EXTENSION injection_points;
}

# Wait happens in the first session, wakeup in the second session.
session s1
setup	{
	SELECT injection_points_set_local();
	SELECT injection_points_attach('injection-points-wait', 'wait');
}
step wait1	{ SELECT injection_points_run('injection-points-wait'); }

session s2
step wakeup2	{ SELECT injection_points_wakeup('injection-points-wait'); }
step detach2	{ SELECT injection_points_detach('injection-points-wait'); }

# Detach after wait and wakeup.
# Permutations like the following one commented out should be avoided, as
# the detach may finish before the SQL function doing the wait returns
# its result.  It is recommended to use wakeups as the last permutation
# should a wait be done within an SQL function.
#permutation wait1 wakeup2 detach2

# Detach before wakeup.  s1 waits until wakeup, ignores the detach.
permutation wait1 detach2 wakeup2

# Detach before wait does not cause a wait, wakeup produces an error.
permutation detach2 wait1 wakeup2