#794: add new specs for BuildListsPublishTaskManager
This commit is contained in:
parent
f08b5d3aa7
commit
cc8ffb26e8
|
@ -162,7 +162,6 @@ module AbfWorker
|
|||
bl
|
||||
end.compact
|
||||
|
||||
|
||||
bl = build_lists.first || build_lists_for_cleanup.first
|
||||
return false unless bl
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@ describe AbfWorker::BuildListsPublishTaskManager do
|
|||
end
|
||||
|
||||
subject { AbfWorker::BuildListsPublishTaskManager }
|
||||
let(:build_list) { FactoryGirl.create(:build_list_core, :new_core => true) }
|
||||
let(:build_list2) { FactoryGirl.create(:build_list_core, :new_core => true) }
|
||||
|
||||
describe 'when no items for publishing' do
|
||||
before do
|
||||
|
@ -33,6 +35,35 @@ describe AbfWorker::BuildListsPublishTaskManager do
|
|||
|
||||
end
|
||||
|
||||
describe 'when one build_list for publishing' do
|
||||
before do
|
||||
build_list.update_column(:status, BuildList::BUILD_PUBLISH)
|
||||
stub_redis
|
||||
2.times{ subject.new.run }
|
||||
end
|
||||
%w(RESIGN_REPOSITORIES
|
||||
PROJECTS_FOR_CLEANUP
|
||||
LOCKED_PROJECTS_FOR_CLEANUP
|
||||
LOCKED_REPOSITORIES).each do |kind|
|
||||
|
||||
it "ensure that no '#{kind.downcase.gsub('_', ' ')}'" do
|
||||
@redis_instance.lrange(subject.const_get(kind), 0, -1).should be_empty
|
||||
end
|
||||
end
|
||||
|
||||
it "ensure that 'locked rep and platforms' has only one item" do
|
||||
queue = @redis_instance.lrange(subject::LOCKED_REP_AND_PLATFORMS, 0, -1)
|
||||
queue.should have(1).item
|
||||
queue.should include("#{build_list.save_to_repository_id}-#{build_list.build_for_platform_id}")
|
||||
end
|
||||
|
||||
it "ensure that 'locked build lists' has only one item" do
|
||||
queue = @redis_instance.lrange(subject::LOCKED_BUILD_LISTS, 0, -1)
|
||||
queue.should have(1).item
|
||||
queue.should include(build_list.id.to_s)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
after(:all) do
|
||||
|
|
|
@ -62,6 +62,7 @@ end
|
|||
def stub_redis
|
||||
@redis_instance = MockRedis.new
|
||||
stub(Redis).new { @redis_instance }
|
||||
stub(Resque).redis { @redis_instance }
|
||||
end
|
||||
|
||||
init_test_root
|
||||
|
|
Loading…
Reference in New Issue