From fc3619f54f49058c5247ee528a4765a5262228c0 Mon Sep 17 00:00:00 2001 From: Cindy Halim Date: Thu, 22 May 2025 23:45:48 +0900 Subject: [PATCH 1/5] Add filter `ALL` to cluster agents query Add filter to query all cluster agents belonging to a given namespace. Changelog: added EE: true --- doc/api/graphql/reference/_index.md | 1 + .../namespace_cluster_agents_finder.rb | 5 +++++ .../organization_cluster_agents_finder.rb | 3 +++ .../namespace_cluster_agent_filter_enum.rb | 3 +++ .../namespace_cluster_agents_finder_spec.rb | 11 +++++++++++ .../organization_cluster_agents_finder_spec.rb | 12 ++++++++++++ 6 files changed, 35 insertions(+) diff --git a/doc/api/graphql/reference/_index.md b/doc/api/graphql/reference/_index.md index 0a102cce2fbba3..549c19c1f57524 100644 --- a/doc/api/graphql/reference/_index.md +++ b/doc/api/graphql/reference/_index.md @@ -45208,6 +45208,7 @@ Possible filter types for remote development cluster agents in a namespace. | Value | Description | | ----- | ----------- | +| `ALL` | All cluster agents in the namespace. | | `AVAILABLE` | Cluster agents in the namespace that can be used for hosting workspaces. | | `DIRECTLY_MAPPED` | Cluster agents that are directly mapped to the given namespace. | | `UNMAPPED` | Cluster agents within a namespace that are not directly mapped to it. | diff --git a/ee/app/finders/remote_development/namespace_cluster_agents_finder.rb b/ee/app/finders/remote_development/namespace_cluster_agents_finder.rb index 5d899fc46c3de7..90f466238f9bc3 100644 --- a/ee/app/finders/remote_development/namespace_cluster_agents_finder.rb +++ b/ee/app/finders/remote_development/namespace_cluster_agents_finder.rb @@ -18,6 +18,11 @@ def self.execute(namespace:, filter:, user:) # @return [ActiveRecord::Relation] def self.fetch_agents(namespace:, filter:, user:) case filter + when :all + return Clusters::Agent.none unless user_can_read_namespace_agent_mappings?(user: user, namespace: namespace) + + # Returns all agents regardless of mapping and whether they have remote development enabled + namespace.cluster_agents when :unmapped return Clusters::Agent.none unless user_can_read_namespace_agent_mappings?(user: user, namespace: namespace) diff --git a/ee/app/finders/remote_development/organization_cluster_agents_finder.rb b/ee/app/finders/remote_development/organization_cluster_agents_finder.rb index cefac8fdb933ac..5d92b4e91944c2 100644 --- a/ee/app/finders/remote_development/organization_cluster_agents_finder.rb +++ b/ee/app/finders/remote_development/organization_cluster_agents_finder.rb @@ -18,6 +18,9 @@ def self.execute(organization:, filter:, user:) # @return [ActiveRecord::Relation] def self.fetch_agents(organization:, filter:) case filter + when :all + # Returns all agents regardless of mapping and whether they have remote development enabled + Clusters::Agent.for_organizations([organization.id]) when :unmapped # rubocop: disable CodeReuse/ActiveRecord -- activerecord is convenient for filtering for records # noinspection RailsParamDefResolve -- RubyMine is not finding organization_cluster_agent_mapping diff --git a/ee/app/graphql/types/remote_development/namespace_cluster_agent_filter_enum.rb b/ee/app/graphql/types/remote_development/namespace_cluster_agent_filter_enum.rb index 71aead69e0d40d..f17c889e170851 100644 --- a/ee/app/graphql/types/remote_development/namespace_cluster_agent_filter_enum.rb +++ b/ee/app/graphql/types/remote_development/namespace_cluster_agent_filter_enum.rb @@ -14,6 +14,9 @@ class NamespaceClusterAgentFilterEnum < BaseEnum value 'UNMAPPED', description: "Cluster agents within a namespace that are not directly mapped to it.", value: 'UNMAPPED' + + value 'ALL', + description: "All cluster agents in the namespace.", value: 'ALL' end end end diff --git a/ee/spec/finders/remote_development/namespace_cluster_agents_finder_spec.rb b/ee/spec/finders/remote_development/namespace_cluster_agents_finder_spec.rb index 04645897338c21..a894a91d1f0292 100644 --- a/ee/spec/finders/remote_development/namespace_cluster_agents_finder_spec.rb +++ b/ee/spec/finders/remote_development/namespace_cluster_agents_finder_spec.rb @@ -165,6 +165,17 @@ end end + context 'with filter_type set to all' do + let(:filter) { :all } + let_it_be(:user) { maintainer } + + it 'returns all cluster agents within a namespace' do + # Returns all agents for the namespace regardless of mapping and whether they have remote development enabled + expect(response).to match_array([root_agent, root_agent_with_remote_dev_disabled, nested_agent, + unmapped_root_agent]) + end + end + context 'with an invalid value for filter_type' do let(:filter) { "some_invalid_value" } diff --git a/ee/spec/finders/remote_development/organization_cluster_agents_finder_spec.rb b/ee/spec/finders/remote_development/organization_cluster_agents_finder_spec.rb index 3955829efe8c5d..164dd591a6a0df 100644 --- a/ee/spec/finders/remote_development/organization_cluster_agents_finder_spec.rb +++ b/ee/spec/finders/remote_development/organization_cluster_agents_finder_spec.rb @@ -79,6 +79,18 @@ end end + context 'with filter_type set to all' do + let(:filter) { :all } + + it "returns all cluster agents within the organization" do + expect(response).to match_array([ + mapped_agent_in_org, + agent_in_org_with_remote_dev_disabled, + unmapped_agent_in_org + ]) + end + end + context 'with an invalid value for filter_type' do let(:filter) { "some_invalid_value" } -- GitLab From b72b7bd2054e10aca1443e05c933e18261436d6c Mon Sep 17 00:00:00 2001 From: Cindy Halim Date: Thu, 29 May 2025 11:08:24 +0900 Subject: [PATCH 2/5] Order agents by name --- .../remote_development/organization_cluster_agents_finder.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ee/app/finders/remote_development/organization_cluster_agents_finder.rb b/ee/app/finders/remote_development/organization_cluster_agents_finder.rb index 5d92b4e91944c2..7edfc469567aa7 100644 --- a/ee/app/finders/remote_development/organization_cluster_agents_finder.rb +++ b/ee/app/finders/remote_development/organization_cluster_agents_finder.rb @@ -10,7 +10,7 @@ def self.execute(organization:, filter:, user:) return Clusters::Agent.none unless organization && user.can?(:read_organization_cluster_agent_mapping, organization) - fetch_agents(filter: filter, organization: organization) + fetch_agents(filter: filter, organization: organization).ordered_by_name end # @param [RemoteDevelopment::Organization] organization -- GitLab From 721497d8f9dbff2ebf65c0347a91653d4dff0bdf Mon Sep 17 00:00:00 2001 From: Cindy Halim Date: Fri, 30 May 2025 11:20:39 +0900 Subject: [PATCH 3/5] Update specs --- .../namespace_cluster_agents_finder_spec.rb | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/ee/spec/finders/remote_development/namespace_cluster_agents_finder_spec.rb b/ee/spec/finders/remote_development/namespace_cluster_agents_finder_spec.rb index a894a91d1f0292..ad97e198de8a68 100644 --- a/ee/spec/finders/remote_development/namespace_cluster_agents_finder_spec.rb +++ b/ee/spec/finders/remote_development/namespace_cluster_agents_finder_spec.rb @@ -81,6 +81,14 @@ ).to_a end + shared_examples 'when user does not have adequate permissions' do + let(:user) { developer } + + it 'returns an empty response' do + expect(response).to eq([]) + end + end + context 'with filter_type set to available' do context 'when cluster agents are mapped to the namespace' do it 'returns cluster agents mapped to the namespace excluding those with remote dev disabled' do @@ -129,13 +137,7 @@ end end - context 'when user does not have adequate permissions' do - let(:user) { developer } - - it 'returns an empty response' do - expect(response).to eq([]) - end - end + it_behaves_like 'when user does not have adequate permissions' end context 'with filter_type set to unmapped' do @@ -156,13 +158,7 @@ end end - context 'when user does not have adequate permissions' do - let(:user) { developer } - - it 'returns an empty response' do - expect(response).to eq([]) - end - end + it_behaves_like 'when user does not have adequate permissions' end context 'with filter_type set to all' do @@ -174,6 +170,8 @@ expect(response).to match_array([root_agent, root_agent_with_remote_dev_disabled, nested_agent, unmapped_root_agent]) end + + it_behaves_like 'when user does not have adequate permissions' end context 'with an invalid value for filter_type' do -- GitLab From 0e5f118f185c40ecddeae33d187844ba833e7631 Mon Sep 17 00:00:00 2001 From: Cindy Halim Date: Tue, 3 Jun 2025 17:24:45 +0900 Subject: [PATCH 4/5] Filter for all with remote development enabled --- doc/api/graphql/reference/_index.md | 2 +- .../remote_development/namespace_cluster_agents_finder.rb | 4 ++-- .../organization_cluster_agents_finder.rb | 4 ++-- .../namespace_cluster_agent_filter_enum.rb | 2 +- .../namespace_cluster_agents_finder_spec.rb | 4 +--- .../organization_cluster_agents_finder_spec.rb | 8 ++------ 6 files changed, 9 insertions(+), 15 deletions(-) diff --git a/doc/api/graphql/reference/_index.md b/doc/api/graphql/reference/_index.md index 549c19c1f57524..20b2c0d39b6369 100644 --- a/doc/api/graphql/reference/_index.md +++ b/doc/api/graphql/reference/_index.md @@ -45208,7 +45208,7 @@ Possible filter types for remote development cluster agents in a namespace. | Value | Description | | ----- | ----------- | -| `ALL` | All cluster agents in the namespace. | +| `ALL` | All cluster agents in the namespace that can be used for hosting worksapces. | | `AVAILABLE` | Cluster agents in the namespace that can be used for hosting workspaces. | | `DIRECTLY_MAPPED` | Cluster agents that are directly mapped to the given namespace. | | `UNMAPPED` | Cluster agents within a namespace that are not directly mapped to it. | diff --git a/ee/app/finders/remote_development/namespace_cluster_agents_finder.rb b/ee/app/finders/remote_development/namespace_cluster_agents_finder.rb index 90f466238f9bc3..f450b725aba09c 100644 --- a/ee/app/finders/remote_development/namespace_cluster_agents_finder.rb +++ b/ee/app/finders/remote_development/namespace_cluster_agents_finder.rb @@ -21,8 +21,8 @@ def self.fetch_agents(namespace:, filter:, user:) when :all return Clusters::Agent.none unless user_can_read_namespace_agent_mappings?(user: user, namespace: namespace) - # Returns all agents regardless of mapping and whether they have remote development enabled - namespace.cluster_agents + # Returns all agents with remote development enabled + namespace.cluster_agents.with_remote_development_enabled when :unmapped return Clusters::Agent.none unless user_can_read_namespace_agent_mappings?(user: user, namespace: namespace) diff --git a/ee/app/finders/remote_development/organization_cluster_agents_finder.rb b/ee/app/finders/remote_development/organization_cluster_agents_finder.rb index 7edfc469567aa7..f64fe45b362179 100644 --- a/ee/app/finders/remote_development/organization_cluster_agents_finder.rb +++ b/ee/app/finders/remote_development/organization_cluster_agents_finder.rb @@ -19,8 +19,8 @@ def self.execute(organization:, filter:, user:) def self.fetch_agents(organization:, filter:) case filter when :all - # Returns all agents regardless of mapping and whether they have remote development enabled - Clusters::Agent.for_organizations([organization.id]) + # Returns all agents that have remote development enabled + Clusters::Agent.for_organizations([organization.id]).with_remote_development_enabled when :unmapped # rubocop: disable CodeReuse/ActiveRecord -- activerecord is convenient for filtering for records # noinspection RailsParamDefResolve -- RubyMine is not finding organization_cluster_agent_mapping diff --git a/ee/app/graphql/types/remote_development/namespace_cluster_agent_filter_enum.rb b/ee/app/graphql/types/remote_development/namespace_cluster_agent_filter_enum.rb index f17c889e170851..0c73b98e51a9c7 100644 --- a/ee/app/graphql/types/remote_development/namespace_cluster_agent_filter_enum.rb +++ b/ee/app/graphql/types/remote_development/namespace_cluster_agent_filter_enum.rb @@ -16,7 +16,7 @@ class NamespaceClusterAgentFilterEnum < BaseEnum description: "Cluster agents within a namespace that are not directly mapped to it.", value: 'UNMAPPED' value 'ALL', - description: "All cluster agents in the namespace.", value: 'ALL' + description: "All cluster agents in the namespace that can be used for hosting worksapces.", value: 'ALL' end end end diff --git a/ee/spec/finders/remote_development/namespace_cluster_agents_finder_spec.rb b/ee/spec/finders/remote_development/namespace_cluster_agents_finder_spec.rb index ad97e198de8a68..4d6611566aff88 100644 --- a/ee/spec/finders/remote_development/namespace_cluster_agents_finder_spec.rb +++ b/ee/spec/finders/remote_development/namespace_cluster_agents_finder_spec.rb @@ -166,9 +166,7 @@ let_it_be(:user) { maintainer } it 'returns all cluster agents within a namespace' do - # Returns all agents for the namespace regardless of mapping and whether they have remote development enabled - expect(response).to match_array([root_agent, root_agent_with_remote_dev_disabled, nested_agent, - unmapped_root_agent]) + expect(response).to match_array([root_agent, nested_agent, unmapped_root_agent]) end it_behaves_like 'when user does not have adequate permissions' diff --git a/ee/spec/finders/remote_development/organization_cluster_agents_finder_spec.rb b/ee/spec/finders/remote_development/organization_cluster_agents_finder_spec.rb index 164dd591a6a0df..90d7faa17c6a08 100644 --- a/ee/spec/finders/remote_development/organization_cluster_agents_finder_spec.rb +++ b/ee/spec/finders/remote_development/organization_cluster_agents_finder_spec.rb @@ -82,12 +82,8 @@ context 'with filter_type set to all' do let(:filter) { :all } - it "returns all cluster agents within the organization" do - expect(response).to match_array([ - mapped_agent_in_org, - agent_in_org_with_remote_dev_disabled, - unmapped_agent_in_org - ]) + it "returns all cluster agents with remote development enabled within the organization" do + expect(response).to match_array([mapped_agent_in_org, unmapped_agent_in_org]) end end -- GitLab From 5bc08d1801da734ab05bab6544d5eb74ae464c67 Mon Sep 17 00:00:00 2001 From: Cindy Halim Date: Thu, 5 Jun 2025 17:52:48 +0900 Subject: [PATCH 5/5] Remove unmapped and available filters The organization's workspacesClusterAgents field will return agents that have workspaces enabled in their configuration. `AVAILABLE` filter is removed as it now serves the same functionality as the existing `DIRECTLY_MAPPED` filter. `UNMAPPED` filter is removed as there is no current use case for it. --- doc/api/graphql/reference/_index.md | 11 ++++++- .../organization_cluster_agents_finder.rb | 10 ------- .../organization/cluster_agents_resolver.rb | 2 +- .../organization_cluster_agent_filter_enum.rb | 16 ++++++++++ ...organization_cluster_agents_finder_spec.rb | 30 ++----------------- .../workspaces_cluster_agents/shared.rb | 16 ++-------- ...rg_spec.rb => with_all_filter_arg_spec.rb} | 6 ++-- .../with_directly_mapped_filter_arg_spec.rb | 2 +- .../with_unmapped_filter_arg_spec.rb | 14 --------- scripts/verify-tff-mapping | 2 +- 10 files changed, 37 insertions(+), 72 deletions(-) create mode 100644 ee/app/graphql/types/remote_development/organization_cluster_agent_filter_enum.rb rename ee/spec/requests/api/graphql/remote_development/organization/workspaces_cluster_agents/{with_available_filter_arg_spec.rb => with_all_filter_arg_spec.rb} (73%) delete mode 100644 ee/spec/requests/api/graphql/remote_development/organization/workspaces_cluster_agents/with_unmapped_filter_arg_spec.rb diff --git a/doc/api/graphql/reference/_index.md b/doc/api/graphql/reference/_index.md index 20b2c0d39b6369..03acc8a50a6dc2 100644 --- a/doc/api/graphql/reference/_index.md +++ b/doc/api/graphql/reference/_index.md @@ -34178,7 +34178,7 @@ four standard [pagination arguments](#pagination-arguments): | Name | Type | Description | | ---- | ---- | ----------- | -| `filter` | [`NamespaceClusterAgentFilter!`](#namespaceclusteragentfilter) | Filter the types of cluster agents to return. | +| `filter` | [`OrganizationClusterAgentFilter!`](#organizationclusteragentfilter) | Filter the types of cluster agents to return. | ### `OrganizationStateCounts` @@ -45291,6 +45291,15 @@ Enum defining the type of OpenTelemetry metric. | `HISTOGRAM_TYPE` | Histogram Type type. | | `SUM_TYPE` | Sum Type type. | +### `OrganizationClusterAgentFilter` + +Possible filter types for remote development cluster agents in an organization. + +| Value | Description | +| ----- | ----------- | +| `ALL` | All cluster agents in the organization that can be used for hosting workspaces. | +| `DIRECTLY_MAPPED` | Cluster agents that are directly mapped to the given organization. | + ### `OrganizationGroupProjectDisplay` Default list view for organization groups and projects. diff --git a/ee/app/finders/remote_development/organization_cluster_agents_finder.rb b/ee/app/finders/remote_development/organization_cluster_agents_finder.rb index f64fe45b362179..60487e6a927583 100644 --- a/ee/app/finders/remote_development/organization_cluster_agents_finder.rb +++ b/ee/app/finders/remote_development/organization_cluster_agents_finder.rb @@ -21,17 +21,7 @@ def self.fetch_agents(organization:, filter:) when :all # Returns all agents that have remote development enabled Clusters::Agent.for_organizations([organization.id]).with_remote_development_enabled - when :unmapped - # rubocop: disable CodeReuse/ActiveRecord -- activerecord is convenient for filtering for records - # noinspection RailsParamDefResolve -- RubyMine is not finding organization_cluster_agent_mapping - Clusters::Agent.for_organizations([organization.id]) - .left_joins(:organization_cluster_agent_mapping) - .where(organization_cluster_agent_mapping: { id: nil }) - .select('"cluster_agents".*') - # rubocop: enable CodeReuse/ActiveRecord when :directly_mapped - organization.mapped_agents - when :available organization.mapped_agents.with_remote_development_enabled else raise "Unsupported value for filter: #{filter}" diff --git a/ee/app/graphql/resolvers/remote_development/organization/cluster_agents_resolver.rb b/ee/app/graphql/resolvers/remote_development/organization/cluster_agents_resolver.rb index 5ed91c94f8e23d..e262ed06927a5c 100644 --- a/ee/app/graphql/resolvers/remote_development/organization/cluster_agents_resolver.rb +++ b/ee/app/graphql/resolvers/remote_development/organization/cluster_agents_resolver.rb @@ -8,7 +8,7 @@ class ClusterAgentsResolver < ::Resolvers::BaseResolver type Types::Clusters::AgentType.connection_type, null: true - argument :filter, Types::RemoteDevelopment::NamespaceClusterAgentFilterEnum, + argument :filter, Types::RemoteDevelopment::OrganizationClusterAgentFilterEnum, required: true, description: 'Filter the types of cluster agents to return.' diff --git a/ee/app/graphql/types/remote_development/organization_cluster_agent_filter_enum.rb b/ee/app/graphql/types/remote_development/organization_cluster_agent_filter_enum.rb new file mode 100644 index 00000000000000..63d6be4e004a1f --- /dev/null +++ b/ee/app/graphql/types/remote_development/organization_cluster_agent_filter_enum.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Types + module RemoteDevelopment + class OrganizationClusterAgentFilterEnum < BaseEnum + graphql_name 'OrganizationClusterAgentFilter' + description 'Possible filter types for remote development cluster agents in an organization' + + value 'DIRECTLY_MAPPED', + description: "Cluster agents that are directly mapped to the given organization.", value: 'DIRECTLY_MAPPED' + + value 'ALL', + description: "All cluster agents in the organization that can be used for hosting workspaces.", value: 'ALL' + end + end +end diff --git a/ee/spec/finders/remote_development/organization_cluster_agents_finder_spec.rb b/ee/spec/finders/remote_development/organization_cluster_agents_finder_spec.rb index 90d7faa17c6a08..bb3038e727c5f0 100644 --- a/ee/spec/finders/remote_development/organization_cluster_agents_finder_spec.rb +++ b/ee/spec/finders/remote_development/organization_cluster_agents_finder_spec.rb @@ -12,7 +12,7 @@ end end - let(:filter) { :available } + let(:filter) { :directly_mapped } let_it_be(:mapped_agent_in_org) do project = create(:project, organization: organization, namespace: create(:group)) @@ -29,14 +29,6 @@ end end - let_it_be(:agent_in_org_with_remote_dev_disabled) do - project = create(:project, organization: organization) - create(:ee_cluster_agent, project: project, name: "agent-in-org-unavailable").tap do |agent| - create(:workspaces_agent_config, agent: agent, enabled: false) - create(:organization_cluster_agent_mapping, user: user, agent: agent, organization: organization) - end - end - describe '#execute' do subject(:response) do # noinspection RubyMismatchedArgumentType -- We are passing a test double @@ -47,27 +39,9 @@ ).to_a end - context 'with filter_type set to available' do - context 'when cluster agents are mapped to the organization' do - it 'returns cluster agents mapped to the organization excluding those with remote dev disabled' do - expect(response).to eq([mapped_agent_in_org]) - end - end - end - context 'with filter_type set to directly_mapped' do - let(:filter) { :directly_mapped } - it 'returns cluster agents that are mapped directly to the organization, including those disabled' do - expect(response).to match_array([mapped_agent_in_org, agent_in_org_with_remote_dev_disabled]) - end - end - - context 'with filter_type set to unmapped' do - let(:filter) { :unmapped } - - it 'returns cluster agents that are unmapped to the organization' do - expect(response).to eq([unmapped_agent_in_org]) + expect(response).to match_array([mapped_agent_in_org]) end end diff --git a/ee/spec/requests/api/graphql/remote_development/organization/workspaces_cluster_agents/shared.rb b/ee/spec/requests/api/graphql/remote_development/organization/workspaces_cluster_agents/shared.rb index d72e5dbed48bf0..53d25f75e4a356 100644 --- a/ee/spec/requests/api/graphql/remote_development/organization/workspaces_cluster_agents/shared.rb +++ b/ee/spec/requests/api/graphql/remote_development/organization/workspaces_cluster_agents/shared.rb @@ -16,7 +16,7 @@ let_it_be(:unauthorized_user) { create(:user) } - let_it_be(:available_agent) do + let_it_be(:mapped_agent) do project = create(:project, organization: organization, namespace: create(:group)) create(:ee_cluster_agent, project: project, name: "agent-in-org-available").tap do |agent| create(:workspaces_agent_config, agent: agent) @@ -24,14 +24,6 @@ end end - let_it_be(:directly_mapped_but_disabled_agent) do - project = create(:project, organization: organization) - create(:ee_cluster_agent, project: project, name: "agent-in-org-mapped").tap do |agent| - create(:workspaces_agent_config, agent: agent, enabled: false) - create(:organization_cluster_agent_mapping, user: authorized_user, agent: agent, organization: organization) - end - end - let_it_be(:unmapped_agent) do project = create(:project, organization: organization) create(:ee_cluster_agent, project: project, name: "agent-in-org-unmapped").tap do |agent| @@ -109,15 +101,13 @@ end # noinspection RubyArgCount -- Rubymine detecting wrong types, thinks some #create are from Minitest, not FactoryBot - context "when the user is authorized only on mapped and available agents" do + context "when the user is authorized only on mapped agents" do let_it_be(:current_user) do create(:user).tap do |u| create(:organization_user, organization: organization, user: u) end end - let_it_be(:unavailable_and_unmapped_agents) { [unmapped_agent.name, directly_mapped_but_disabled_agent.name] } - it_behaves_like "query is a working graphql query" context "when the user requests agents" do @@ -126,7 +116,7 @@ end it "does not include unmapped and unavailable agents", :unlimited_max_formatted_output_length do - expect(agent_names.sort).not_to include(*unavailable_and_unmapped_agents) + expect(agent_names.sort).not_to include(unmapped_agent.name) end end end diff --git a/ee/spec/requests/api/graphql/remote_development/organization/workspaces_cluster_agents/with_available_filter_arg_spec.rb b/ee/spec/requests/api/graphql/remote_development/organization/workspaces_cluster_agents/with_all_filter_arg_spec.rb similarity index 73% rename from ee/spec/requests/api/graphql/remote_development/organization/workspaces_cluster_agents/with_available_filter_arg_spec.rb rename to ee/spec/requests/api/graphql/remote_development/organization/workspaces_cluster_agents/with_all_filter_arg_spec.rb index bf430daee066e2..bae3dabe1cc3a1 100644 --- a/ee/spec/requests/api/graphql/remote_development/organization/workspaces_cluster_agents/with_available_filter_arg_spec.rb +++ b/ee/spec/requests/api/graphql/remote_development/organization/workspaces_cluster_agents/with_all_filter_arg_spec.rb @@ -3,9 +3,9 @@ require "spec_helper" require_relative "./shared" -RSpec.describe "Query.organization.workspaces_cluster_agents(filter: AVAILABLE)", feature_category: :workspaces do - let(:filter) { :AVAILABLE } - let(:expected_agents) { [available_agent] } +RSpec.describe "Query.organization.workspaces_cluster_agents(filter: ALL)", feature_category: :workspaces do + let(:filter) { :ALL } + let(:expected_agents) { [mapped_agent, unmapped_agent] } include_context "with agents and users setup in an organization" include_context "for a Query.organization.workspaces_cluster_agents query" diff --git a/ee/spec/requests/api/graphql/remote_development/organization/workspaces_cluster_agents/with_directly_mapped_filter_arg_spec.rb b/ee/spec/requests/api/graphql/remote_development/organization/workspaces_cluster_agents/with_directly_mapped_filter_arg_spec.rb index 4a7504fe7ba79b..a0dafbd50d8f76 100644 --- a/ee/spec/requests/api/graphql/remote_development/organization/workspaces_cluster_agents/with_directly_mapped_filter_arg_spec.rb +++ b/ee/spec/requests/api/graphql/remote_development/organization/workspaces_cluster_agents/with_directly_mapped_filter_arg_spec.rb @@ -5,7 +5,7 @@ RSpec.describe "Query.organization.workspaces_cluster_agents (filter: DIRECTLY_MAPPED)", feature_category: :workspaces do let(:filter) { :DIRECTLY_MAPPED } - let(:expected_agents) { [directly_mapped_but_disabled_agent, available_agent] } + let(:expected_agents) { [mapped_agent] } include_context "with agents and users setup in an organization" include_context "for a Query.organization.workspaces_cluster_agents query" diff --git a/ee/spec/requests/api/graphql/remote_development/organization/workspaces_cluster_agents/with_unmapped_filter_arg_spec.rb b/ee/spec/requests/api/graphql/remote_development/organization/workspaces_cluster_agents/with_unmapped_filter_arg_spec.rb deleted file mode 100644 index f87b0431a78d5c..00000000000000 --- a/ee/spec/requests/api/graphql/remote_development/organization/workspaces_cluster_agents/with_unmapped_filter_arg_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' -require_relative './shared' - -RSpec.describe 'Query.organization.workspaces_cluster_agents (filter: UNMAPPED)', feature_category: :workspaces do - let(:filter) { :UNMAPPED } - let(:expected_agents) { [unmapped_agent] } - - include_context "with agents and users setup in an organization" - include_context "for a Query.organization.workspaces_cluster_agents query" - - it_behaves_like "multiple agents in organization query" -end diff --git a/scripts/verify-tff-mapping b/scripts/verify-tff-mapping index 76a741bd0ce7b6..85615d94159cb4 100755 --- a/scripts/verify-tff-mapping +++ b/scripts/verify-tff-mapping @@ -534,7 +534,7 @@ tests = [ changed_file: 'ee/app/graphql/resolvers/remote_development/organization/cluster_agents_resolver.rb', # rubocop:disable Layout/LineLength -- fix CI failures - not sure why other lines in this file don't get errors expected: %w[ - ee/spec/requests/api/graphql/remote_development/organization/workspaces_cluster_agents/with_available_filter_arg_spec.rb + ee/spec/requests/api/graphql/remote_development/organization/workspaces_cluster_agents/with_all_filter_arg_spec.rb ee/spec/requests/api/graphql/remote_development/organization/workspaces_cluster_agents/with_directly_mapped_filter_arg_spec.rb ee/spec/requests/api/graphql/remote_development/organization/workspaces_cluster_agents/with_unmapped_filter_arg_spec.rb ] -- GitLab