makara icon indicating copy to clipboard operation
makara copied to clipboard

How to test it within the application

Open neonishu opened this issue 7 years ago • 2 comments

Hi, I was curious to understand how can we write a test case inside the application using ActiveRecord around Read/Write queries and check which query hit master and which one did it for slave. I wish to add a Wiki page/Documentation on How to test as that is an essential part which I think is missing in such an awesome gem.

neonishu avatar Nov 02 '18 19:11 neonishu

cc/ @bleonard @rosa

neonishu avatar Nov 02 '18 19:11 neonishu

I would think it could be similar to the gem test suite itself. More or less expect statements about where is should call. The bad thing is you'd have to know the internals.

If we were serious about enabling "end user" testing, we might have some sort of code to allow that. Makara.raise_if_master_called! or some set like that.

Most people have seemed to just expect that it does what it does. No one is testing ActiveRecord. Then they dive in if things seem weird. Clearly pros/cons.

bleonard avatar Nov 08 '18 10:11 bleonard