#168: removed bs_id from build_list
This commit is contained in:
parent
91a6db517e
commit
f055123d74
|
@ -55,7 +55,7 @@ class UserMailer < ActionMailer::Base
|
||||||
I18n.locale = user.language if user.language
|
I18n.locale = user.language if user.language
|
||||||
@user, @build_list = user, build_list
|
@user, @build_list = user, build_list
|
||||||
|
|
||||||
subject = "[№ #{build_list.bs_id.present? ? build_list.bs_id : t("layout.build_lists.bs_id_not_set")}] "
|
subject = "[№ #{build_list.id}] "
|
||||||
subject << (build_list.project ? build_list.project.name_with_owner : t("layout.projects.unexisted_project"))
|
subject << (build_list.project ? build_list.project.name_with_owner : t("layout.projects.unexisted_project"))
|
||||||
subject << " - #{build_list.human_status} "
|
subject << " - #{build_list.human_status} "
|
||||||
subject << I18n.t("notifications.subjects.for_arch", :arch => @build_list.arch.name)
|
subject << I18n.t("notifications.subjects.for_arch", :arch => @build_list.arch.name)
|
||||||
|
|
|
@ -292,7 +292,6 @@ class BuildList < ActiveRecord::Base
|
||||||
|
|
||||||
def add_to_queue
|
def add_to_queue
|
||||||
add_job_to_abf_worker_queue
|
add_job_to_abf_worker_queue
|
||||||
update_column(:bs_id, id)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.human_status(status)
|
def self.human_status(status)
|
||||||
|
|
|
@ -11,8 +11,8 @@ class BuildList::Filter
|
||||||
def find
|
def find
|
||||||
build_lists = @project ? @project.build_lists : BuildList.scoped
|
build_lists = @project ? @project.build_lists : BuildList.scoped
|
||||||
|
|
||||||
if @options[:bs_id]
|
if @options[:id]
|
||||||
build_lists = build_lists.where(:bs_id => @options[:bs_id])
|
build_lists = build_lists.where(:id => @options[:id])
|
||||||
else
|
else
|
||||||
build_lists = build_lists.accessible_by(::Ability.new(@user), @options[:ownership].to_sym) if @options[:ownership]
|
build_lists = build_lists.accessible_by(::Ability.new(@user), @options[:ownership].to_sym) if @options[:ownership]
|
||||||
build_lists = build_lists.scoped_to_new_core(@options[:new_core] == '0' ? nil : true) if @options[:new_core].present?
|
build_lists = build_lists.scoped_to_new_core(@options[:new_core] == '0' ? nil : true) if @options[:new_core].present?
|
||||||
|
@ -49,7 +49,7 @@ class BuildList::Filter
|
||||||
:platform_id => nil,
|
:platform_id => nil,
|
||||||
:is_circle => nil,
|
:is_circle => nil,
|
||||||
:project_version => nil,
|
:project_version => nil,
|
||||||
:bs_id => nil,
|
:id => nil,
|
||||||
:project_name => nil,
|
:project_name => nil,
|
||||||
:mass_build_id => nil,
|
:mass_build_id => nil,
|
||||||
:new_core => nil
|
:new_core => nil
|
||||||
|
@ -65,7 +65,7 @@ class BuildList::Filter
|
||||||
@options[:arch_id] = @options[:arch_id].try(:to_i)
|
@options[:arch_id] = @options[:arch_id].try(:to_i)
|
||||||
@options[:platform_id] = @options[:platform_id].try(:to_i)
|
@options[:platform_id] = @options[:platform_id].try(:to_i)
|
||||||
@options[:is_circle] = @options[:is_circle].present? ? @options[:is_circle] == "1" : nil
|
@options[:is_circle] = @options[:is_circle].present? ? @options[:is_circle] == "1" : nil
|
||||||
@options[:bs_id] = @options[:bs_id].presence
|
@options[:id] = @options[:id].presence
|
||||||
@options[:project_name] = @options[:project_name].presence
|
@options[:project_name] = @options[:project_name].presence
|
||||||
@options[:mass_build_id] = @options[:mass_build_id].presence
|
@options[:mass_build_id] = @options[:mass_build_id].presence
|
||||||
@options[:new_core] = @options[:new_core].presence
|
@options[:new_core] = @options[:new_core].presence
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%tr{:id => "row#{build_list_counter}", :class => "#{build_list_status_color(build_list.status)}"}
|
%tr{:id => "row#{build_list_counter}", :class => "#{build_list_status_color(build_list.status)}"}
|
||||||
%td= link_to (build_list.bs_id.present? ? build_list.bs_id : t("layout.build_lists.bs_id_not_set")), build_list
|
%td= link_to build_list.id, build_list
|
||||||
%td
|
%td
|
||||||
= build_list.human_status
|
= build_list.human_status
|
||||||
%br
|
%br
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
=f.text_field attr, :readonly => "readonly", :size => 10, :class => 'mediumheight min input_cleanse', :value => date
|
=f.text_field attr, :readonly => "readonly", :size => 10, :class => 'mediumheight min input_cleanse', :value => date
|
||||||
=link_to image_tag('x.png', :alt => 'x', :class => 'semi'), "#filter_#{attr}", :id => 'updated_at_clear'
|
=link_to image_tag('x.png', :alt => 'x', :class => 'semi'), "#filter_#{attr}", :id => 'updated_at_clear'
|
||||||
.both
|
.both
|
||||||
-%w[project_name bs_id].each do |filter|
|
-%w[project_name id].each do |filter|
|
||||||
%h3.medium= t "layout.build_lists.#{filter}_search"
|
%h3.medium= t "layout.build_lists.#{filter}_search"
|
||||||
%input.mediumheight.input_cleanse{:id => "filter_#{filter}", :name => "filter[#{filter}]", :size => "30", :type => "text", :value => @filter.send(filter)}
|
%input.mediumheight.input_cleanse{:id => "filter_#{filter}", :name => "filter[#{filter}]", :size => "30", :type => "text", :value => @filter.send(filter)}
|
||||||
%br/
|
%br/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%tr{:id => "row#{platform_build_list_counter}"}
|
%tr{:id => "row#{platform_build_list_counter}"}
|
||||||
%td= link_to (platform_build_list.bs_id.present? ? platform_build_list.bs_id : t("layout.build_lists.bs_id_not_set")), platform_build_list
|
%td= link_to platform_build_list.id, platform_build_list
|
||||||
%td= platform_build_list.human_status
|
%td= platform_build_list.human_status
|
||||||
%td= link_to platform_build_list.project.name, platform_build_list.project
|
%td= link_to platform_build_list.project.name, platform_build_list.project
|
||||||
%td= platform_build_list.updated_at
|
%td= platform_build_list.updated_at
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
%table.tablesorter{:cellpadding => "0", :cellspacing => "0"}
|
%table.tablesorter{:cellpadding => "0", :cellspacing => "0"}
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
%th.lpadding16= t("activerecord.attributes.build_list.bs_id")
|
%th.lpadding16= t("activerecord.attributes.build_list.id")
|
||||||
%th.lpadding16= t("activerecord.attributes.build_list.status")
|
%th.lpadding16= t("activerecord.attributes.build_list.status")
|
||||||
%th.lpadding16= t("activerecord.attributes.build_list.project")
|
%th.lpadding16= t("activerecord.attributes.build_list.project")
|
||||||
%th.lpadding16= t("diff")
|
%th.lpadding16= t("diff")
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
= t("layout.build_lists.creating")
|
= t("layout.build_lists.creating")
|
||||||
.both
|
.both
|
||||||
|
|
||||||
.leftlist= t("activerecord.attributes.build_list.bs_id")
|
.leftlist= t("activerecord.attributes.build_list.id")
|
||||||
.rightlist= @build_list.bs_id.present? ? @build_list.bs_id : t("layout.build_lists.bs_id_not_set")
|
.rightlist= @build_list.id
|
||||||
.both
|
.both
|
||||||
.leftlist= t("activerecord.attributes.build_list.user")
|
.leftlist= t("activerecord.attributes.build_list.user")
|
||||||
.rightlist
|
.rightlist
|
||||||
|
|
|
@ -10,6 +10,6 @@
|
||||||
= "#{@build_list.arch.name}."
|
= "#{@build_list.arch.name}."
|
||||||
%p
|
%p
|
||||||
More detailed information you can get by link:
|
More detailed information you can get by link:
|
||||||
= link_to "task [№ #{@build_list.bs_id ? @build_list.bs_id : t("layout.build_lists.bs_id_not_set")}]", build_list_url(@build_list)
|
= link_to "task [№ #{@build_list.id}]", build_list_url(@build_list)
|
||||||
|
|
||||||
= render 'footer'
|
= render 'footer'
|
||||||
|
|
|
@ -10,6 +10,6 @@
|
||||||
= "#{@build_list.arch.name}."
|
= "#{@build_list.arch.name}."
|
||||||
%p
|
%p
|
||||||
Более подробную информацию можно получить по ссылке:
|
Более подробную информацию можно получить по ссылке:
|
||||||
= link_to "задание [№ #{@build_list.bs_id ? @build_list.bs_id : t("layout.build_lists.bs_id_not_set")}]", build_list_url(@build_list)
|
= link_to "задание [№ #{@build_list.id}]", build_list_url(@build_list)
|
||||||
|
|
||||||
= render 'footer'
|
= render 'footer'
|
||||||
|
|
|
@ -5,7 +5,7 @@ en:
|
||||||
build_list_item: Build list item
|
build_list_item: Build list item
|
||||||
attributes:
|
attributes:
|
||||||
build_list:
|
build_list:
|
||||||
bs_id: Id
|
id: Id
|
||||||
name: Name
|
name: Name
|
||||||
extra_repositories: Extra repositories
|
extra_repositories: Extra repositories
|
||||||
extra_build_lists: Extra build lists
|
extra_build_lists: Extra build lists
|
||||||
|
@ -60,9 +60,8 @@ en:
|
||||||
created_at_end: "Build to start until:"
|
created_at_end: "Build to start until:"
|
||||||
updated_at_start: "Last update from BS on:"
|
updated_at_start: "Last update from BS on:"
|
||||||
updated_at_end: " Last update from BS until:"
|
updated_at_end: " Last update from BS until:"
|
||||||
bs_id_search: 'Search by Id'
|
id_search: 'Search by Id'
|
||||||
project_name_search: Search by project name
|
project_name_search: Search by project name
|
||||||
bs_id_not_set: Id has not been configured yet
|
|
||||||
items_header: Build items
|
items_header: Build items
|
||||||
packages_header: Packages
|
packages_header: Packages
|
||||||
no_items_data: No data
|
no_items_data: No data
|
||||||
|
|
|
@ -5,7 +5,7 @@ ru:
|
||||||
build_list_item: Элемент сборочного листа
|
build_list_item: Элемент сборочного листа
|
||||||
attributes:
|
attributes:
|
||||||
build_list:
|
build_list:
|
||||||
bs_id: Id
|
id: Id
|
||||||
name: Название
|
name: Название
|
||||||
extra_repositories: Дополнительные репозитории
|
extra_repositories: Дополнительные репозитории
|
||||||
extra_build_lists: Дополнительные сборки
|
extra_build_lists: Дополнительные сборки
|
||||||
|
@ -59,9 +59,8 @@ ru:
|
||||||
created_at_end: "Время постановки на сборку по:"
|
created_at_end: "Время постановки на сборку по:"
|
||||||
updated_at_start: "Время последнего обновления от BS с:"
|
updated_at_start: "Время последнего обновления от BS с:"
|
||||||
updated_at_end: "Время последнего обновления от BS по:"
|
updated_at_end: "Время последнего обновления от BS по:"
|
||||||
bs_id_search: 'Поиск по Id'
|
id_search: 'Поиск по Id'
|
||||||
project_name_search: Поиск по названию проекта
|
project_name_search: Поиск по названию проекта
|
||||||
bs_id_not_set: Id еще не присвоен
|
|
||||||
items_header: Элементы сборки
|
items_header: Элементы сборки
|
||||||
packages_header: Пакеты
|
packages_header: Пакеты
|
||||||
no_items_data: Данных нет
|
no_items_data: Данных нет
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
class DropBsIdFromBuildLists < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
remove_index :build_lists, :bs_id
|
||||||
|
remove_column :build_lists, :bs_id
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20130603124853) do
|
ActiveRecord::Schema.define(:version => 20130701121313) do
|
||||||
|
|
||||||
create_table "activity_feeds", :force => true do |t|
|
create_table "activity_feeds", :force => true do |t|
|
||||||
t.integer "user_id", :null => false
|
t.integer "user_id", :null => false
|
||||||
|
@ -104,7 +104,6 @@ ActiveRecord::Schema.define(:version => 20130603124853) do
|
||||||
add_index "build_list_packages", ["project_id"], :name => "index_build_list_packages_on_project_id"
|
add_index "build_list_packages", ["project_id"], :name => "index_build_list_packages_on_project_id"
|
||||||
|
|
||||||
create_table "build_lists", :force => true do |t|
|
create_table "build_lists", :force => true do |t|
|
||||||
t.integer "bs_id"
|
|
||||||
t.integer "status"
|
t.integer "status"
|
||||||
t.string "project_version"
|
t.string "project_version"
|
||||||
t.integer "project_id"
|
t.integer "project_id"
|
||||||
|
@ -142,7 +141,6 @@ ActiveRecord::Schema.define(:version => 20130603124853) do
|
||||||
add_index "build_lists", ["advisory_id"], :name => "index_build_lists_on_advisory_id"
|
add_index "build_lists", ["advisory_id"], :name => "index_build_lists_on_advisory_id"
|
||||||
add_index "build_lists", ["arch_id"], :name => "index_build_lists_on_arch_id"
|
add_index "build_lists", ["arch_id"], :name => "index_build_lists_on_arch_id"
|
||||||
add_index "build_lists", ["project_id", "save_to_repository_id", "build_for_platform_id", "arch_id"], :name => "maintainer_search_index"
|
add_index "build_lists", ["project_id", "save_to_repository_id", "build_for_platform_id", "arch_id"], :name => "maintainer_search_index"
|
||||||
add_index "build_lists", ["bs_id"], :name => "index_build_lists_on_bs_id", :unique => true
|
|
||||||
add_index "build_lists", ["project_id"], :name => "index_build_lists_on_project_id"
|
add_index "build_lists", ["project_id"], :name => "index_build_lists_on_project_id"
|
||||||
|
|
||||||
create_table "comments", :force => true do |t|
|
create_table "comments", :force => true do |t|
|
||||||
|
|
|
@ -17,7 +17,7 @@ module Modules::Observers::ActivityFeed::BuildList
|
||||||
BuildList::FAILED_PUBLISH,
|
BuildList::FAILED_PUBLISH,
|
||||||
BuildList::TESTS_FAILED
|
BuildList::TESTS_FAILED
|
||||||
].include?(status) ||
|
].include?(status) ||
|
||||||
status == BuildList::BUILD_PENDING && bs_id_changed?
|
status == BuildList::BUILD_PENDING
|
||||||
)
|
)
|
||||||
|
|
||||||
updater = publisher || user
|
updater = publisher || user
|
||||||
|
@ -26,7 +26,7 @@ module Modules::Observers::ActivityFeed::BuildList
|
||||||
:user => recipient,
|
:user => recipient,
|
||||||
:kind => 'build_list_notification',
|
:kind => 'build_list_notification',
|
||||||
:data => {
|
:data => {
|
||||||
:task_num => bs_id,
|
:task_num => id,
|
||||||
:build_list_id => id,
|
:build_list_id => id,
|
||||||
:status => status,
|
:status => status,
|
||||||
:updated_at => updated_at,
|
:updated_at => updated_at,
|
||||||
|
|
|
@ -1,58 +1,4 @@
|
||||||
namespace :new_core do
|
namespace :new_core do
|
||||||
desc 'Sets bs_id field for all BuildList which use new_core'
|
|
||||||
task :update_bs_id => :environment do
|
|
||||||
say "[#{Time.zone.now}] Starting to update bs_id..."
|
|
||||||
|
|
||||||
BuildList.select(:id).
|
|
||||||
where(:new_core => true, :bs_id => nil).
|
|
||||||
find_in_batches(:batch_size => 500) do | bls |
|
|
||||||
|
|
||||||
puts "[#{Time.zone.now}] - where build_lists.id from #{bls.first.id} to #{bls.last.id}"
|
|
||||||
BuildList.where(:id => bls.map(&:id), :bs_id => nil).
|
|
||||||
update_all("bs_id = id")
|
|
||||||
end
|
|
||||||
|
|
||||||
say "[#{Time.zone.now}] done"
|
|
||||||
end
|
|
||||||
|
|
||||||
desc 'Publish mass-build 73'
|
|
||||||
task :publish_mass_build_73 => :environment do
|
|
||||||
say "[#{Time.zone.now}] Starting to publish mass-build 317..."
|
|
||||||
|
|
||||||
bl = BuildList.where(:mass_build_id => 73).first
|
|
||||||
platform_repository_folder = "#{bl.save_to_platform.path}/repository"
|
|
||||||
BuildList.where(:mass_build_id => 73).
|
|
||||||
where(:status => [
|
|
||||||
BuildList::SUCCESS,
|
|
||||||
BuildList::FAILED_PUBLISH
|
|
||||||
]).
|
|
||||||
order(:id).
|
|
||||||
find_in_batches(:batch_size => 1) do | bls |
|
|
||||||
|
|
||||||
bl = bls.first
|
|
||||||
puts "[#{Time.zone.now}] - where build_lists.id #{bl.id}"
|
|
||||||
|
|
||||||
sha1 = bl.results.find{ |r| r['file_name'] =~ /.*\.tar\.gz$/ }['sha1']
|
|
||||||
|
|
||||||
system "cd #{platform_repository_folder} && curl -L -O #{APP_CONFIG['file_store_url']}/api/v1/file_stores/#{sha1}"
|
|
||||||
system "cd #{platform_repository_folder} && tar -xzf #{sha1}"
|
|
||||||
system "rm -f #{platform_repository_folder}/#{sha1}"
|
|
||||||
|
|
||||||
archive_folder = "#{platform_repository_folder}/archives"
|
|
||||||
system "sudo chown root:root #{archive_folder}/SRC_RPM/*"
|
|
||||||
system "sudo chmod 0666 #{archive_folder}/SRC_RPM/*"
|
|
||||||
system "sudo chown root:root #{archive_folder}/RPM/*"
|
|
||||||
system "sudo chmod 0666 #{archive_folder}/RPM/*"
|
|
||||||
|
|
||||||
system "sudo mv #{archive_folder}/SRC_RPM/* #{platform_repository_folder}/SRPMS/main/release/"
|
|
||||||
system "sudo mv #{archive_folder}/RPM/* #{platform_repository_folder}/#{bl.arch.name}/main/release/"
|
|
||||||
|
|
||||||
system "sudo rm -rf #{archive_folder}"
|
|
||||||
bl.update_column(:status, BuildList::BUILD_PUBLISH)
|
|
||||||
end
|
|
||||||
|
|
||||||
say "[#{Time.zone.now}] done"
|
|
||||||
end
|
|
||||||
|
|
||||||
desc 'Extracts all rpms from BuildList container and updates BuildList::Package#sha1 field'
|
desc 'Extracts all rpms from BuildList container and updates BuildList::Package#sha1 field'
|
||||||
task :update_packages => :environment do
|
task :update_packages => :environment do
|
||||||
|
|
|
@ -87,7 +87,7 @@ describe Api::V1::AdvisoriesController do
|
||||||
stub_symlink_methods
|
stub_symlink_methods
|
||||||
|
|
||||||
@advisory = FactoryGirl.create(:advisory)
|
@advisory = FactoryGirl.create(:advisory)
|
||||||
@build_list = FactoryGirl.create(:build_list_core)
|
@build_list = FactoryGirl.create(:build_list)
|
||||||
@build_list.save_to_platform.update_column(:released, true)
|
@build_list.save_to_platform.update_column(:released, true)
|
||||||
@build_list.save_to_repository.update_column(:publish_without_qa, false)
|
@build_list.save_to_repository.update_column(:publish_without_qa, false)
|
||||||
@build_list.update_column(:status, BuildList::BUILD_PUBLISHED)
|
@build_list.update_column(:status, BuildList::BUILD_PUBLISHED)
|
||||||
|
|
|
@ -101,7 +101,7 @@ describe Api::V1::BuildListsController do
|
||||||
Arch.destroy_all
|
Arch.destroy_all
|
||||||
User.destroy_all
|
User.destroy_all
|
||||||
|
|
||||||
@build_list = FactoryGirl.create(:build_list_core)
|
@build_list = FactoryGirl.create(:build_list)
|
||||||
@params = @build_list.attributes.symbolize_keys
|
@params = @build_list.attributes.symbolize_keys
|
||||||
@project = @build_list.project
|
@project = @build_list.project
|
||||||
@platform = @build_list.save_to_platform
|
@platform = @build_list.save_to_platform
|
||||||
|
@ -115,8 +115,7 @@ describe Api::V1::BuildListsController do
|
||||||
@build_list.save_to_platform.relations.create(:role => 'admin', :actor => @owner_user) # Why it's really need it??
|
@build_list.save_to_platform.relations.create(:role => 'admin', :actor => @owner_user) # Why it's really need it??
|
||||||
|
|
||||||
# Create and show params:
|
# Create and show params:
|
||||||
@create_params = {:build_list => @build_list.attributes.symbolize_keys.except(:bs_id)
|
@create_params = {:build_list => @build_list.attributes.symbolize_keys.merge(:qwerty=>'!')} # wrong parameter
|
||||||
.merge(:qwerty=>'!')} # wrong parameter
|
|
||||||
@create_params = @create_params.merge(:arches => [@params[:arch_id]], :build_for_platforms => [@params[:build_for_platform_id]], :format => :json)
|
@create_params = @create_params.merge(:arches => [@params[:arch_id]], :build_for_platforms => [@params[:build_for_platform_id]], :format => :json)
|
||||||
any_instance_of(Project, :versions => ['v1.0', 'v2.0'])
|
any_instance_of(Project, :versions => ['v1.0', 'v2.0'])
|
||||||
|
|
||||||
|
@ -499,7 +498,7 @@ describe Api::V1::BuildListsController do
|
||||||
Arch.destroy_all
|
Arch.destroy_all
|
||||||
User.destroy_all
|
User.destroy_all
|
||||||
|
|
||||||
@build_list = FactoryGirl.create(:build_list_core)
|
@build_list = FactoryGirl.create(:build_list)
|
||||||
@params = @build_list.attributes.symbolize_keys
|
@params = @build_list.attributes.symbolize_keys
|
||||||
@project = @build_list.project
|
@project = @build_list.project
|
||||||
@platform = @build_list.save_to_platform
|
@platform = @build_list.save_to_platform
|
||||||
|
@ -510,7 +509,7 @@ describe Api::V1::BuildListsController do
|
||||||
@member_user = FactoryGirl.create(:user)
|
@member_user = FactoryGirl.create(:user)
|
||||||
|
|
||||||
# Create and show params:
|
# Create and show params:
|
||||||
@create_params = {:build_list => @build_list.attributes.symbolize_keys.except(:bs_id)}
|
@create_params = {:build_list => @build_list.attributes.symbolize_keys}
|
||||||
@create_params = @create_params.merge(:arches => [@params[:arch_id]], :build_for_platforms => [@params[:build_for_platform_id]], :format => :json)
|
@create_params = @create_params.merge(:arches => [@params[:arch_id]], :build_for_platforms => [@params[:build_for_platform_id]], :format => :json)
|
||||||
any_instance_of(Project, :versions => ['v1.0', 'v2.0'])
|
any_instance_of(Project, :versions => ['v1.0', 'v2.0'])
|
||||||
|
|
||||||
|
@ -580,22 +579,22 @@ describe Api::V1::BuildListsController do
|
||||||
@user = FactoryGirl.create(:user)
|
@user = FactoryGirl.create(:user)
|
||||||
|
|
||||||
# Build Lists:
|
# Build Lists:
|
||||||
@build_list1 = FactoryGirl.create(:build_list_core)
|
@build_list1 = FactoryGirl.create(:build_list)
|
||||||
|
|
||||||
@build_list2 = FactoryGirl.create(:build_list_core)
|
@build_list2 = FactoryGirl.create(:build_list)
|
||||||
@build_list2.project.update_column(:visibility, 'hidden')
|
@build_list2.project.update_column(:visibility, 'hidden')
|
||||||
|
|
||||||
project = FactoryGirl.create(:project_with_commit, :visibility => 'hidden', :owner => @user)
|
project = FactoryGirl.create(:project_with_commit, :visibility => 'hidden', :owner => @user)
|
||||||
@build_list3 = FactoryGirl.create(:build_list_core_with_attaching_project, :project => project)
|
@build_list3 = FactoryGirl.create(:build_list_with_attaching_project, :project => project)
|
||||||
|
|
||||||
@build_list4 = FactoryGirl.create(:build_list_core)
|
@build_list4 = FactoryGirl.create(:build_list)
|
||||||
@build_list4.project.update_column(:visibility, 'hidden')
|
@build_list4.project.update_column(:visibility, 'hidden')
|
||||||
@build_list4.project.relations.create! :role => 'reader', :actor_id => @user.id, :actor_type => 'User'
|
@build_list4.project.relations.create! :role => 'reader', :actor_id => @user.id, :actor_type => 'User'
|
||||||
|
|
||||||
@filter_build_list1 = FactoryGirl.create(:build_list_core)
|
@filter_build_list1 = FactoryGirl.create(:build_list)
|
||||||
@filter_build_list2 = FactoryGirl.create(:build_list_core)
|
@filter_build_list2 = FactoryGirl.create(:build_list)
|
||||||
@filter_build_list3 = FactoryGirl.create(:build_list_core)
|
@filter_build_list3 = FactoryGirl.create(:build_list)
|
||||||
@filter_build_list4 = FactoryGirl.create(:build_list_core, :updated_at => (Time.now - 1.day),
|
@filter_build_list4 = FactoryGirl.create(:build_list, :updated_at => (Time.now - 1,
|
||||||
:project => @build_list3.project, :save_to_platform => @build_list3.save_to_platform,
|
:project => @build_list3.project, :save_to_platform => @build_list3.save_to_platform,
|
||||||
:arch => @build_list3.arch)
|
:arch => @build_list3.arch)
|
||||||
end
|
end
|
||||||
|
@ -637,8 +636,8 @@ describe Api::V1::BuildListsController do
|
||||||
http_login FactoryGirl.create(:admin)
|
http_login FactoryGirl.create(:admin)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should filter by bs_id' do
|
it 'should filter by id' do
|
||||||
get :index, :filter => {:bs_id => @filter_build_list1.bs_id, :project_name => 'fdsfdf', :any_other_field => 'do not matter'}, :format => :json
|
get :index, :filter => {:id => @filter_build_list1.id, :project_name => 'fdsfdf', :any_other_field => 'do not matter'}, :format => :json
|
||||||
assigns[:build_lists].should include(@filter_build_list1)
|
assigns[:build_lists].should include(@filter_build_list1)
|
||||||
assigns[:build_lists].should_not include(@filter_build_list2)
|
assigns[:build_lists].should_not include(@filter_build_list2)
|
||||||
assigns[:build_lists].should_not include(@filter_build_list3)
|
assigns[:build_lists].should_not include(@filter_build_list3)
|
||||||
|
@ -666,7 +665,7 @@ describe Api::V1::BuildListsController do
|
||||||
|
|
||||||
context "for user" do
|
context "for user" do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
@build_list = FactoryGirl.create(:build_list_core)
|
@build_list = FactoryGirl.create(:build_list)
|
||||||
@params = @build_list.attributes.symbolize_keys
|
@params = @build_list.attributes.symbolize_keys
|
||||||
@project = @build_list.project
|
@project = @build_list.project
|
||||||
|
|
||||||
|
@ -722,7 +721,7 @@ describe Api::V1::BuildListsController do
|
||||||
context "for group" do
|
context "for group" do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
@platform = FactoryGirl.create(:platform_with_repos)
|
@platform = FactoryGirl.create(:platform_with_repos)
|
||||||
@build_list = FactoryGirl.create(:build_list_core, :save_to_platform => @platform)
|
@build_list = FactoryGirl.create(:build_list, :save_to_platform => @platform)
|
||||||
@project = @build_list.project
|
@project = @build_list.project
|
||||||
@params = @build_list.attributes.symbolize_keys
|
@params = @build_list.attributes.symbolize_keys
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ describe AutocompletesController do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'autocomplete_extra_build_list' do
|
context 'autocomplete_extra_build_list' do
|
||||||
let(:build_list) { FactoryGirl.create(:build_list_core, :user => user) }
|
let(:build_list) { FactoryGirl.create(:build_list, :user => user) }
|
||||||
let(:params) { { :term => build_list.id,
|
let(:params) { { :term => build_list.id,
|
||||||
:platform_id => build_list.save_to_platform_id } }
|
:platform_id => build_list.save_to_platform_id } }
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ describe Platforms::MassBuildsController do
|
||||||
}
|
}
|
||||||
|
|
||||||
@mass_build = FactoryGirl.create(:mass_build, :save_to_platform => @platform, :user => @user, :projects_list => project.name)
|
@mass_build = FactoryGirl.create(:mass_build, :save_to_platform => @platform, :user => @user, :projects_list => project.name)
|
||||||
FactoryGirl.create(:build_list_core, :mass_build => @mass_build, :status => BuildList::SUCCESS)
|
FactoryGirl.create(:build_list, :mass_build => @mass_build, :status => BuildList::SUCCESS)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'for guest' do
|
context 'for guest' do
|
||||||
|
|
|
@ -113,7 +113,7 @@ describe Projects::BuildListsController do
|
||||||
context 'for user' do
|
context 'for user' do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
any_instance_of(BuildList, :current_duration => 100)
|
any_instance_of(BuildList, :current_duration => 100)
|
||||||
@build_list = FactoryGirl.create(:build_list_core)
|
@build_list = FactoryGirl.create(:build_list)
|
||||||
@project = @build_list.project
|
@project = @build_list.project
|
||||||
@owner_user = @project.owner
|
@owner_user = @project.owner
|
||||||
@member_user = FactoryGirl.create(:user)
|
@member_user = FactoryGirl.create(:user)
|
||||||
|
@ -223,15 +223,15 @@ describe Projects::BuildListsController do
|
||||||
|
|
||||||
context 'for all build lists' do
|
context 'for all build lists' do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
@build_list1 = FactoryGirl.create(:build_list_core)
|
@build_list1 = FactoryGirl.create(:build_list)
|
||||||
|
|
||||||
@build_list2 = FactoryGirl.create(:build_list_core)
|
@build_list2 = FactoryGirl.create(:build_list)
|
||||||
@build_list2.project.update_column(:visibility, 'hidden')
|
@build_list2.project.update_column(:visibility, 'hidden')
|
||||||
|
|
||||||
project = FactoryGirl.create(:project_with_commit, :visibility => 'hidden', :owner => @user)
|
project = FactoryGirl.create(:project_with_commit, :visibility => 'hidden', :owner => @user)
|
||||||
@build_list3 = FactoryGirl.create(:build_list_core_with_attaching_project, :project => project)
|
@build_list3 = FactoryGirl.create(:build_list_with_attaching_project, :project => project)
|
||||||
|
|
||||||
@build_list4 = FactoryGirl.create(:build_list_core)
|
@build_list4 = FactoryGirl.create(:build_list)
|
||||||
@build_list4.project.update_column(:visibility, 'hidden')
|
@build_list4.project.update_column(:visibility, 'hidden')
|
||||||
@build_list4.project.relations.create! :role => 'reader', :actor_id => @user.id, :actor_type => 'User'
|
@build_list4.project.relations.create! :role => 'reader', :actor_id => @user.id, :actor_type => 'User'
|
||||||
end
|
end
|
||||||
|
@ -312,15 +312,15 @@ describe Projects::BuildListsController do
|
||||||
|
|
||||||
context 'for all build lists' do
|
context 'for all build lists' do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
@build_list1 = FactoryGirl.create(:build_list_core)
|
@build_list1 = FactoryGirl.create(:build_list)
|
||||||
|
|
||||||
@build_list2 = FactoryGirl.create(:build_list_core)
|
@build_list2 = FactoryGirl.create(:build_list)
|
||||||
@build_list2.project.update_column(:visibility, 'hidden')
|
@build_list2.project.update_column(:visibility, 'hidden')
|
||||||
|
|
||||||
project = FactoryGirl.create(:project_with_commit, :visibility => 'hidden', :owner => @user)
|
project = FactoryGirl.create(:project_with_commit, :visibility => 'hidden', :owner => @user)
|
||||||
@build_list3 = FactoryGirl.create(:build_list_core_with_attaching_project, :project => project)
|
@build_list3 = FactoryGirl.create(:build_list_with_attaching_project, :project => project)
|
||||||
|
|
||||||
@build_list4 = FactoryGirl.create(:build_list_core)
|
@build_list4 = FactoryGirl.create(:build_list)
|
||||||
@build_list4.project.update_column(:visibility, 'hidden')
|
@build_list4.project.update_column(:visibility, 'hidden')
|
||||||
@build_list4.project.relations.create! :role => 'reader', :actor_id => @user.id, :actor_type => 'User'
|
@build_list4.project.relations.create! :role => 'reader', :actor_id => @user.id, :actor_type => 'User'
|
||||||
end
|
end
|
||||||
|
@ -386,16 +386,16 @@ describe Projects::BuildListsController do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
set_session_for FactoryGirl.create(:admin)
|
set_session_for FactoryGirl.create(:admin)
|
||||||
|
|
||||||
@build_list1 = FactoryGirl.create(:build_list_core)
|
@build_list1 = FactoryGirl.create(:build_list)
|
||||||
@build_list2 = FactoryGirl.create(:build_list_core)
|
@build_list2 = FactoryGirl.create(:build_list)
|
||||||
@build_list3 = FactoryGirl.create(:build_list_core)
|
@build_list3 = FactoryGirl.create(:build_list)
|
||||||
@build_list4 = FactoryGirl.create(:build_list_core, :updated_at => (Time.now - 1.day),
|
@build_list4 = FactoryGirl.create(:build_list, :updated_at => (Time.now - 1.day),
|
||||||
:project => @build_list3.project, :save_to_platform => @build_list3.save_to_platform,
|
:project => @build_list3.project, :save_to_platform => @build_list3.save_to_platform,
|
||||||
:arch => @build_list3.arch)
|
:arch => @build_list3.arch)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should filter by bs_id' do
|
it 'should filter by id' do
|
||||||
get :index, :filter => {:bs_id => @build_list1.bs_id, :project_name => 'fdsfdf', :any_other_field => 'do not matter'}
|
get :index, :filter => {:id => @build_list1.id, :project_name => 'fdsfdf', :any_other_field => 'do not matter'}
|
||||||
assigns[:build_lists].should include(@build_list1)
|
assigns[:build_lists].should include(@build_list1)
|
||||||
assigns[:build_lists].should_not include(@build_list2)
|
assigns[:build_lists].should_not include(@build_list2)
|
||||||
assigns[:build_lists].should_not include(@build_list3)
|
assigns[:build_lists].should_not include(@build_list3)
|
||||||
|
|
|
@ -22,15 +22,7 @@ FactoryGirl.define do
|
||||||
before(:create) { |bl| attach_project_to_build_list bl }
|
before(:create) { |bl| attach_project_to_build_list bl }
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :build_list_core, :parent => :build_list do
|
factory :build_list_by_group_project, :parent => :build_list do
|
||||||
bs_id { FactoryGirl.generate(:integer) }
|
|
||||||
end
|
|
||||||
|
|
||||||
factory :build_list_core_with_attaching_project, :parent => :build_list_core do
|
|
||||||
before(:create) { |bl| attach_project_to_build_list bl }
|
|
||||||
end
|
|
||||||
|
|
||||||
factory :build_list_by_group_project, :parent => :build_list_core do
|
|
||||||
project { |bl|
|
project { |bl|
|
||||||
pr = FactoryGirl.create(:group_project_with_commit)
|
pr = FactoryGirl.create(:group_project_with_commit)
|
||||||
bl.save_to_platform.repositories.first.projects << pr
|
bl.save_to_platform.repositories.first.projects << pr
|
||||||
|
|
|
@ -9,11 +9,11 @@ describe AbfWorker::BuildListsPublishTaskManager do
|
||||||
before do
|
before do
|
||||||
init_test_root
|
init_test_root
|
||||||
stub_symlink_methods
|
stub_symlink_methods
|
||||||
FactoryGirl.create(:build_list_core, :new_core => true)
|
FactoryGirl.create(:build_list)
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { AbfWorker::BuildListsPublishTaskManager }
|
subject { AbfWorker::BuildListsPublishTaskManager }
|
||||||
let(:build_list) { FactoryGirl.create(:build_list_core, :new_core => true) }
|
let(:build_list) { FactoryGirl.create(:build_list) }
|
||||||
|
|
||||||
context 'when no items for publishing' do
|
context 'when no items for publishing' do
|
||||||
before do
|
before do
|
||||||
|
@ -76,7 +76,7 @@ describe AbfWorker::BuildListsPublishTaskManager do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'grouping build lists for publishing into same repository' do
|
context 'grouping build lists for publishing into same repository' do
|
||||||
let(:build_list2) { FactoryGirl.create(:build_list_core,
|
let(:build_list2) { FactoryGirl.create(:build_list,
|
||||||
:new_core => true,
|
:new_core => true,
|
||||||
:save_to_platform => build_list.save_to_platform,
|
:save_to_platform => build_list.save_to_platform,
|
||||||
:save_to_repository => build_list.save_to_repository,
|
:save_to_repository => build_list.save_to_repository,
|
||||||
|
@ -122,7 +122,7 @@ describe AbfWorker::BuildListsPublishTaskManager do
|
||||||
stub_redis
|
stub_redis
|
||||||
build_list.update_column(:status, BuildList::BUILD_PUBLISH)
|
build_list.update_column(:status, BuildList::BUILD_PUBLISH)
|
||||||
4.times {
|
4.times {
|
||||||
bl = FactoryGirl.create(:build_list_core, :new_core => true)
|
bl = FactoryGirl.create(:build_list, :new_core => true)
|
||||||
bl.update_column(:status, BuildList::BUILD_PUBLISH)
|
bl.update_column(:status, BuildList::BUILD_PUBLISH)
|
||||||
}
|
}
|
||||||
2.times{ subject.new.run }
|
2.times{ subject.new.run }
|
||||||
|
@ -180,13 +180,13 @@ describe AbfWorker::BuildListsPublishTaskManager do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'grouping build lists for publishing and tasks for removing project from repository' do
|
context 'grouping build lists for publishing and tasks for removing project from repository' do
|
||||||
let(:build_list2) { FactoryGirl.create(:build_list_core,
|
let(:build_list2) { FactoryGirl.create(:build_list,
|
||||||
:new_core => true,
|
:new_core => true,
|
||||||
:save_to_platform => build_list.save_to_platform,
|
:save_to_platform => build_list.save_to_platform,
|
||||||
:save_to_repository => build_list.save_to_repository,
|
:save_to_repository => build_list.save_to_repository,
|
||||||
:build_for_platform => build_list.build_for_platform
|
:build_for_platform => build_list.build_for_platform
|
||||||
) }
|
) }
|
||||||
let(:build_list3) { FactoryGirl.create(:build_list_core,
|
let(:build_list3) { FactoryGirl.create(:build_list,
|
||||||
:new_core => true,
|
:new_core => true,
|
||||||
:save_to_platform => build_list.save_to_platform,
|
:save_to_platform => build_list.save_to_platform,
|
||||||
:save_to_repository => build_list.save_to_repository,
|
:save_to_repository => build_list.save_to_repository,
|
||||||
|
|
|
@ -18,7 +18,7 @@ describe BuildList do
|
||||||
context "#notify_users" do
|
context "#notify_users" do
|
||||||
before { stub_symlink_methods }
|
before { stub_symlink_methods }
|
||||||
let!(:user) { FactoryGirl.create(:user) }
|
let!(:user) { FactoryGirl.create(:user) }
|
||||||
let!(:build_list) { FactoryGirl.create(:build_list_core,
|
let!(:build_list) { FactoryGirl.create(:build_list,
|
||||||
:user => user,
|
:user => user,
|
||||||
:auto_publish => false) }
|
:auto_publish => false) }
|
||||||
let!(:build_list_package) { FactoryGirl.create(:build_list_package,
|
let!(:build_list_package) { FactoryGirl.create(:build_list_package,
|
||||||
|
@ -141,7 +141,7 @@ describe BuildList do
|
||||||
|
|
||||||
it "doesn't get 2 notification by email when user associated to project and created task" do
|
it "doesn't get 2 notification by email when user associated to project and created task" do
|
||||||
project = FactoryGirl.create(:project_with_commit, :owner => user)
|
project = FactoryGirl.create(:project_with_commit, :owner => user)
|
||||||
bl = FactoryGirl.create(:build_list_core_with_attaching_project,
|
bl = FactoryGirl.create(:build_list_with_attaching_project,
|
||||||
:user => user,
|
:user => user,
|
||||||
:auto_publish => true,
|
:auto_publish => true,
|
||||||
:project => project
|
:project => project
|
||||||
|
|
Loading…
Reference in New Issue