From a57c953e0e6ca03f929fb59f13307405822dfcb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Trzci=C5=84ski?= Date: Tue, 8 May 2018 22:39:28 +0200 Subject: [PATCH] Set `runner_type` for cluster/application --- app/models/clusters/applications/runner.rb | 10 +++++++++- spec/models/clusters/applications/runner_spec.rb | 3 +-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/models/clusters/applications/runner.rb b/app/models/clusters/applications/runner.rb index 16efe90fa27..b881b4eaf36 100644 --- a/app/models/clusters/applications/runner.rb +++ b/app/models/clusters/applications/runner.rb @@ -43,12 +43,20 @@ module Clusters def create_and_assign_runner transaction do - project.runners.create!(name: 'kubernetes-cluster', tag_list: %w(kubernetes cluster)).tap do |runner| + project.runners.create!(runner_create_params).tap do |runner| update!(runner_id: runner.id) end end end + def runner_create_params + { + name: 'kubernetes-cluster', + runner_type: :project_type, + tag_list: %w(kubernetes cluster) + } + end + def gitlab_url Gitlab::Routing.url_helpers.root_url(only_path: false) end diff --git a/spec/models/clusters/applications/runner_spec.rb b/spec/models/clusters/applications/runner_spec.rb index 64d995a73c1..5f2c723d483 100644 --- a/spec/models/clusters/applications/runner_spec.rb +++ b/spec/models/clusters/applications/runner_spec.rb @@ -74,9 +74,8 @@ describe Clusters::Applications::Runner do it 'assigns the new runner to runner' do subject - gitlab_runner.reload - expect(gitlab_runner.runner).not_to be_nil + expect(gitlab_runner.reload.runner).to be_project_type end end