ruby on rails - rspec tests randomly failing -


circleci testing, ruby on rails environment, using redis caching , postgres db. rspec + cucumber testing. have tried still failing tests, in quite few different spec files, randomly. whenever run tests individually, pass.

this means there's data left on previous tests, or of random factorygirl data messing sometimes. but, pass individually.

first, tried fix tests manually, realized bigger problem. now, i'm trying flush db , redis on each , every test, doesn't work.

i have flushall in before/after each in spec_helper, should apply every single test. know shouldn't need before , after, why not.

then, use database cleaner gem following settings:

rspec.configure |config|    config.before(:suite)     databasecleaner.clean_with(:truncation)   end    config.before(:each)     databasecleaner.strategy = :transaction   end    config.before(:each, :js => true)     databasecleaner.strategy = :truncation   end    config.before(:each)     databasecleaner.start   end    config.after(:each)     databasecleaner.clean   end  end 

what else missing? i've been digging long time now.

could i'm using different redis databases? use this:

  sidekiq.redis |connection|     connection.incr(company.message_count_key)     connection.incr(company.all_time_message_count_key)   end 

but built wrapper around redis. called red. , different redis? doing red.flushall not sufficient wiping redis?

you use different instances of redis in app. in initializers initialize 1 redis, , use different redis set counters, read them different redis (red)

red =! sidekiq.redis, that's why try read different redis.

ps after commit split redis databases.


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -