In Microservice architecture, often the goal of Microservices is to find "seams" and break up the services along those seams.
If you have multiple services "coming together" in a single database, then you're, in essence, breaching the seam.
It appears you're splitting your seam in the wrong way. It's my understanding that any given service can definitely use a db connector service to connect to its responsible DB. That's fine.
But to have multiple services essentially be separate EXCEPT at the DB level might be troublesome.
It violates, for example, the idea of having separate teams working on each service. Which is one goal of the microservices architecture. To keep teams focused on specific functionality.
Also, the shared DB violate the cohesion that Microservices are aiming to create. In essence, you have Adhesion on the DB level.
Then there's a question of how brittle those shared databases are, in terms of entities. Can their structure be preserved if they're serving multiple services?
... and I'm wondering about any logic at the database level that's cutting across the service seams by having service entities interacting with each other in the DB, in a way they shouldn't be.
You could do a single API for the DB, but this presents as a somewhat problematic solution because the monolithic database service ends up breaking cohesion for the consuming services.
The proposed Solutions, as I understand them:
- On each service build a layer to communicate with the DB
- On the DB, built an API for the Services to consume
I'm not completely sure which is the best but they both abstract away the core issue: Adhesion at the database level.
My suggestion is identify seams in the DB and start "breaking" them apart and to do that process incrementally over time.
It'll solve the testing issues you're having as well. Increase Service cohesion and increase decoupling as well.