Add more regression tests for ASYNC

Started by Robins Tharakanover 12 years ago4 messages
#1Robins Tharakan
tharakan@gmail.com
1 attachment(s)

Hi,

Patch to add more regression tests to ASYNC (/src/backend/commands/async).
Take code-coverage from 39% to 75%.

Any and all feedback is obviously welcome.

p.s.: Please let me know whether these tests are useless or would not be
committed owing to unrelated reasons. As also, if these tests need to be
clubbed (bundled up in 2-3) and submitted as a single submit.
--
Robins Tharakan

Attachments:

regress_async.patchapplication/octet-stream; name=regress_async.patchDownload
diff --git a/src/test/regress/expected/async.out b/src/test/regress/expected/async.out
new file mode 100644
index 0000000..ae0d5df
--- /dev/null
+++ b/src/test/regress/expected/async.out
@@ -0,0 +1,34 @@
+--
+-- ASYNC
+--
+--Should work. Send a valid message via a valid channel name
+SELECT pg_notify('notify_async1','sample message1');
+ pg_notify 
+-----------
+ 
+(1 row)
+
+SELECT pg_notify('notify_async1','');
+ pg_notify 
+-----------
+ 
+(1 row)
+
+SELECT pg_notify('notify_async1',NULL);
+ pg_notify 
+-----------
+ 
+(1 row)
+
+-- Should fail. Send a valid message via an invalid channel name
+SELECT pg_notify('','sample message1');
+ERROR:  channel name cannot be empty
+SELECT pg_notify(NULL,'sample message1');
+ERROR:  channel name cannot be empty
+SELECT pg_notify('notify_async_channel_name_too_long______________________________','sample_message1');
+ERROR:  channel name too long
+--Should work. Valid NOTIFY/LISTEN/UNLISTEN commands
+NOTIFY notify_async2;
+LISTEN notify_async2;
+UNLISTEN notify_async2;
+UNLISTEN *;
diff --git a/src/test/regress/parallel_schedule b/src/test/regress/parallel_schedule
index 2af28b1..04cdbb7 100644
--- a/src/test/regress/parallel_schedule
+++ b/src/test/regress/parallel_schedule
@@ -88,7 +88,7 @@ test: privileges security_label collate matview
 # ----------
 # Another group of parallel tests
 # ----------
-test: alter_generic misc psql
+test: alter_generic misc psql async
 
 # rules cannot run concurrently with any test that creates a view
 test: rules
diff --git a/src/test/regress/sql/async.sql b/src/test/regress/sql/async.sql
new file mode 100644
index 0000000..af3a904
--- /dev/null
+++ b/src/test/regress/sql/async.sql
@@ -0,0 +1,19 @@
+--
+-- ASYNC
+--
+
+--Should work. Send a valid message via a valid channel name
+SELECT pg_notify('notify_async1','sample message1');
+SELECT pg_notify('notify_async1','');
+SELECT pg_notify('notify_async1',NULL);
+
+-- Should fail. Send a valid message via an invalid channel name
+SELECT pg_notify('','sample message1');
+SELECT pg_notify(NULL,'sample message1');
+SELECT pg_notify('notify_async_channel_name_too_long______________________________','sample_message1');
+
+--Should work. Valid NOTIFY/LISTEN/UNLISTEN commands
+NOTIFY notify_async2;
+LISTEN notify_async2;
+UNLISTEN notify_async2;
+UNLISTEN *;
#2Josh Berkus
josh@agliodbs.com
In reply to: Robins Tharakan (#1)
Re: Add more regression tests for ASYNC

On 05/13/2013 05:37 PM, Robins Tharakan wrote:

Hi,

Patch to add more regression tests to ASYNC (/src/backend/commands/async).
Take code-coverage from 39% to 75%.

This isn't applying for me anymore due to changes in the
parallel_schedule file. Where did you mean this to execute in the
sequence of tests?

--- src/test/regress/parallel_schedule
+++ src/test/regress/parallel_schedule
@@ -88,7 +88,7 @@
 # ----------
 # Another group of parallel tests
 # ----------
-test: alter_generic misc psql
+test: alter_generic misc psql async

# rules cannot run concurrently with any test that creates a view
test: rules

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Josh Berkus
josh@agliodbs.com
In reply to: Robins Tharakan (#1)
Re: Add more regression tests for ASYNC

On 06/28/2013 12:42 PM, Josh Berkus wrote:

On 05/13/2013 05:37 PM, Robins Tharakan wrote:

Hi,

Patch to add more regression tests to ASYNC (/src/backend/commands/async).
Take code-coverage from 39% to 75%.

This isn't applying for me anymore due to changes in the
parallel_schedule file. Where did you mean this to execute in the
sequence of tests?

Never mind, dirty checkout on my part. Back to testing.

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Robert Haas
robertmhaas@gmail.com
In reply to: Robins Tharakan (#1)
Re: Add more regression tests for ASYNC

On Mon, May 13, 2013 at 8:37 PM, Robins Tharakan <tharakan@gmail.com> wrote:

Hi,

Patch to add more regression tests to ASYNC (/src/backend/commands/async).
Take code-coverage from 39% to 75%.

Any and all feedback is obviously welcome.

p.s.: Please let me know whether these tests are useless or would not be
committed owing to unrelated reasons. As also, if these tests need to be
clubbed (bundled up in 2-3) and submitted as a single submit.

Committed.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers