Commit 131553bc authored by Alexandru Croitor's avatar Alexandru Croitor

Update specs on the moved method

move the specs around fetch_rebalancing_groups_and_projects
method into Gitlab::Issues::Rebalancing::State spec.
parent 9d706b46
......@@ -183,6 +183,16 @@ RSpec.describe Gitlab::Issues::Rebalancing::State, :clean_gitlab_redis_shared_st
it { expect(rebalance_caching.send(:rebalanced_container_type)).to eq(described_class::NAMESPACE) }
it_behaves_like 'issues rebalance caching'
describe '.fetch_rebalancing_groups_and_projects' do
before do
rebalance_caching.track_new_running_rebalance
end
it 'caches recently finished rebalance key' do
expect(described_class.fetch_rebalancing_groups_and_projects).to eq([[group.id], []])
end
end
end
context 'rebalancing issues in a project' do
......@@ -193,6 +203,16 @@ RSpec.describe Gitlab::Issues::Rebalancing::State, :clean_gitlab_redis_shared_st
it { expect(rebalance_caching.send(:rebalanced_container_type)).to eq(described_class::PROJECT) }
it_behaves_like 'issues rebalance caching'
describe '.fetch_rebalancing_groups_and_projects' do
before do
rebalance_caching.track_new_running_rebalance
end
it 'caches recently finished rebalance key' do
expect(described_class.fetch_rebalancing_groups_and_projects).to eq([[], [project.id]])
end
end
end
# count - how many issue ids to generate, issue ids will start at 1
......
......@@ -16,11 +16,7 @@ RSpec.describe Issues::RescheduleStuckIssueRebalancesWorker, :clean_gitlab_redis
end
it 'schedules a rebalance in case there are any rebalances started' do
Gitlab::Redis::SharedState.with do |redis|
redis.sadd(::Gitlab::Issues::Rebalancing::State::CONCURRENT_RUNNING_REBALANCES_KEY, "#{::Gitlab::Issues::Rebalancing::State::NAMESPACE}/#{group.id}")
redis.sadd(::Gitlab::Issues::Rebalancing::State::CONCURRENT_RUNNING_REBALANCES_KEY, "#{::Gitlab::Issues::Rebalancing::State::PROJECT}/#{project.id}")
end
expect(::Gitlab::Issues::Rebalancing::State).to receive(:fetch_rebalancing_groups_and_projects).and_return([[group.id], [project.id]])
expect(IssueRebalancingWorker).to receive(:bulk_perform_async).with([[nil, nil, group.id]]).once
expect(IssueRebalancingWorker).to receive(:bulk_perform_async).with([[nil, project.id, nil]]).once
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment