Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-05-11 11:13:27 +0300
committerKamil Trzciński <ayufan@ayufan.eu>2018-05-11 11:13:27 +0300
commitf91aaccf4d0c182c01046ba38cbd9ed30b9d3684 (patch)
tree417d751687f9905e9db74b8b0945ea789fd645cc /spec/models
parente6b8f89d280292d24ec4c3ec586933df1474cae7 (diff)
parentcd834b46a8b84eaf14891854925502800acff475 (diff)
Merge branch 'correct-runner-type-when-assigning-shared-to-project' into 'master'
Ensure runner_type is updated correctly when assigning shared runner to project See merge request gitlab-org/gitlab-ce!18874
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/ci/runner_spec.rb26
1 files changed, 20 insertions, 6 deletions
diff --git a/spec/models/ci/runner_spec.rb b/spec/models/ci/runner_spec.rb
index eb59ba7cbe9..e2b212f4f4c 100644
--- a/spec/models/ci/runner_spec.rb
+++ b/spec/models/ci/runner_spec.rb
@@ -200,15 +200,29 @@ describe Ci::Runner do
describe '#assign_to' do
let!(:project) { FactoryBot.create(:project) }
- let!(:shared_runner) { FactoryBot.create(:ci_runner, :shared) }
- before do
- shared_runner.assign_to(project)
+ subject { runner.assign_to(project) }
+
+ context 'with shared_runner' do
+ let!(:runner) { FactoryBot.create(:ci_runner, :shared) }
+
+ it 'transitions shared runner to project runner and assigns project' do
+ subject
+ expect(runner).to be_specific
+ expect(runner).to be_project_type
+ expect(runner.projects).to eq([project])
+ expect(runner.only_for?(project)).to be_truthy
+ end
end
- it { expect(shared_runner).to be_specific }
- it { expect(shared_runner.projects).to eq([project]) }
- it { expect(shared_runner.only_for?(project)).to be_truthy }
+ context 'with group runner' do
+ let!(:runner) { FactoryBot.create(:ci_runner, runner_type: :group_type) }
+
+ it 'raises an error' do
+ expect { subject }
+ .to raise_error(ArgumentError, 'Transitioning a group runner to a project runner is not supported')
+ end
+ end
end
describe '.online' do