summaryrefslogtreecommitdiffstats
path: root/contrib/tcn/specs/tcn.spec
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/tcn/specs/tcn.spec')
-rw-r--r--contrib/tcn/specs/tcn.spec28
1 files changed, 28 insertions, 0 deletions
diff --git a/contrib/tcn/specs/tcn.spec b/contrib/tcn/specs/tcn.spec
new file mode 100644
index 0000000..fb9e730
--- /dev/null
+++ b/contrib/tcn/specs/tcn.spec
@@ -0,0 +1,28 @@
+# Tests for contrib/tcn
+
+# These tests use only self-notifies within a single session,
+# which are convenient because they minimize timing concerns.
+# Whether the NOTIFY mechanism works across sessions is not
+# really tcn's problem.
+
+setup
+{
+ CREATE TABLE mytable (key int PRIMARY KEY, value text);
+ CREATE TRIGGER tcntrig AFTER INSERT OR UPDATE OR DELETE ON mytable
+ FOR EACH ROW EXECUTE FUNCTION triggered_change_notification(mychannel);
+}
+
+teardown
+{
+ DROP TABLE mytable;
+}
+
+session s1
+step listen { LISTEN mychannel; }
+step insert { INSERT INTO mytable VALUES(1, 'one'); }
+step insert2 { INSERT INTO mytable VALUES(2, 'two'); }
+step update { UPDATE mytable SET value = 'foo' WHERE key = 2; }
+step delete { DELETE FROM mytable; }
+
+
+permutation listen insert insert2 update delete