Skip to content
Snippets Groups Projects
Verified Commit 803a596a authored by Timo Furrer's avatar Timo Furrer :juggling:
Browse files

Move Receptive Agents URL config relationship to EE

parent 5cbce1f4
1 merge request!164184Move Receptive Agents feature to Ultimate
......@@ -17,8 +17,6 @@ class Agent < ApplicationRecord
has_many :agent_tokens, -> { order_last_used_at_desc }, class_name: 'Clusters::AgentToken', inverse_of: :agent
has_many :active_agent_tokens, -> { active.order_last_used_at_desc }, class_name: 'Clusters::AgentToken', inverse_of: :agent
has_one :agent_url_configuration, class_name: 'Clusters::Agents::UrlConfiguration', inverse_of: :agent
has_many :ci_access_group_authorizations, class_name: 'Clusters::Agents::Authorizations::CiAccess::GroupAuthorization'
has_many :ci_access_authorized_groups, class_name: '::Group', through: :ci_access_group_authorizations, source: :group
......
......@@ -6,6 +6,8 @@ module Agent
extend ActiveSupport::Concern
prepended do
has_one :agent_url_configuration, class_name: 'Clusters::Agents::UrlConfiguration', inverse_of: :agent
has_many :vulnerability_reads, class_name: 'Vulnerabilities::Read', foreign_key: :casted_cluster_agent_id
has_many :workspaces,
......
......@@ -10,6 +10,12 @@
it { is_expected.to include_module(EE::Clusters::Agent) }
it { is_expected.to have_many(:vulnerability_reads) }
it do
is_expected.to have_one(:agent_url_configuration)
.class_name('Clusters::Agents::UrlConfiguration')
.inverse_of(:agent)
end
describe '.for_projects' do
it 'return agents for selected projects' do
expect(described_class.for_projects([agent_1.project, agent_3.project])).to contain_exactly(agent_1, agent_3)
......
......@@ -14,7 +14,6 @@
it { is_expected.to have_many(:ci_access_project_authorizations).class_name('Clusters::Agents::Authorizations::CiAccess::ProjectAuthorization') }
it { is_expected.to have_many(:ci_access_authorized_projects).through(:ci_access_project_authorizations).class_name('::Project') }
it { is_expected.to have_many(:environments).class_name('::Environment') }
it { is_expected.to have_one(:agent_url_configuration).class_name('Clusters::Agents::UrlConfiguration').inverse_of(:agent) }
it { is_expected.to validate_presence_of(:name) }
it { is_expected.to validate_length_of(:name).is_at_most(63) }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment