Egor ButterFly
Egor ButterFly

Reputation: 1

Alternatives to backup/restore databases for testing purposes

I have an environment for testing purposes with its own database (Microsoft Azure). So every single release, once we deploy a new version to our environment, we restore the database from our backup. And that restore process takes for ages. Do we have any alternatives to full restore? Since we create tons of junk data because of our automated tests, we need to have a 'fresh' database once we moved to a new version. I know that it's a good practice to have some 'tear down' mechanism, but our tests create literally huge amount of data, so we thought that backup/restore is the only one smart way to handle our issue. But since the restore can take, let's say 5-6 hours, we are searching for alternatives.

Upvotes: 0

Views: 65

Answers (1)

Pratik Lad
Pratik Lad

Reputation: 8422

Restoring a full database for each test deployment can be time-consuming, especially if you are dealing with large amounts of data. to reduce this time, you can follow below approaches:

  1. Instead of getting a full restore, you can truncate all test tables and reset database objects to their original state. This approach works well if you only need to back up your n=original data do not test data and clean up junk data generated by tests
TRUNCATE TABLE TestTable1;

  1. You can use Hyperscale service tier which provides Fast database backups regardless of size and Fast database restores in minutes rather than hours or days.

Upvotes: 0

Related Questions