db-query-matchers
db-query-matchers copied to clipboard
ignore_cache config doesn't seem to properly work
Hi !
We want to implement db-query-matchers to test our endpoints to avoid performance regressions.
Unfortunately, given the context where they're launched, some tests have different query counts:
- If I run the whole context
- If I run the whole test test suite
- If I run only one test
Obviously, we don't want to implement a flakky test into our test suite 😄
We tried to implement a DataBaseCleaner strategy by cleaning the database after each test, but it doesn't fix the problem.
Here is the config we have:
# To avoid cache problems counting queries in specs, see :
# https://github.com/civiccc/db-query-matchers#configuration
DBQueryMatchers.configure do |config|
config.ignore_cached = true
config.schemaless = true
end
Here is the non working database cleaning strategy
context 'use db query matcher to avoid unnecessary queries' do
before(:each) do
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.start
end
after(:each) do
DatabaseCleaner.clean
end
Do you have any insights on this particular issue ? Is this some postgres / active record magic with hidden cached queries ?