core icon indicating copy to clipboard operation
core copied to clipboard

Database provider tests clean-up

Open dstpierre opened this issue 2 years ago • 1 comments

There's currently 3 implementations of the Persister database/persister.go interface, which includes all database functions.

Each packages have the same (99%) identical tests code. For instance, cecking the number of lines in the memory's base.go file vs. the mongo's one:

$ wc -l database/memory/base_test.go
406 database/memory/base_test.go
$ wc -l database/mongo/base_test.go
406 database/mongo/base_test.go

Brain storming

  1. Can we remove all this duplication and have one set of test that can tests all implementation?
  2. At the moment I created some entry in the Makefile to target specific database engine implementation, this is useful when implementing a new feature to only run tests for the currently develop provider. I would not want to lose this after no. 1.

dstpierre avatar May 10 '23 17:05 dstpierre

Hi @dstpierre, I opened a draft PR here (https://github.com/staticbackendhq/core/pull/124) to validate the idea.

If that aligns with your initial thoughts, I'd be happy to prepare that PR for merging.

mbezhanov avatar Jul 10 '24 08:07 mbezhanov