Need some help creating a database sandbox...

From: "Eric D(dot) Nielsen" <nielsene(at)MIT(dot)EDU>
To: pgsql-general(at)postgresql(dot)org
Cc: "Eric D(dot) Nielsen" <nielsene(at)mit(dot)edu>
Subject: Need some help creating a database sandbox...
Date: 2005-08-03 03:12:08
Message-ID: 91C3DA84-EFE8-42F3-9A60-995B53D44B7E@mit.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm trying to setup a "safe" testing database environment for some
unit testing of a web application. I would like to have the unit
tests restore the database to a known state before every test. The
simplest way I thought would be to have the testing tools drop/create
the testing database on every test case, and then populate the
database from a specified file. However I don't want to give the
test user superuser privileges. Thus I don't think I can restrict it
to only drop/create a single named DB.

My next thought was to code up a "DELETE ALL" script that would
delete all entities in the database. However it seems easy to miss
something and its not robust against schema changes, even though it
can be looked down to the test_db_owner.

A third thought would be to run a second cluster containing only the
test database(s). Then the users wouldn't be shared, so even if it
someone connected to the wrong DB it would lack any permissions. I
don't have much experience running multiple clusters, however. So I
don't know if thats opening up another whole can of worms.

Any suggestions?

Thanks
Eric

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-08-03 03:33:44 Re: Need some help creating a database sandbox...
Previous Message Richard Sydney-Smith 2005-08-03 02:24:43 Windows file path for copy