2015-09-25 12:07:36 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe "Runners" do
|
2015-10-24 18:46:33 +05:30
|
|
|
include GitlabRoutingHelper
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2015-10-24 18:46:33 +05:30
|
|
|
let(:user) { create(:user) }
|
|
|
|
before { login_as(user) }
|
2015-09-25 12:07:36 +05:30
|
|
|
|
|
|
|
describe "specific runners" do
|
|
|
|
before do
|
2015-12-23 02:04:40 +05:30
|
|
|
@project = FactoryGirl.create :empty_project, shared_runners_enabled: false
|
|
|
|
@project.team << [user, :master]
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2015-12-23 02:04:40 +05:30
|
|
|
@project2 = FactoryGirl.create :empty_project
|
|
|
|
@project2.team << [user, :master]
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2015-12-23 02:04:40 +05:30
|
|
|
@project3 = FactoryGirl.create :empty_project
|
|
|
|
@project3.team << [user, :developer]
|
2015-11-26 14:37:03 +05:30
|
|
|
|
2016-04-02 18:10:28 +05:30
|
|
|
@shared_runner = FactoryGirl.create :ci_runner, :shared
|
|
|
|
@specific_runner = FactoryGirl.create :ci_runner
|
|
|
|
@specific_runner2 = FactoryGirl.create :ci_runner
|
|
|
|
@specific_runner3 = FactoryGirl.create :ci_runner
|
2015-09-25 12:07:36 +05:30
|
|
|
@project.runners << @specific_runner
|
|
|
|
@project2.runners << @specific_runner2
|
2015-11-26 14:37:03 +05:30
|
|
|
@project3.runners << @specific_runner3
|
2015-10-24 18:46:33 +05:30
|
|
|
|
2015-12-23 02:04:40 +05:30
|
|
|
visit runners_path(@project)
|
2015-09-25 12:07:36 +05:30
|
|
|
end
|
|
|
|
|
2015-11-26 14:37:03 +05:30
|
|
|
before do
|
|
|
|
expect(page).to_not have_content(@specific_runner3.display_name)
|
|
|
|
expect(page).to_not have_content(@specific_runner3.display_name)
|
|
|
|
end
|
|
|
|
|
2015-09-25 12:07:36 +05:30
|
|
|
it "places runners in right places" do
|
|
|
|
expect(page.find(".available-specific-runners")).to have_content(@specific_runner2.display_name)
|
|
|
|
expect(page.find(".activated-specific-runners")).to have_content(@specific_runner.display_name)
|
|
|
|
expect(page.find(".available-shared-runners")).to have_content(@shared_runner.display_name)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "enables specific runner for project" do
|
|
|
|
within ".available-specific-runners" do
|
|
|
|
click_on "Enable for this project"
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(page.find(".activated-specific-runners")).to have_content(@specific_runner2.display_name)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "disables specific runner for project" do
|
|
|
|
@project2.runners << @specific_runner
|
2015-12-23 02:04:40 +05:30
|
|
|
visit runners_path(@project)
|
2015-09-25 12:07:36 +05:30
|
|
|
|
|
|
|
within ".activated-specific-runners" do
|
|
|
|
click_on "Disable for this project"
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(page.find(".available-specific-runners")).to have_content(@specific_runner.display_name)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "removes specific runner for project if this is last project for that runners" do
|
|
|
|
within ".activated-specific-runners" do
|
|
|
|
click_on "Remove runner"
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(Ci::Runner.exists?(id: @specific_runner)).to be_falsey
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "shared runners" do
|
|
|
|
before do
|
2015-12-23 02:04:40 +05:30
|
|
|
@project = FactoryGirl.create :empty_project, shared_runners_enabled: false
|
|
|
|
@project.team << [user, :master]
|
|
|
|
visit runners_path(@project)
|
2015-09-25 12:07:36 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it "enables shared runners" do
|
|
|
|
click_on "Enable shared runners"
|
|
|
|
expect(@project.reload.shared_runners_enabled).to be_truthy
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "show page" do
|
|
|
|
before do
|
2015-12-23 02:04:40 +05:30
|
|
|
@project = FactoryGirl.create :empty_project
|
|
|
|
@project.team << [user, :master]
|
2016-04-02 18:10:28 +05:30
|
|
|
@specific_runner = FactoryGirl.create :ci_runner
|
2015-09-25 12:07:36 +05:30
|
|
|
@project.runners << @specific_runner
|
|
|
|
end
|
|
|
|
|
|
|
|
it "shows runner information" do
|
2015-12-23 02:04:40 +05:30
|
|
|
visit runners_path(@project)
|
2015-09-25 12:07:36 +05:30
|
|
|
click_on @specific_runner.short_sha
|
|
|
|
expect(page).to have_content(@specific_runner.platform)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|