Search Postgresql Archives

Need some help creating a database sandbox...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux