#794: add specs for grouping build lists

This commit is contained in:
Vokhmin Alexey V 2013-01-18 19:06:54 +04:00
parent da8017480e
commit c6187b72a2
1 changed files with 43 additions and 1 deletions

View File

@ -9,11 +9,11 @@ describe AbfWorker::BuildListsPublishTaskManager do
before do
init_test_root
stub_symlink_methods
FactoryGirl.create(:build_list_core, :new_core => true)
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
@ -75,6 +75,48 @@ describe AbfWorker::BuildListsPublishTaskManager do
end
describe 'grouping build lists for publishing into same repository' do
let(:build_list2) { FactoryGirl.create(:build_list_core,
:new_core => true,
:save_to_platform => build_list.save_to_platform,
:save_to_repository => build_list.save_to_repository,
:build_for_platform => build_list.build_for_platform
) }
before do
stub_redis
build_list.update_column(:status, BuildList::BUILD_PUBLISH)
build_list2.update_column(:status, BuildList::BUILD_PUBLISH)
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 2 items" do
queue = @redis_instance.lrange(subject::LOCKED_BUILD_LISTS, 0, -1)
queue.should have(2).item
queue.should include(build_list.id.to_s, build_list2.id.to_s)
end
it "ensure that new task for publishing has been created" do
@redis_instance.lrange('queue:publish_worker_default', 0, -1).should have(1).item
end
end
describe 'resign packages in repository' do
before do
stub_redis