FIX: Random Redis connection timeout failure in Travis.

This commit is contained in:
Guo Xiang Tan 2016-05-18 10:42:40 +08:00
parent f891430f32
commit e3e31441b8
No known key found for this signature in database
GPG Key ID: 19C321C8952B0F72
4 changed files with 20 additions and 20 deletions

View File

@ -1,16 +1,16 @@
require 'rails_helper'
describe Jobs::AboutStats do
after do
$redis.flushall
end
it 'caches the stats' do
stats = About.fetch_stats.to_json
cache_key = About.stats_cache_key
begin
stats = About.fetch_stats.to_json
cache_key = About.stats_cache_key
expect($redis.get(cache_key)).to eq(nil)
expect(described_class.new.execute({})).to eq(stats)
expect($redis.get(cache_key)).to eq(stats)
expect($redis.get(cache_key)).to eq(nil)
expect(described_class.new.execute({})).to eq(stats)
expect($redis.get(cache_key)).to eq(stats)
ensure
$redis.del(cache_key)
end
end
end

View File

@ -1,18 +1,18 @@
require 'rails_helper'
describe Jobs::DashboardStats do
after do
$redis.flushall
end
it 'caches the stats' do
Timecop.freeze do
stats = AdminDashboardData.fetch_stats.to_json
cache_key = AdminDashboardData.stats_cache_key
begin
stats = AdminDashboardData.fetch_stats.to_json
cache_key = AdminDashboardData.stats_cache_key
expect($redis.get(cache_key)).to eq(nil)
expect(described_class.new.execute({})).to eq(stats)
expect($redis.get(cache_key)).to eq(stats)
expect($redis.get(cache_key)).to eq(nil)
expect(described_class.new.execute({})).to eq(stats)
expect($redis.get(cache_key)).to eq(stats)
ensure
$redis.del(cache_key)
end
end
end
end

View File

@ -31,7 +31,7 @@ describe Jobs::PollMailbox do
end
after do
$redis.flushall
$redis.del(Jobs::PollMailbox::POLL_MAILBOX_TIMEOUT_ERROR_KEY)
end
it "add an admin dashboard message on pop authentication error" do

View File

@ -1,7 +1,7 @@
shared_examples_for 'stats cachable' do
describe 'fetch_cached_stats' do
after do
$redis.flushall
$redis.del(described_class.stats_cache_key)
end
it 'returns the cached stats' do