nodejs-integration-tests-best-practices icon indicating copy to clipboard operation
nodejs-integration-tests-best-practices copied to clipboard

DB cleanup recepie

Open goldbergyoni opened this issue 5 years ago • 0 comments

The setup

  • Dedicated folder or even repo
  • Super simple example app in one file - Add & delete order. One column should be unique
  • Single test: Delete order, ensure it was deleted. X100 times (run in a loop to test.each)
  • 20 tables with relationship

The options

  • Option1: Delete all tables on beforeEach
  • Option2: Delete on global teardown occasionally (once a day or with random)
  • Option3: Transactions

Checks and conclusions

  • The performance of each option under 100 tests
  • When cleaning, what is faster: Delete or Truncate
  • The performance of a single process (--run-in-band) vs max-1 processes
  • The RAM impact of having 6 Postgres vs only 1

goldbergyoni avatar Apr 04 '21 12:04 goldbergyoni