#316: fixed specs

This commit is contained in:
Vokhmin Alexey V 2013-11-06 17:31:24 +04:00
parent 9f2d259742
commit a8c84fa883
3 changed files with 15 additions and 6 deletions

View File

@ -119,7 +119,7 @@ module AbfWorker
def gather_old_packages(project_id, repository_id, platform_id, testing = false)
build_lists_for_cleanup = []
status = testing ? BuildList::BUILD_PUBLISHED : BuildList::BUILD_PUBLISHED_INTO_TESTING
status = testing ? BuildList::BUILD_PUBLISHED_INTO_TESTING : BuildList::BUILD_PUBLISHED
Arch.pluck(:id).each do |arch_id|
bl = BuildList.where(:project_id => project_id).
where(:new_core => true, :status => status).

View File

@ -131,12 +131,18 @@ describe AbfWorker::BuildListsPublishTaskManager do
2.times{ subject.new.run }
end
%w(PROJECTS_FOR_CLEANUP LOCKED_BUILD_LISTS).each do |kind|
%w(LOCKED_BUILD_LISTS).each do |kind|
it "ensures that no '#{kind.downcase.gsub('_', ' ')}'" do
@redis_instance.lrange(subject.const_get(kind), 0, -1).should be_empty
end
end
it "ensures that has only 'projects for cleanup' for testing subrepo" do
queue = @redis_instance.lrange(subject::PROJECTS_FOR_CLEANUP, 0, -1)
queue.should have(1).item
queue.should include("testing-#{build_list.project_id}-#{build_list.save_to_repository_id}-#{build_list.build_for_platform_id}")
end
it "ensures that only one repository_status has status publish" do
RepositoryStatus.where(:status => RepositoryStatus::PUBLISH).should have(1).item
end
@ -174,8 +180,10 @@ describe AbfWorker::BuildListsPublishTaskManager do
2.times{ subject.new.run }
end
it "ensures that no 'projects for cleanup'" do
@redis_instance.lrange(subject::PROJECTS_FOR_CLEANUP, 0, -1).should be_empty
it "ensures that no 'projects for cleanup' for main repo" do
queue = @redis_instance.lrange(subject::PROJECTS_FOR_CLEANUP, 0, -1)
queue.should have(1).item
queue.should include("testing-#{build_list3.project_id}-#{build_list3.save_to_repository_id}-#{build_list3.build_for_platform_id}")
end
it "ensures that only one repository_status has status publish" do

View File

@ -21,7 +21,8 @@ describe ProjectToRepository do
stub_redis
@first_repo.project_to_repositories.destroy_all
queue = @redis_instance.lrange(AbfWorker::BuildListsPublishTaskManager::PROJECTS_FOR_CLEANUP, 0, -1)
queue.should have(1).item
queue.should include("#{@project.id}-#{@first_repo.id}-#{@platform.id}")
queue.should have(2).item
key = "#{@project.id}-#{@first_repo.id}-#{@platform.id}"
queue.should include(key, "testing-#{key}")
end
end