Thursday, November 04, 2010

Small tip when repeatedly doing upgrade testing

Suppose you want to test upgrading your software from version x to y. This often includes updates of database schemas, tables and content.

The obvious way to do this is

do {
install version x
quit x
install version y
verify upgrade
} while (upgrade was bad)

The install version x step here is usually time consuming and involves UI interactions.

A better approach here is to

install version x
create a db backup
verified = false
while (not verified ) {
install version y
if ( upgrade good )
verified = true
install db backup

With PostgreSQL taking a backup would look like this:

pg_dump -f outfile -b -C dbname


pg_dump -f ~/jon231.dump -b -C jon231

and then the re-install:

pg_restore outfile


pg_restore ~/jon231.dump

No comments: