diff --git a/ee/app/finders/remote_development/cluster_agents_finder.rb b/ee/app/finders/remote_development/cluster_agents_finder.rb index 29a26292067431325773f41e923de2a8c79bed56..7eedf70acce6c4f419a8ae82e3182a292f066bc3 100644 --- a/ee/app/finders/remote_development/cluster_agents_finder.rb +++ b/ee/app/finders/remote_development/cluster_agents_finder.rb @@ -29,16 +29,18 @@ def self.fetch_agents(filter, namespace, user) validate_user_can_read_namespace_agent_mappings!(user: user, namespace: namespace) relevant_mappings = RemoteDevelopmentNamespaceClusterAgentMapping.for_namespaces([namespace.id]) - relevant_mappings = NamespaceClusterAgentMappings::Validations.filter_valid_namespace_cluster_agent_mappings( - namespace_cluster_agent_mappings: relevant_mappings.to_a - ) + relevant_mappings = + NamespaceClusterAgentMappingOperations::Validations.filter_valid_namespace_cluster_agent_mappings( + namespace_cluster_agent_mappings: relevant_mappings.to_a + ) Clusters::Agent.id_in(relevant_mappings.map(&:cluster_agent_id)) when :available relevant_mappings = RemoteDevelopmentNamespaceClusterAgentMapping.for_namespaces(namespace.traversal_ids) - relevant_mappings = NamespaceClusterAgentMappings::Validations.filter_valid_namespace_cluster_agent_mappings( - namespace_cluster_agent_mappings: relevant_mappings.to_a - ) + relevant_mappings = + NamespaceClusterAgentMappingOperations::Validations.filter_valid_namespace_cluster_agent_mappings( + namespace_cluster_agent_mappings: relevant_mappings.to_a + ) Clusters::Agent.id_in(relevant_mappings.map(&:cluster_agent_id)).with_remote_development_enabled else diff --git a/ee/app/finders/remote_development/workspaces_finder.rb b/ee/app/finders/remote_development/workspaces_finder.rb index 9cbb6b1d02e9d5250fd1d6f6f6f03c2e5bda2ee3..1ca9f9f90656f1e4afb9241e0704fca7ca3e12c1 100644 --- a/ee/app/finders/remote_development/workspaces_finder.rb +++ b/ee/app/finders/remote_development/workspaces_finder.rb @@ -44,7 +44,7 @@ def self.execute(current_user:, ids: [], user_ids: [], project_ids: [], agent_id def self.validate_actual_state_values!(actual_states) invalid_actual_state = actual_states.find do |actual_state| - Workspaces::States::VALID_ACTUAL_STATES.exclude?(actual_state) + WorkspaceOperations::States::VALID_ACTUAL_STATES.exclude?(actual_state) end raise ArgumentError, "Invalid actual state value provided: '#{invalid_actual_state}'" if invalid_actual_state diff --git a/ee/app/graphql/ee/types/mutation_type.rb b/ee/app/graphql/ee/types/mutation_type.rb index cef26d404876262e115c2aa5b2e45c5a8449a812..52721a81ed2b8b054e318f375754797e611b36ec 100644 --- a/ee/app/graphql/ee/types/mutation_type.rb +++ b/ee/app/graphql/ee/types/mutation_type.rb @@ -125,10 +125,10 @@ def self.authorization_scopes mount_mutation ::Mutations::AuditEvents::ExternalAuditEventDestinations::Update mount_mutation ::Mutations::Ci::NamespaceCiCdSettingsUpdate mount_mutation ::Mutations::Ci::Runners::ExportUsage - mount_mutation ::Mutations::RemoteDevelopment::Workspaces::Create - mount_mutation ::Mutations::RemoteDevelopment::Workspaces::Update - mount_mutation ::Mutations::RemoteDevelopment::NamespaceClusterAgentMappings::Create - mount_mutation ::Mutations::RemoteDevelopment::NamespaceClusterAgentMappings::Delete + mount_mutation ::Mutations::RemoteDevelopment::WorkspaceOperations::Create + mount_mutation ::Mutations::RemoteDevelopment::WorkspaceOperations::Update + mount_mutation ::Mutations::RemoteDevelopment::NamespaceClusterAgentMappingOperations::Create + mount_mutation ::Mutations::RemoteDevelopment::NamespaceClusterAgentMappingOperations::Delete mount_mutation ::Mutations::AuditEvents::Streaming::Headers::Destroy mount_mutation ::Mutations::AuditEvents::Streaming::Headers::Create mount_mutation ::Mutations::AuditEvents::Streaming::Headers::Update diff --git a/ee/app/graphql/mutations/remote_development/namespace_cluster_agent_mappings/create.rb b/ee/app/graphql/mutations/remote_development/namespace_cluster_agent_mapping_operations/create.rb similarity index 95% rename from ee/app/graphql/mutations/remote_development/namespace_cluster_agent_mappings/create.rb rename to ee/app/graphql/mutations/remote_development/namespace_cluster_agent_mapping_operations/create.rb index 728bf18d5228f9a980c17b5dcc62c938fd2d9ca7..7b969eafe54de8523425bc823becee2694757344 100644 --- a/ee/app/graphql/mutations/remote_development/namespace_cluster_agent_mappings/create.rb +++ b/ee/app/graphql/mutations/remote_development/namespace_cluster_agent_mapping_operations/create.rb @@ -2,7 +2,7 @@ module Mutations module RemoteDevelopment - module NamespaceClusterAgentMappings + module NamespaceClusterAgentMappingOperations class Create < BaseMutation graphql_name 'NamespaceCreateRemoteDevelopmentClusterAgentMapping' @@ -38,7 +38,7 @@ def resolve(args) } response = ::RemoteDevelopment::CommonService.execute( - domain_main_class: ::RemoteDevelopment::NamespaceClusterAgentMappings::Create::Main, + domain_main_class: ::RemoteDevelopment::NamespaceClusterAgentMappingOperations::Create::Main, domain_main_class_args: domain_main_class_args ) diff --git a/ee/app/graphql/mutations/remote_development/namespace_cluster_agent_mappings/delete.rb b/ee/app/graphql/mutations/remote_development/namespace_cluster_agent_mapping_operations/delete.rb similarity index 94% rename from ee/app/graphql/mutations/remote_development/namespace_cluster_agent_mappings/delete.rb rename to ee/app/graphql/mutations/remote_development/namespace_cluster_agent_mapping_operations/delete.rb index 0ec113348d5098abf62009c0b65ce89b608680f6..3ebfb673e9ac824f07d9b2d5ece06b1efd95091f 100644 --- a/ee/app/graphql/mutations/remote_development/namespace_cluster_agent_mappings/delete.rb +++ b/ee/app/graphql/mutations/remote_development/namespace_cluster_agent_mapping_operations/delete.rb @@ -2,7 +2,7 @@ module Mutations module RemoteDevelopment - module NamespaceClusterAgentMappings + module NamespaceClusterAgentMappingOperations class Delete < BaseMutation graphql_name 'NamespaceDeleteRemoteDevelopmentClusterAgentMapping' @@ -37,7 +37,7 @@ def resolve(args) } response = ::RemoteDevelopment::CommonService.execute( - domain_main_class: ::RemoteDevelopment::NamespaceClusterAgentMappings::Delete::Main, + domain_main_class: ::RemoteDevelopment::NamespaceClusterAgentMappingOperations::Delete::Main, domain_main_class_args: domain_main_class_args ) diff --git a/ee/app/graphql/mutations/remote_development/workspaces/create.rb b/ee/app/graphql/mutations/remote_development/workspace_operations/create.rb similarity index 96% rename from ee/app/graphql/mutations/remote_development/workspaces/create.rb rename to ee/app/graphql/mutations/remote_development/workspace_operations/create.rb index e0f829f96bdb37a17bf33ff1cc5e0cf8bfd96d29..aa404bc00a3aa55cf410c90071b8fa0b7599124d 100644 --- a/ee/app/graphql/mutations/remote_development/workspaces/create.rb +++ b/ee/app/graphql/mutations/remote_development/workspace_operations/create.rb @@ -2,7 +2,7 @@ module Mutations module RemoteDevelopment - module Workspaces + module WorkspaceOperations class Create < BaseMutation graphql_name 'WorkspaceCreate' @@ -86,7 +86,7 @@ def resolve(args) end valid_relevant_mappings = - ::RemoteDevelopment::NamespaceClusterAgentMappings::Validations + ::RemoteDevelopment::NamespaceClusterAgentMappingOperations::Validations .filter_valid_namespace_cluster_agent_mappings(namespace_cluster_agent_mappings: relevant_mappings.to_a) unless valid_relevant_mappings.present? @@ -131,7 +131,7 @@ def resolve(args) } response = ::RemoteDevelopment::CommonService.execute( - domain_main_class: ::RemoteDevelopment::Workspaces::Create::Main, + domain_main_class: ::RemoteDevelopment::WorkspaceOperations::Create::Main, domain_main_class_args: domain_main_class_args ) diff --git a/ee/app/graphql/mutations/remote_development/workspaces/update.rb b/ee/app/graphql/mutations/remote_development/workspace_operations/update.rb similarity index 94% rename from ee/app/graphql/mutations/remote_development/workspaces/update.rb rename to ee/app/graphql/mutations/remote_development/workspace_operations/update.rb index e9e1ff0042d7a635ff68cb6825b87e8abe2733f0..43c13a3ee7d986cba0d0d4a5b3f2302a8ccbecfc 100644 --- a/ee/app/graphql/mutations/remote_development/workspaces/update.rb +++ b/ee/app/graphql/mutations/remote_development/workspace_operations/update.rb @@ -2,7 +2,7 @@ module Mutations module RemoteDevelopment - module Workspaces + module WorkspaceOperations class Update < BaseMutation graphql_name 'WorkspaceUpdate' @@ -43,7 +43,7 @@ def resolve(id:, **args) } response = ::RemoteDevelopment::CommonService.execute( - domain_main_class: ::RemoteDevelopment::Workspaces::Update::Main, + domain_main_class: ::RemoteDevelopment::WorkspaceOperations::Update::Main, domain_main_class_args: domain_main_class_args ) diff --git a/ee/app/models/remote_development/workspace.rb b/ee/app/models/remote_development/workspace.rb index 377811bc1ea2685b72be247394baebafc78a31ee..92380be79ec063ff9a9ebd52cb3ddb9c015fffde 100644 --- a/ee/app/models/remote_development/workspace.rb +++ b/ee/app/models/remote_development/workspace.rb @@ -4,7 +4,7 @@ module RemoteDevelopment class Workspace < ApplicationRecord include IgnorableColumns include Sortable - include RemoteDevelopment::Workspaces::States + include RemoteDevelopment::WorkspaceOperations::States include ::Gitlab::Utils::StrongMemoize ignore_column :url_domain, remove_with: '16.9', remove_after: '2019-01-19' @@ -52,12 +52,12 @@ class Workspace < ApplicationRecord scope :by_actual_states, ->(actual_states) { where(actual_state: actual_states) } scope :desired_state_not_terminated, -> do where.not( - desired_state: RemoteDevelopment::Workspaces::States::TERMINATED + desired_state: RemoteDevelopment::WorkspaceOperations::States::TERMINATED ) end scope :actual_state_not_terminated, -> do where.not( - actual_state: RemoteDevelopment::Workspaces::States::TERMINATED + actual_state: RemoteDevelopment::WorkspaceOperations::States::TERMINATED ) end @@ -153,7 +153,7 @@ def validate_dns_zone_matches_remote_development_agent_config_dns_zone end def enforce_permanent_termination - return unless persisted? && desired_state_changed? && desired_state_was == Workspaces::States::TERMINATED + return unless persisted? && desired_state_changed? && desired_state_was == WorkspaceOperations::States::TERMINATED errors.add(:desired_state, "is 'Terminated', and cannot be updated. Create a new workspace instead.") end diff --git a/ee/lib/ee/api/internal/kubernetes.rb b/ee/lib/ee/api/internal/kubernetes.rb index 7640c7b813e82c7c6f8a73efbfae7780b7f4fbf8..11ebdade20ebadfd0eaf3ec9d3254b87601faa41 100644 --- a/ee/lib/ee/api/internal/kubernetes.rb +++ b/ee/lib/ee/api/internal/kubernetes.rb @@ -42,7 +42,7 @@ def update_configuration(agent:, config:) } ::RemoteDevelopment::CommonService.execute( - domain_main_class: ::RemoteDevelopment::AgentConfig::Main, + domain_main_class: ::RemoteDevelopment::AgentConfigOperations::Main, domain_main_class_args: domain_main_class_args ) end @@ -73,7 +73,7 @@ def update_configuration(agent:, config:) } response = ::RemoteDevelopment::CommonService.execute( - domain_main_class: ::RemoteDevelopment::Workspaces::Reconcile::Main, + domain_main_class: ::RemoteDevelopment::WorkspaceOperations::Reconcile::Main, domain_main_class_args: domain_main_class_args ) diff --git a/ee/lib/ee/gitlab/background_migration/backfill_workspace_personal_access_token.rb b/ee/lib/ee/gitlab/background_migration/backfill_workspace_personal_access_token.rb index 0d1687e8507ecfb1ca45b8bc9742f50f8ad6895e..832652c0a63c76f0e6a26a18093acd20fa1552f5 100644 --- a/ee/lib/ee/gitlab/background_migration/backfill_workspace_personal_access_token.rb +++ b/ee/lib/ee/gitlab/background_migration/backfill_workspace_personal_access_token.rb @@ -47,7 +47,7 @@ def calculate_expires_at(created_at, max_hours_before_termination) end def calculate_revoked(expires_at, desired_state) - expires_at <= Date.today || desired_state == ::RemoteDevelopment::Workspaces::States::TERMINATED + expires_at <= Date.today || desired_state == ::RemoteDevelopment::WorkspaceOperations::States::TERMINATED end end end diff --git a/ee/lib/remote_development/README.md b/ee/lib/remote_development/README.md index 90009e3f7f7cd3bab43eb14bed944cbc4a7d29d9..fd39c40234ee3eaab8ef6b29fe42456c8619d4d5 100644 --- a/ee/lib/remote_development/README.md +++ b/ee/lib/remote_development/README.md @@ -359,7 +359,7 @@ class Update < BaseMutation } response = ::RemoteDevelopment::CommonService.execute( - domain_main_class: ::RemoteDevelopment::Workspaces::Update::Main, + domain_main_class: ::RemoteDevelopment::WorkspaceOperations::Update::Main, domain_main_class_args: domain_main_class_args ) @@ -413,7 +413,7 @@ end #### Domain layer code examples -Next, you see the `ee/lib/remote_development/workspaces/update/main.rb` class, which implements an ROP chain with two steps, `authorize` and `update`. +Next, you see the `ee/lib/remote_development/workspace_operations/update/main.rb` class, which implements an ROP chain with two steps, `authorize` and `update`. Note that the `Main` class also has no domain logic in it itself other than invoking the steps and matching the the domain messages and transforming them into a response hash. We want to avoid that coupling, because all domain logic should live in the cohesive classes that are called by `Main` via the ROP pattern: @@ -441,7 +441,7 @@ class Main end ``` -...and here is an example of the `ee/lib/remote_development/workspaces/update/updater.rb` class implementing the business logic in the "chain". +...and here is an example of the `ee/lib/remote_development/workspace_operations/update/updater.rb` class implementing the business logic in the "chain". In this case, it contains the cohesive logic to update a workspace, and no other unrelated domain logic: @@ -530,15 +530,15 @@ The matcher [`invoke_rop_steps`](https://gitlab.com/gitlab-org/gitlab/-/blob/mas #### Matcher entry -The block provided to the `expect` clause when called, should trigger an ROP main class method e.g: `RemoteDevelopment::Workspaces::Create::Main.main`. +The block provided to the `expect` clause when called, should trigger an ROP main class method e.g: `RemoteDevelopment::WorkspaceOperations::Create::Main.main`. The `invoke_rop_steps` method is the entry into the matcher. It accepts as a parameter, a list of the ROP step classes and their `Result` passing method (a `map` or `and_then`). e.g: ```ruby let(:rop_steps) do [ - [RemoteDevelopment::Workspaces::Create::VolumeComponentInjector, :map], - [RemoteDevelopment::Workspaces::Create::Creator, :and_then] + [RemoteDevelopment::WorkspaceOperations::Create::VolumeComponentInjector, :map], + [RemoteDevelopment::WorkspaceOperations::Create::Creator, :and_then] ] end ``` @@ -555,7 +555,7 @@ It expects the array to specify step classes in the same order as the chain of t ... with_ok_result_for_step( { - step_class: RemoteDevelopment::Workspaces::Create::Creator, + step_class: RemoteDevelopment::WorkspaceOperations::Create::Creator, returned_message: RemoteDevelopment::Messages::WorkspaceCreateSuccessful.new(ok_message_content) } ) @@ -570,7 +570,7 @@ It expects the array to specify step classes in the same order as the chain of t ... with_err_result_for_step( { - step_class: RemoteDevelopment::Workspaces::Create::Authorizer, + step_class: RemoteDevelopment::WorkspaceOperations::Create::Authorizer, returned_message: RemoteDevelopment::Messages::Unauthorized.new(err_message_content) } ) @@ -581,7 +581,7 @@ It expects the array to specify step classes in the same order as the chain of t - `and_return_expected_value` sets up an expectation to match the output of calling the ROP main class method in the block provided. It validates the expected return value is either a `Hash`, `Result` or a subclass of `RuntimeError`. -For a comprehensive view of how the matcher is used in a test suite, see [RemoteDevelopment::Workspaces::Create::Main](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/remote_development/workspaces/create/main.rb) and its associated spec file [main_spec.rb](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/spec/lib/remote_development/workspaces/create/main_spec.rb). +For a comprehensive view of how the matcher is used in a test suite, see [RemoteDevelopment::WorkspaceOperations::Create::Main](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/remote_development/workspace_operations/create/main.rb) and its associated spec file [main_spec.rb](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/spec/lib/remote_development/workspace_operations/create/main_spec.rb). ### Matcher internals diff --git a/ee/lib/remote_development/agent_config/license_checker.rb b/ee/lib/remote_development/agent_config_operations/license_checker.rb similarity index 93% rename from ee/lib/remote_development/agent_config/license_checker.rb rename to ee/lib/remote_development/agent_config_operations/license_checker.rb index ea9969f73a2e07ec25f156605d3f5019d45176eb..ba4aef70eee08eb305665a3fe96ed5723f6b1f10 100644 --- a/ee/lib/remote_development/agent_config/license_checker.rb +++ b/ee/lib/remote_development/agent_config_operations/license_checker.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module AgentConfig + module AgentConfigOperations class LicenseChecker include Messages diff --git a/ee/lib/remote_development/agent_config/main.rb b/ee/lib/remote_development/agent_config_operations/main.rb similarity index 98% rename from ee/lib/remote_development/agent_config/main.rb rename to ee/lib/remote_development/agent_config_operations/main.rb index c81c8d6fd89bbc92401021fe4a862f35e2874870..8ab59d71c542aa8a19c8c6508051a21021aa1fd6 100644 --- a/ee/lib/remote_development/agent_config/main.rb +++ b/ee/lib/remote_development/agent_config_operations/main.rb @@ -3,7 +3,7 @@ require 'active_model/errors' module RemoteDevelopment - module AgentConfig + module AgentConfigOperations class Main include Messages extend Gitlab::Fp::MessageSupport diff --git a/ee/lib/remote_development/agent_config/updater.rb b/ee/lib/remote_development/agent_config_operations/updater.rb similarity index 99% rename from ee/lib/remote_development/agent_config/updater.rb rename to ee/lib/remote_development/agent_config_operations/updater.rb index 25ebcddaae5de3fdc0c87cecd9405e918d58a213..aff7fab5a557a6b30cbbf8c9a7801c5325e99d1c 100644 --- a/ee/lib/remote_development/agent_config/updater.rb +++ b/ee/lib/remote_development/agent_config_operations/updater.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module AgentConfig + module AgentConfigOperations class Updater include Messages diff --git a/ee/lib/remote_development/messages.rb b/ee/lib/remote_development/messages.rb index 6b0777922a607e3641609201f96ff60ac101551c..a9e4381077755a4fc7756e19a2b4c237833587bb 100644 --- a/ee/lib/remote_development/messages.rb +++ b/ee/lib/remote_development/messages.rb @@ -15,7 +15,7 @@ module Messages # Auth errors Unauthorized = Class.new(Gitlab::Fp::Message) - # AgentConfig errors + # AgentConfigOperations errors AgentConfigUpdateFailed = Class.new(Gitlab::Fp::Message) # Workspace create errors @@ -48,7 +48,7 @@ module Messages # Domain Events - message name should describe the outcome #--------------------------------------------------------- - # AgentConfig domain events + # AgentConfigOperations domain events AgentConfigUpdateSkippedBecauseNoConfigFileEntryFound = Class.new(Gitlab::Fp::Message) AgentConfigUpdateSuccessful = Class.new(Gitlab::Fp::Message) diff --git a/ee/lib/remote_development/namespace_cluster_agent_mappings/create/cluster_agent_validator.rb b/ee/lib/remote_development/namespace_cluster_agent_mapping_operations/create/cluster_agent_validator.rb similarity index 94% rename from ee/lib/remote_development/namespace_cluster_agent_mappings/create/cluster_agent_validator.rb rename to ee/lib/remote_development/namespace_cluster_agent_mapping_operations/create/cluster_agent_validator.rb index 98cc1ec50902514dd40dc0809d5b2da86b5134e2..b1f98d4aa7349a16e0f12f32897854b7d6d98141 100644 --- a/ee/lib/remote_development/namespace_cluster_agent_mappings/create/cluster_agent_validator.rb +++ b/ee/lib/remote_development/namespace_cluster_agent_mapping_operations/create/cluster_agent_validator.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module NamespaceClusterAgentMappings + module NamespaceClusterAgentMappingOperations module Create class ClusterAgentValidator include Messages diff --git a/ee/lib/remote_development/namespace_cluster_agent_mappings/create/main.rb b/ee/lib/remote_development/namespace_cluster_agent_mapping_operations/create/main.rb similarity index 95% rename from ee/lib/remote_development/namespace_cluster_agent_mappings/create/main.rb rename to ee/lib/remote_development/namespace_cluster_agent_mapping_operations/create/main.rb index 9b464a88a14a385cf52a1d587f776af1a3aca5f4..b426d6a6d8c3608e861f19e7c2595c1028c838a0 100644 --- a/ee/lib/remote_development/namespace_cluster_agent_mappings/create/main.rb +++ b/ee/lib/remote_development/namespace_cluster_agent_mapping_operations/create/main.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module NamespaceClusterAgentMappings + module NamespaceClusterAgentMappingOperations module Create class Main include Messages diff --git a/ee/lib/remote_development/namespace_cluster_agent_mappings/create/mapping_creator.rb b/ee/lib/remote_development/namespace_cluster_agent_mapping_operations/create/mapping_creator.rb similarity index 96% rename from ee/lib/remote_development/namespace_cluster_agent_mappings/create/mapping_creator.rb rename to ee/lib/remote_development/namespace_cluster_agent_mapping_operations/create/mapping_creator.rb index 507282a92b3fe4763641b7616db5fc5634689cdc..dd0b9f8b2480209814797f64a79c34ae62d4d4f7 100644 --- a/ee/lib/remote_development/namespace_cluster_agent_mappings/create/mapping_creator.rb +++ b/ee/lib/remote_development/namespace_cluster_agent_mapping_operations/create/mapping_creator.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module NamespaceClusterAgentMappings + module NamespaceClusterAgentMappingOperations module Create class MappingCreator include Messages diff --git a/ee/lib/remote_development/namespace_cluster_agent_mappings/delete/main.rb b/ee/lib/remote_development/namespace_cluster_agent_mapping_operations/delete/main.rb similarity index 95% rename from ee/lib/remote_development/namespace_cluster_agent_mappings/delete/main.rb rename to ee/lib/remote_development/namespace_cluster_agent_mapping_operations/delete/main.rb index 60bd104d8b9bbc2557a9f5f5fc87b3f08f07e56e..4164359f8bac7c76434bda5059908d9f1d86a6b8 100644 --- a/ee/lib/remote_development/namespace_cluster_agent_mappings/delete/main.rb +++ b/ee/lib/remote_development/namespace_cluster_agent_mapping_operations/delete/main.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module NamespaceClusterAgentMappings + module NamespaceClusterAgentMappingOperations module Delete class Main include Messages diff --git a/ee/lib/remote_development/namespace_cluster_agent_mappings/delete/mapping_deleter.rb b/ee/lib/remote_development/namespace_cluster_agent_mapping_operations/delete/mapping_deleter.rb similarity index 94% rename from ee/lib/remote_development/namespace_cluster_agent_mappings/delete/mapping_deleter.rb rename to ee/lib/remote_development/namespace_cluster_agent_mapping_operations/delete/mapping_deleter.rb index 94a2a857480af3f4ed2b672eca6b95fe6e00357a..fc383282a48c625858bf02a8def4a0e689eb2ec5 100644 --- a/ee/lib/remote_development/namespace_cluster_agent_mappings/delete/mapping_deleter.rb +++ b/ee/lib/remote_development/namespace_cluster_agent_mapping_operations/delete/mapping_deleter.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module NamespaceClusterAgentMappings + module NamespaceClusterAgentMappingOperations module Delete class MappingDeleter include Messages diff --git a/ee/lib/remote_development/namespace_cluster_agent_mappings/validations.rb b/ee/lib/remote_development/namespace_cluster_agent_mapping_operations/validations.rb similarity index 98% rename from ee/lib/remote_development/namespace_cluster_agent_mappings/validations.rb rename to ee/lib/remote_development/namespace_cluster_agent_mapping_operations/validations.rb index 4aaeea5093eae554a8ac25e8c8603605b51f1791..96fd63f4c99d690ce01d0c1bb050e2dc365f64e0 100644 --- a/ee/lib/remote_development/namespace_cluster_agent_mappings/validations.rb +++ b/ee/lib/remote_development/namespace_cluster_agent_mapping_operations/validations.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module NamespaceClusterAgentMappings + module NamespaceClusterAgentMappingOperations class Validations # The function checks and filters clusters agents that reside within a namespace. All other # agents are excluded from the response. A cluster agent is said to reside within a namespace diff --git a/ee/lib/remote_development/workspaces/config_version.rb b/ee/lib/remote_development/workspace_operations/config_version.rb similarity index 86% rename from ee/lib/remote_development/workspaces/config_version.rb rename to ee/lib/remote_development/workspace_operations/config_version.rb index 967bbe9d740061555a35268d880a3999402f04ad..63e69c33032c022c08b179e2f0928fb465c859cf 100644 --- a/ee/lib/remote_development/workspaces/config_version.rb +++ b/ee/lib/remote_development/workspace_operations/config_version.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module ConfigVersion VERSION_1 = 1 VERSION_2 = 2 diff --git a/ee/lib/remote_development/workspaces/create/authorizer.rb b/ee/lib/remote_development/workspace_operations/create/authorizer.rb similarity index 95% rename from ee/lib/remote_development/workspaces/create/authorizer.rb rename to ee/lib/remote_development/workspace_operations/create/authorizer.rb index 7f64af8f4ebd76adc563002b7b5bf3b8eb471785..d8f27c3933880460f99a003c528ceea748bfff67 100644 --- a/ee/lib/remote_development/workspaces/create/authorizer.rb +++ b/ee/lib/remote_development/workspace_operations/create/authorizer.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Create class Authorizer include Messages diff --git a/ee/lib/remote_development/workspaces/create/creator.rb b/ee/lib/remote_development/workspace_operations/create/creator.rb similarity index 98% rename from ee/lib/remote_development/workspaces/create/creator.rb rename to ee/lib/remote_development/workspace_operations/create/creator.rb index 4cbafece11cd0cb097500ac3f1ea09d6e65bb980..af61a011bcaf83cb262258a49645b13ce3a35e5e 100644 --- a/ee/lib/remote_development/workspaces/create/creator.rb +++ b/ee/lib/remote_development/workspace_operations/create/creator.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Create class Creator include Messages diff --git a/ee/lib/remote_development/workspaces/create/devfile_fetcher.rb b/ee/lib/remote_development/workspace_operations/create/devfile_fetcher.rb similarity index 98% rename from ee/lib/remote_development/workspaces/create/devfile_fetcher.rb rename to ee/lib/remote_development/workspace_operations/create/devfile_fetcher.rb index e55965150d1411e38c6ffeb648aa7024378da8ef..942205b2a1da0ea8500d09f99f9bbeb33fed3f6e 100644 --- a/ee/lib/remote_development/workspaces/create/devfile_fetcher.rb +++ b/ee/lib/remote_development/workspace_operations/create/devfile_fetcher.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Create class DevfileFetcher include Messages diff --git a/ee/lib/remote_development/workspaces/create/devfile_flattener.rb b/ee/lib/remote_development/workspace_operations/create/devfile_flattener.rb similarity index 97% rename from ee/lib/remote_development/workspaces/create/devfile_flattener.rb rename to ee/lib/remote_development/workspace_operations/create/devfile_flattener.rb index e3b84a0f168cfcf3b43bf0cbd8f9662499a45152..da98b1c847e3bb7dfe6a24ae437a142316e954a4 100644 --- a/ee/lib/remote_development/workspaces/create/devfile_flattener.rb +++ b/ee/lib/remote_development/workspace_operations/create/devfile_flattener.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Create class DevfileFlattener include Messages diff --git a/ee/lib/remote_development/workspaces/create/main.rb b/ee/lib/remote_development/workspace_operations/create/main.rb similarity index 98% rename from ee/lib/remote_development/workspaces/create/main.rb rename to ee/lib/remote_development/workspace_operations/create/main.rb index 9f2a68b6753548dc98dbfef304e813c9f134e918..48169e0f2a8828cf9f8d0203e5dc0da29090d848 100644 --- a/ee/lib/remote_development/workspaces/create/main.rb +++ b/ee/lib/remote_development/workspace_operations/create/main.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Create class Main include Messages diff --git a/ee/lib/remote_development/workspaces/create/personal_access_token_creator.rb b/ee/lib/remote_development/workspace_operations/create/personal_access_token_creator.rb similarity index 98% rename from ee/lib/remote_development/workspaces/create/personal_access_token_creator.rb rename to ee/lib/remote_development/workspace_operations/create/personal_access_token_creator.rb index 17c3422769908d30cde80df5712141f85cb3ae59..60794f948410e68237ff5ccd896957d223af9883 100644 --- a/ee/lib/remote_development/workspaces/create/personal_access_token_creator.rb +++ b/ee/lib/remote_development/workspace_operations/create/personal_access_token_creator.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Create class PersonalAccessTokenCreator include Messages diff --git a/ee/lib/remote_development/workspaces/create/post_flatten_devfile_validator.rb b/ee/lib/remote_development/workspace_operations/create/post_flatten_devfile_validator.rb similarity index 99% rename from ee/lib/remote_development/workspaces/create/post_flatten_devfile_validator.rb rename to ee/lib/remote_development/workspace_operations/create/post_flatten_devfile_validator.rb index db312c88d642da31ed3420edb56c8480d7b6ce37..a32d64da422429060230cfc383cf3d7b22b87b14 100644 --- a/ee/lib/remote_development/workspaces/create/post_flatten_devfile_validator.rb +++ b/ee/lib/remote_development/workspace_operations/create/post_flatten_devfile_validator.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Create class PostFlattenDevfileValidator include Messages diff --git a/ee/lib/remote_development/workspaces/create/pre_flatten_devfile_validator.rb b/ee/lib/remote_development/workspace_operations/create/pre_flatten_devfile_validator.rb similarity index 98% rename from ee/lib/remote_development/workspaces/create/pre_flatten_devfile_validator.rb rename to ee/lib/remote_development/workspace_operations/create/pre_flatten_devfile_validator.rb index 274a86917edb1cbf340aea74f8ff3e5b61337e32..81294c15083ac0be8dfc93221f7a368469347d47 100644 --- a/ee/lib/remote_development/workspaces/create/pre_flatten_devfile_validator.rb +++ b/ee/lib/remote_development/workspace_operations/create/pre_flatten_devfile_validator.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Create class PreFlattenDevfileValidator include Messages diff --git a/ee/lib/remote_development/workspaces/create/project_cloner_component_injector.rb b/ee/lib/remote_development/workspace_operations/create/project_cloner_component_injector.rb similarity index 99% rename from ee/lib/remote_development/workspaces/create/project_cloner_component_injector.rb rename to ee/lib/remote_development/workspace_operations/create/project_cloner_component_injector.rb index a5e05c2c43372b875b340a811bebd0eef12b1567..aba91a1c5146a91959576589f5e943a001d81ca6 100644 --- a/ee/lib/remote_development/workspaces/create/project_cloner_component_injector.rb +++ b/ee/lib/remote_development/workspace_operations/create/project_cloner_component_injector.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Create class ProjectClonerComponentInjector include Messages diff --git a/ee/lib/remote_development/workspaces/create/tools_component_injector.rb b/ee/lib/remote_development/workspace_operations/create/tools_component_injector.rb similarity index 99% rename from ee/lib/remote_development/workspaces/create/tools_component_injector.rb rename to ee/lib/remote_development/workspace_operations/create/tools_component_injector.rb index 00fd644c27cc3a17d53833032cb5914232ada839..82baaef21b9c52e663489243d4f15f38ab3800b5 100644 --- a/ee/lib/remote_development/workspaces/create/tools_component_injector.rb +++ b/ee/lib/remote_development/workspace_operations/create/tools_component_injector.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Create class ToolsComponentInjector include Messages diff --git a/ee/lib/remote_development/workspaces/create/volume_component_injector.rb b/ee/lib/remote_development/workspace_operations/create/volume_component_injector.rb similarity index 97% rename from ee/lib/remote_development/workspaces/create/volume_component_injector.rb rename to ee/lib/remote_development/workspace_operations/create/volume_component_injector.rb index c3aca03ea2e64e3935da95bc112f7287bc1b1af5..774f94ed2d84b390db654898b85e874bccc53f8b 100644 --- a/ee/lib/remote_development/workspaces/create/volume_component_injector.rb +++ b/ee/lib/remote_development/workspace_operations/create/volume_component_injector.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Create class VolumeComponentInjector include Messages diff --git a/ee/lib/remote_development/workspaces/create/volume_definer.rb b/ee/lib/remote_development/workspace_operations/create/volume_definer.rb similarity index 97% rename from ee/lib/remote_development/workspaces/create/volume_definer.rb rename to ee/lib/remote_development/workspace_operations/create/volume_definer.rb index ff3244f2da55669f68daedb59ecea74f9dbb14d0..b5c1ec2320f516326e723415ad3413d4e84b50b6 100644 --- a/ee/lib/remote_development/workspaces/create/volume_definer.rb +++ b/ee/lib/remote_development/workspace_operations/create/volume_definer.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Create # NOTE: Even though all this class currently does is define fixed values for volume mounts, # we may want to add more logic to this class in the future, possibly to allow users diff --git a/ee/lib/remote_development/workspaces/create/workspace_creator.rb b/ee/lib/remote_development/workspace_operations/create/workspace_creator.rb similarity index 97% rename from ee/lib/remote_development/workspaces/create/workspace_creator.rb rename to ee/lib/remote_development/workspace_operations/create/workspace_creator.rb index 344cbfdc740a604775faff8d2d284b0c44403bc1..ae68a950dfd07c81872afb085d2e00a3d9f8ffa0 100644 --- a/ee/lib/remote_development/workspaces/create/workspace_creator.rb +++ b/ee/lib/remote_development/workspace_operations/create/workspace_creator.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Create class WorkspaceCreator include States @@ -42,7 +42,7 @@ def self.create(context) workspace.namespace = workspace_namespace workspace.desired_state = desired_state workspace.actual_state = CREATION_REQUESTED - workspace.config_version = RemoteDevelopment::Workspaces::ConfigVersion::LATEST_VERSION + workspace.config_version = RemoteDevelopment::WorkspaceOperations::ConfigVersion::LATEST_VERSION workspace.editor = editor workspace.max_hours_before_termination = max_hours_before_termination workspace.devfile_ref = devfile_ref diff --git a/ee/lib/remote_development/workspaces/create/workspace_variables.rb b/ee/lib/remote_development/workspace_operations/create/workspace_variables.rb similarity index 90% rename from ee/lib/remote_development/workspaces/create/workspace_variables.rb rename to ee/lib/remote_development/workspace_operations/create/workspace_variables.rb index 01dab747b2344c72fe2a1dce077827f50f2d3f87..3a4ade8e84986ca53bb285d9c74f4bebd1999e77 100644 --- a/ee/lib/remote_development/workspaces/create/workspace_variables.rb +++ b/ee/lib/remote_development/workspace_operations/create/workspace_variables.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Create class WorkspaceVariables GIT_CREDENTIAL_STORE_SCRIPT = <<~SH.chomp @@ -46,13 +46,13 @@ def self.variables( static_variables = [ { - key: File.basename(RemoteDevelopment::Workspaces::FileMounts::GITLAB_TOKEN_FILE), + key: File.basename(RemoteDevelopment::WorkspaceOperations::FileMounts::GITLAB_TOKEN_FILE), value: personal_access_token_value, variable_type: RemoteDevelopment::Enums::Workspace::WORKSPACE_VARIABLE_TYPES[:file], workspace_id: workspace_id }, { - key: File.basename(RemoteDevelopment::Workspaces::FileMounts::GITLAB_GIT_CREDENTIAL_STORE_FILE), + key: File.basename(RemoteDevelopment::WorkspaceOperations::FileMounts::GITLAB_GIT_CREDENTIAL_STORE_FILE), value: GIT_CREDENTIAL_STORE_SCRIPT, variable_type: RemoteDevelopment::Enums::Workspace::WORKSPACE_VARIABLE_TYPES[:file], workspace_id: workspace_id @@ -71,7 +71,7 @@ def self.variables( }, { key: 'GIT_CONFIG_VALUE_0', - value: RemoteDevelopment::Workspaces::FileMounts::GITLAB_GIT_CREDENTIAL_STORE_FILE, + value: RemoteDevelopment::WorkspaceOperations::FileMounts::GITLAB_GIT_CREDENTIAL_STORE_FILE, variable_type: RemoteDevelopment::Enums::Workspace::WORKSPACE_VARIABLE_TYPES[:environment], workspace_id: workspace_id }, @@ -101,13 +101,13 @@ def self.variables( }, { key: 'GL_GIT_CREDENTIAL_STORE_FILE_PATH', - value: RemoteDevelopment::Workspaces::FileMounts::GITLAB_GIT_CREDENTIAL_STORE_FILE, + value: RemoteDevelopment::WorkspaceOperations::FileMounts::GITLAB_GIT_CREDENTIAL_STORE_FILE, variable_type: RemoteDevelopment::Enums::Workspace::WORKSPACE_VARIABLE_TYPES[:environment], workspace_id: workspace_id }, { key: 'GL_TOKEN_FILE_PATH', - value: RemoteDevelopment::Workspaces::FileMounts::GITLAB_TOKEN_FILE, + value: RemoteDevelopment::WorkspaceOperations::FileMounts::GITLAB_TOKEN_FILE, variable_type: RemoteDevelopment::Enums::Workspace::WORKSPACE_VARIABLE_TYPES[:environment], workspace_id: workspace_id }, @@ -144,7 +144,7 @@ def self.variables( }, { key: 'GITLAB_WORKFLOW_TOKEN_FILE', - value: RemoteDevelopment::Workspaces::FileMounts::GITLAB_TOKEN_FILE, + value: RemoteDevelopment::WorkspaceOperations::FileMounts::GITLAB_TOKEN_FILE, variable_type: RemoteDevelopment::Enums::Workspace::WORKSPACE_VARIABLE_TYPES[:environment], workspace_id: workspace_id } diff --git a/ee/lib/remote_development/workspaces/create/workspace_variables_creator.rb b/ee/lib/remote_development/workspace_operations/create/workspace_variables_creator.rb similarity index 98% rename from ee/lib/remote_development/workspaces/create/workspace_variables_creator.rb rename to ee/lib/remote_development/workspace_operations/create/workspace_variables_creator.rb index ab3874ecd7127b5e45ca545b38f1a6c4396f7a94..56d972bc31844a9ee89e3bbfbb8c240e2a2267cf 100644 --- a/ee/lib/remote_development/workspaces/create/workspace_variables_creator.rb +++ b/ee/lib/remote_development/workspace_operations/create/workspace_variables_creator.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Create class WorkspaceVariablesCreator include Messages diff --git a/ee/lib/remote_development/workspaces/file_mounts.rb b/ee/lib/remote_development/workspace_operations/file_mounts.rb similarity index 93% rename from ee/lib/remote_development/workspaces/file_mounts.rb rename to ee/lib/remote_development/workspace_operations/file_mounts.rb index 918c285e1328cd7c1aa1ec499f0638f9557a7549..596eb9bf05238c9b58ec9f02a9335e60af5419a5 100644 --- a/ee/lib/remote_development/workspaces/file_mounts.rb +++ b/ee/lib/remote_development/workspace_operations/file_mounts.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module FileMounts ROOT_DIR = "/.workspace-data" VARIABLES_DIR = "#{ROOT_DIR}/variables".freeze diff --git a/ee/lib/remote_development/workspaces/reconcile/error_type.rb b/ee/lib/remote_development/workspace_operations/reconcile/error_type.rb similarity index 90% rename from ee/lib/remote_development/workspaces/reconcile/error_type.rb rename to ee/lib/remote_development/workspace_operations/reconcile/error_type.rb index 30118540490467db8d8798391cc716d4304ab37b..e55d250a75c4d82ae21d917e998388d90736c588 100644 --- a/ee/lib/remote_development/workspaces/reconcile/error_type.rb +++ b/ee/lib/remote_development/workspace_operations/reconcile/error_type.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Reconcile module ErrorType # NOTE: Do NOT change the values of these constants diff --git a/ee/lib/remote_development/workspaces/reconcile/input/actual_state_calculator.rb b/ee/lib/remote_development/workspace_operations/reconcile/input/actual_state_calculator.rb similarity index 99% rename from ee/lib/remote_development/workspaces/reconcile/input/actual_state_calculator.rb rename to ee/lib/remote_development/workspace_operations/reconcile/input/actual_state_calculator.rb index 4ccdf9b0b068d3f8220c27a33bd6992d40a38229..b80dbf66013686404c63b386a2b35158a247b2dc 100644 --- a/ee/lib/remote_development/workspaces/reconcile/input/actual_state_calculator.rb +++ b/ee/lib/remote_development/workspace_operations/reconcile/input/actual_state_calculator.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Reconcile module Input class ActualStateCalculator diff --git a/ee/lib/remote_development/workspaces/reconcile/input/agent_info.rb b/ee/lib/remote_development/workspace_operations/reconcile/input/agent_info.rb similarity index 83% rename from ee/lib/remote_development/workspaces/reconcile/input/agent_info.rb rename to ee/lib/remote_development/workspace_operations/reconcile/input/agent_info.rb index 37b500c3a9aab9deac7e7ab94b172d12d4e4f7c6..d59ce191f4ba8a9e4b2ec48c69c1c7566f97ad1d 100644 --- a/ee/lib/remote_development/workspaces/reconcile/input/agent_info.rb +++ b/ee/lib/remote_development/workspace_operations/reconcile/input/agent_info.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Reconcile module Input class AgentInfo @@ -11,7 +11,7 @@ class AgentInfo # @param [String] namespace # @param [String] actual_state # @param [String] deployment_resource_version - # @return [RemoteDevelopment::Workspaces::Reconcile::Input::AgentInfo] + # @return [RemoteDevelopment::WorkspaceOperations::Reconcile::Input::AgentInfo] def initialize(name:, namespace:, actual_state:, deployment_resource_version:) @name = name @namespace = namespace @@ -19,7 +19,7 @@ def initialize(name:, namespace:, actual_state:, deployment_resource_version:) @deployment_resource_version = deployment_resource_version end - # @param [RemoteDevelopment::Workspaces::Input::AgentInfo] other + # @param [RemoteDevelopment::WorkspaceOperations::Input::AgentInfo] other # @return [TrueClass, FalseClass] def ==(other) return false unless other && self.class == other.class diff --git a/ee/lib/remote_development/workspaces/reconcile/input/agent_infos_observer.rb b/ee/lib/remote_development/workspace_operations/reconcile/input/agent_infos_observer.rb similarity index 99% rename from ee/lib/remote_development/workspaces/reconcile/input/agent_infos_observer.rb rename to ee/lib/remote_development/workspace_operations/reconcile/input/agent_infos_observer.rb index e686990e61e1d139e46dea9d71826c9dbf6f33a8..7961bb555d1d86c2c2741dab5b67de127ab96692 100644 --- a/ee/lib/remote_development/workspaces/reconcile/input/agent_infos_observer.rb +++ b/ee/lib/remote_development/workspace_operations/reconcile/input/agent_infos_observer.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Reconcile module Input class AgentInfosObserver diff --git a/ee/lib/remote_development/workspaces/reconcile/input/factory.rb b/ee/lib/remote_development/workspace_operations/reconcile/input/factory.rb similarity index 92% rename from ee/lib/remote_development/workspaces/reconcile/input/factory.rb rename to ee/lib/remote_development/workspace_operations/reconcile/input/factory.rb index c152b660816740358a020a37bb83087e236fc939..41dfe9d820561c5e07e304782cb2f92159446447 100644 --- a/ee/lib/remote_development/workspaces/reconcile/input/factory.rb +++ b/ee/lib/remote_development/workspace_operations/reconcile/input/factory.rb @@ -1,12 +1,12 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Reconcile module Input class Factory # @param [Hash] agent_info_hash_from_params - # @return [RemoteDevelopment::Workspaces::Reconcile::Input::AgentInfo] + # @return [RemoteDevelopment::WorkspaceOperations::Reconcile::Input::AgentInfo] def self.build(agent_info_hash_from_params:) # Hash#[] instead of Hash#fetch or destructuring is used, since the field may not be present latest_k8s_deployment_info = agent_info_hash_from_params[:latest_k8s_deployment_info] diff --git a/ee/lib/remote_development/workspaces/reconcile/input/params_extractor.rb b/ee/lib/remote_development/workspace_operations/reconcile/input/params_extractor.rb similarity index 97% rename from ee/lib/remote_development/workspaces/reconcile/input/params_extractor.rb rename to ee/lib/remote_development/workspace_operations/reconcile/input/params_extractor.rb index 6a6071618ba9eb412944bc8c8cab046f7b05ac2f..e1a3ee25166c54cac76c4f03dfd9fdd34bb49e57 100644 --- a/ee/lib/remote_development/workspaces/reconcile/input/params_extractor.rb +++ b/ee/lib/remote_development/workspace_operations/reconcile/input/params_extractor.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Reconcile module Input class ParamsExtractor diff --git a/ee/lib/remote_development/workspaces/reconcile/input/params_to_infos_converter.rb b/ee/lib/remote_development/workspace_operations/reconcile/input/params_to_infos_converter.rb similarity index 97% rename from ee/lib/remote_development/workspaces/reconcile/input/params_to_infos_converter.rb rename to ee/lib/remote_development/workspace_operations/reconcile/input/params_to_infos_converter.rb index 023eefbd643b6b0f7c53fa11a95a068891aeaccc..aeba6c588400022902f40cc0a9fc3006dc9a8bef 100644 --- a/ee/lib/remote_development/workspaces/reconcile/input/params_to_infos_converter.rb +++ b/ee/lib/remote_development/workspace_operations/reconcile/input/params_to_infos_converter.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Reconcile module Input class ParamsToInfosConverter diff --git a/ee/lib/remote_development/workspaces/reconcile/input/params_validator.rb b/ee/lib/remote_development/workspace_operations/reconcile/input/params_validator.rb similarity index 98% rename from ee/lib/remote_development/workspaces/reconcile/input/params_validator.rb rename to ee/lib/remote_development/workspace_operations/reconcile/input/params_validator.rb index bccdc22c53cf42b3a4429d10b50d9dc350f11180..82396ca62507d61a58f36cb0f1c050897088e2a0 100644 --- a/ee/lib/remote_development/workspaces/reconcile/input/params_validator.rb +++ b/ee/lib/remote_development/workspace_operations/reconcile/input/params_validator.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Reconcile module Input class ParamsValidator diff --git a/ee/lib/remote_development/workspaces/reconcile/main.rb b/ee/lib/remote_development/workspace_operations/reconcile/main.rb similarity index 98% rename from ee/lib/remote_development/workspaces/reconcile/main.rb rename to ee/lib/remote_development/workspace_operations/reconcile/main.rb index 3d93d5d1aefd998f886e7db1e25ea619c753f260..c5e7a127abccfe9219f792f251e6869195894203 100644 --- a/ee/lib/remote_development/workspaces/reconcile/main.rb +++ b/ee/lib/remote_development/workspace_operations/reconcile/main.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Reconcile class Main include Messages diff --git a/ee/lib/remote_development/workspaces/reconcile/output/desired_config_generator.rb b/ee/lib/remote_development/workspace_operations/reconcile/output/desired_config_generator.rb similarity index 98% rename from ee/lib/remote_development/workspaces/reconcile/output/desired_config_generator.rb rename to ee/lib/remote_development/workspace_operations/reconcile/output/desired_config_generator.rb index dd5d1ccb550b6c5a86e53c89393e31e1e83bc44b..1953a255726b72804b1f463eb48a8aa302bfed39 100644 --- a/ee/lib/remote_development/workspaces/reconcile/output/desired_config_generator.rb +++ b/ee/lib/remote_development/workspace_operations/reconcile/output/desired_config_generator.rb @@ -1,13 +1,13 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Reconcile module Output class DesiredConfigGenerator include States - # @param [RemoteDevelopment::Workspaces::Workspace] workspace + # @param [RemoteDevelopment::WorkspaceOperations::Workspace] workspace # @param [Boolean] include_all_resources # @param [RemoteDevelopment::Logger] logger # @return [Array<Hash>] @@ -103,7 +103,7 @@ def self.generate_desired_config(workspace:, include_all_resources:, logger:) desired_config end - # @param [RemoteDevelopment::Workspaces::Workspace] workspace + # @param [RemoteDevelopment::WorkspaceOperations::Workspace] workspace # @param [String] env_secret_name # @param [String] file_secret_name # @param [String] env_secret_name diff --git a/ee/lib/remote_development/workspaces/reconcile/output/desired_config_generator_v2.rb b/ee/lib/remote_development/workspace_operations/reconcile/output/desired_config_generator_v2.rb similarity index 98% rename from ee/lib/remote_development/workspaces/reconcile/output/desired_config_generator_v2.rb rename to ee/lib/remote_development/workspace_operations/reconcile/output/desired_config_generator_v2.rb index 6caa9f947c7474bf15dbb94ea5da9db1b36a3bc8..595a7dde80c9e49f49caf5cff08a0ed9c2bc87a3 100644 --- a/ee/lib/remote_development/workspaces/reconcile/output/desired_config_generator_v2.rb +++ b/ee/lib/remote_development/workspace_operations/reconcile/output/desired_config_generator_v2.rb @@ -1,13 +1,13 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Reconcile module Output class DesiredConfigGeneratorV2 include States - # @param [RemoteDevelopment::Workspaces::Workspace] workspace + # @param [RemoteDevelopment::WorkspaceOperations::Workspace] workspace # @param [Boolean] include_all_resources # @param [RemoteDevelopment::Logger] logger # @return [Array<Hash>] @@ -80,7 +80,7 @@ def self.generate_desired_config(workspace:, include_all_resources:, logger:) desired_config end - # @param [RemoteDevelopment::Workspaces::Workspace] workspace + # @param [RemoteDevelopment::WorkspaceOperations::Workspace] workspace # @param [String] env_secret_name # @param [String] file_secret_name # @param [String] env_secret_name diff --git a/ee/lib/remote_development/workspaces/reconcile/output/devfile_parser.rb b/ee/lib/remote_development/workspace_operations/reconcile/output/devfile_parser.rb similarity index 98% rename from ee/lib/remote_development/workspaces/reconcile/output/devfile_parser.rb rename to ee/lib/remote_development/workspace_operations/reconcile/output/devfile_parser.rb index b4abd2a9f3dc3b55cd370278a4082d081d43e80a..4270dd6b6e33e4f7bb45dee50a4a0314cbe6a8be 100644 --- a/ee/lib/remote_development/workspaces/reconcile/output/devfile_parser.rb +++ b/ee/lib/remote_development/workspace_operations/reconcile/output/devfile_parser.rb @@ -3,7 +3,7 @@ require 'devfile' module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Reconcile module Output class DevfileParser @@ -161,7 +161,7 @@ def self.inject_secrets(workspace_resources:, env_secret_names:, file_secret_nam volume_mounts = [ { 'name' => volume_name, - 'mountPath' => RemoteDevelopment::Workspaces::FileMounts::VARIABLES_FILE_DIR + 'mountPath' => RemoteDevelopment::WorkspaceOperations::FileMounts::VARIABLES_FILE_DIR } ] env_from = env_secret_names.map { |v| { 'secretRef' => { 'name' => v } } } diff --git a/ee/lib/remote_development/workspaces/reconcile/output/devfile_parser_v2.rb b/ee/lib/remote_development/workspace_operations/reconcile/output/devfile_parser_v2.rb similarity index 97% rename from ee/lib/remote_development/workspaces/reconcile/output/devfile_parser_v2.rb rename to ee/lib/remote_development/workspace_operations/reconcile/output/devfile_parser_v2.rb index 052adb51ce1e32ef5a89531a09f24ed7afac4a86..41b39ab61aa094b3f63675783dc6e9c0c7ad09b5 100644 --- a/ee/lib/remote_development/workspaces/reconcile/output/devfile_parser_v2.rb +++ b/ee/lib/remote_development/workspace_operations/reconcile/output/devfile_parser_v2.rb @@ -3,7 +3,7 @@ require 'devfile' module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Reconcile module Output class DevfileParserV2 @@ -128,7 +128,7 @@ def self.inject_secrets(workspace_resources:, env_secret_names:, file_secret_nam volume_mounts = [ { 'name' => volume_name, - 'mountPath' => RemoteDevelopment::Workspaces::FileMounts::VARIABLES_FILE_DIR + 'mountPath' => RemoteDevelopment::WorkspaceOperations::FileMounts::VARIABLES_FILE_DIR } ] env_from = env_secret_names.map { |v| { 'secretRef' => { 'name' => v } } } diff --git a/ee/lib/remote_development/workspaces/reconcile/output/response_payload_builder.rb b/ee/lib/remote_development/workspace_operations/reconcile/output/response_payload_builder.rb similarity index 97% rename from ee/lib/remote_development/workspaces/reconcile/output/response_payload_builder.rb rename to ee/lib/remote_development/workspace_operations/reconcile/output/response_payload_builder.rb index 6ba6788624714685c3aee52dc7ce428d983f08f6..c35b4914897a21d9f4e3bdb251f487c005d4038c 100644 --- a/ee/lib/remote_development/workspaces/reconcile/output/response_payload_builder.rb +++ b/ee/lib/remote_development/workspace_operations/reconcile/output/response_payload_builder.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Reconcile module Output class ResponsePayloadBuilder @@ -81,7 +81,7 @@ def self.config_to_apply(workspace:, update_type:, logger:) logger: logger ) else - namespace = "RemoteDevelopment::Workspaces::Reconcile::Output" + namespace = "RemoteDevelopment::WorkspaceOperations::Reconcile::Output" generator_class_name = "#{namespace}::DesiredConfigGeneratorV#{workspace.config_version}" generator_class = Object.const_get(generator_class_name, false) generator_class.generate_desired_config( diff --git a/ee/lib/remote_development/workspaces/reconcile/output/response_payload_observer.rb b/ee/lib/remote_development/workspace_operations/reconcile/output/response_payload_observer.rb similarity index 98% rename from ee/lib/remote_development/workspaces/reconcile/output/response_payload_observer.rb rename to ee/lib/remote_development/workspace_operations/reconcile/output/response_payload_observer.rb index b84d1b44d2ce7168a127efa709b6ca4507acfbab..d073ceb602d593c7fe4a4d9a339267d02f15524c 100644 --- a/ee/lib/remote_development/workspaces/reconcile/output/response_payload_observer.rb +++ b/ee/lib/remote_development/workspace_operations/reconcile/output/response_payload_observer.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Reconcile module Output class ResponsePayloadObserver diff --git a/ee/lib/remote_development/workspaces/reconcile/persistence/orphaned_workspaces_observer.rb b/ee/lib/remote_development/workspace_operations/reconcile/persistence/orphaned_workspaces_observer.rb similarity index 98% rename from ee/lib/remote_development/workspaces/reconcile/persistence/orphaned_workspaces_observer.rb rename to ee/lib/remote_development/workspace_operations/reconcile/persistence/orphaned_workspaces_observer.rb index 546c4eb835b28366d73d46813e0f7ffa2f2e89c0..416418b50c88d2ac3539b9d367e027ab9dd364bc 100644 --- a/ee/lib/remote_development/workspaces/reconcile/persistence/orphaned_workspaces_observer.rb +++ b/ee/lib/remote_development/workspace_operations/reconcile/persistence/orphaned_workspaces_observer.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Reconcile module Persistence class OrphanedWorkspacesObserver diff --git a/ee/lib/remote_development/workspaces/reconcile/persistence/workspaces_from_agent_infos_updater.rb b/ee/lib/remote_development/workspace_operations/reconcile/persistence/workspaces_from_agent_infos_updater.rb similarity index 99% rename from ee/lib/remote_development/workspaces/reconcile/persistence/workspaces_from_agent_infos_updater.rb rename to ee/lib/remote_development/workspace_operations/reconcile/persistence/workspaces_from_agent_infos_updater.rb index 9a0c6be7d63087ce783c4c603758b9baa2c1a6b6..5419bc063465276230fdfdd20a56f199fe0e2cf3 100644 --- a/ee/lib/remote_development/workspaces/reconcile/persistence/workspaces_from_agent_infos_updater.rb +++ b/ee/lib/remote_development/workspace_operations/reconcile/persistence/workspaces_from_agent_infos_updater.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Reconcile module Persistence class WorkspacesFromAgentInfosUpdater diff --git a/ee/lib/remote_development/workspaces/reconcile/persistence/workspaces_to_be_returned_finder.rb b/ee/lib/remote_development/workspace_operations/reconcile/persistence/workspaces_to_be_returned_finder.rb similarity index 90% rename from ee/lib/remote_development/workspaces/reconcile/persistence/workspaces_to_be_returned_finder.rb rename to ee/lib/remote_development/workspace_operations/reconcile/persistence/workspaces_to_be_returned_finder.rb index 5d82270e9df6ee5b4c872e47f473ada44fac4035..a190e3448a521df97c3669b113b5ba180ea61786 100644 --- a/ee/lib/remote_development/workspaces/reconcile/persistence/workspaces_to_be_returned_finder.rb +++ b/ee/lib/remote_development/workspace_operations/reconcile/persistence/workspaces_to_be_returned_finder.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Reconcile module Persistence class WorkspacesToBeReturnedFinder @@ -44,8 +44,8 @@ def self.generate_workspaces_to_be_returned_query(agent:, update_type:, workspac end # For a PARTIAL update, return: - # 1. Workspaces with_desired_state_updated_more_recently_than_last_response_to_agent - # 2. Workspaces which we received from the agent in the agent_infos array + # 1. WorkspaceOperations with_desired_state_updated_more_recently_than_last_response_to_agent + # 2. WorkspaceOperations which we received from the agent in the agent_infos array workspaces_from_agent_infos_ids = workspaces_from_agent_infos.map(&:id) agent .workspaces diff --git a/ee/lib/remote_development/workspaces/reconcile/persistence/workspaces_to_be_returned_updater.rb b/ee/lib/remote_development/workspace_operations/reconcile/persistence/workspaces_to_be_returned_updater.rb similarity index 97% rename from ee/lib/remote_development/workspaces/reconcile/persistence/workspaces_to_be_returned_updater.rb rename to ee/lib/remote_development/workspace_operations/reconcile/persistence/workspaces_to_be_returned_updater.rb index e2251c7b7dc5c806dfd5bda6dfed42eeb93af04b..7ae13448ea138cd826d1f0a2eba56466dea2748e 100644 --- a/ee/lib/remote_development/workspaces/reconcile/persistence/workspaces_to_be_returned_updater.rb +++ b/ee/lib/remote_development/workspace_operations/reconcile/persistence/workspaces_to_be_returned_updater.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Reconcile module Persistence class WorkspacesToBeReturnedUpdater diff --git a/ee/lib/remote_development/workspaces/reconcile/termination_progress.rb b/ee/lib/remote_development/workspace_operations/reconcile/termination_progress.rb similarity index 87% rename from ee/lib/remote_development/workspaces/reconcile/termination_progress.rb rename to ee/lib/remote_development/workspace_operations/reconcile/termination_progress.rb index 0b948c726b64aeea9ace4c2a74dd2b2fee1c3ebc..e08cc0ace1ea86a79e7afa4ba7349a1f52d82f30 100644 --- a/ee/lib/remote_development/workspaces/reconcile/termination_progress.rb +++ b/ee/lib/remote_development/workspace_operations/reconcile/termination_progress.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Reconcile module TerminationProgress TERMINATING = "Terminating" diff --git a/ee/lib/remote_development/workspaces/reconcile/update_types.rb b/ee/lib/remote_development/workspace_operations/reconcile/update_types.rb similarity index 86% rename from ee/lib/remote_development/workspaces/reconcile/update_types.rb rename to ee/lib/remote_development/workspace_operations/reconcile/update_types.rb index d4103febf67ae5bf20650cf4998892f67eb55eca..77c082f1b2316f3195b341efb35a83e505e6cce2 100644 --- a/ee/lib/remote_development/workspaces/reconcile/update_types.rb +++ b/ee/lib/remote_development/workspace_operations/reconcile/update_types.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Reconcile module UpdateTypes PARTIAL = 'partial' diff --git a/ee/lib/remote_development/workspaces/states.rb b/ee/lib/remote_development/workspace_operations/states.rb similarity index 98% rename from ee/lib/remote_development/workspaces/states.rb rename to ee/lib/remote_development/workspace_operations/states.rb index a8a4615876905cd07e8e5841e0c92348ca4742a5..e6fa846d7538d6521f58bb4300f8d730ec78c23e 100644 --- a/ee/lib/remote_development/workspaces/states.rb +++ b/ee/lib/remote_development/workspace_operations/states.rb @@ -2,7 +2,7 @@ # See: https://gitlab.com/gitlab-org/remote-development/gitlab-remote-development-docs/blob/main/doc/architecture.md?plain=0#workspace-states module RemoteDevelopment - module Workspaces + module WorkspaceOperations module States CREATION_REQUESTED = 'CreationRequested' STARTING = 'Starting' diff --git a/ee/lib/remote_development/workspaces/update/authorizer.rb b/ee/lib/remote_development/workspace_operations/update/authorizer.rb similarity index 95% rename from ee/lib/remote_development/workspaces/update/authorizer.rb rename to ee/lib/remote_development/workspace_operations/update/authorizer.rb index 9170acf0f6737c7f6cb4f808bb0537c600cec94a..8375f326600e32d8bce6c0b42bd15e215f7cadd5 100644 --- a/ee/lib/remote_development/workspaces/update/authorizer.rb +++ b/ee/lib/remote_development/workspace_operations/update/authorizer.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Update class Authorizer include Messages diff --git a/ee/lib/remote_development/workspaces/update/main.rb b/ee/lib/remote_development/workspace_operations/update/main.rb similarity index 97% rename from ee/lib/remote_development/workspaces/update/main.rb rename to ee/lib/remote_development/workspace_operations/update/main.rb index 4a41c9d9dc2152e28a23fe5ff68d7285a8b81056..891bc533b729a973acd9f32d47e76b200e26b8bd 100644 --- a/ee/lib/remote_development/workspaces/update/main.rb +++ b/ee/lib/remote_development/workspace_operations/update/main.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Update class Main include Messages diff --git a/ee/lib/remote_development/workspaces/update/updater.rb b/ee/lib/remote_development/workspace_operations/update/updater.rb similarity index 97% rename from ee/lib/remote_development/workspaces/update/updater.rb rename to ee/lib/remote_development/workspace_operations/update/updater.rb index f29693aae1f2c989c05fd031f5c9e8c65bd4fa61..6e0eb053545179f4ef520fc45e5b5beeba6c51c1 100644 --- a/ee/lib/remote_development/workspaces/update/updater.rb +++ b/ee/lib/remote_development/workspace_operations/update/updater.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - module Workspaces + module WorkspaceOperations module Update class Updater include Messages diff --git a/ee/spec/factories/remote_development/workspaces.rb b/ee/spec/factories/remote_development/workspaces.rb index 0beae5e16d91bfddbfad42921873bb41c7b30490..a90db067f1ee349a311ac3f2ab086818e8c134e2 100644 --- a/ee/spec/factories/remote_development/workspaces.rb +++ b/ee/spec/factories/remote_development/workspaces.rb @@ -9,13 +9,13 @@ personal_access_token name { "workspace-#{agent.id}-#{user.id}-#{random_string}" } - config_version { RemoteDevelopment::Workspaces::ConfigVersion::LATEST_VERSION } + config_version { RemoteDevelopment::WorkspaceOperations::ConfigVersion::LATEST_VERSION } force_include_all_resources { true } add_attribute(:namespace) { "gl-rd-ns-#{agent.id}-#{user.id}-#{random_string}" } - desired_state { RemoteDevelopment::Workspaces::States::STOPPED } - actual_state { RemoteDevelopment::Workspaces::States::STOPPED } + desired_state { RemoteDevelopment::WorkspaceOperations::States::STOPPED } + actual_state { RemoteDevelopment::WorkspaceOperations::States::STOPPED } deployment_resource_version { 2 } editor { 'webide' } max_hours_before_termination { 24 } @@ -76,7 +76,7 @@ ) else unless evaluator.without_workspace_variables - workspace_variables = RemoteDevelopment::Workspaces::Create::WorkspaceVariables.variables( + workspace_variables = RemoteDevelopment::WorkspaceOperations::Create::WorkspaceVariables.variables( name: workspace.name, dns_zone: workspace.dns_zone, personal_access_token_value: workspace.personal_access_token.token, @@ -118,8 +118,8 @@ end trait :unprovisioned do - desired_state { RemoteDevelopment::Workspaces::States::RUNNING } - actual_state { RemoteDevelopment::Workspaces::States::CREATION_REQUESTED } + desired_state { RemoteDevelopment::WorkspaceOperations::States::RUNNING } + actual_state { RemoteDevelopment::WorkspaceOperations::States::CREATION_REQUESTED } responded_to_agent_at { nil } deployment_resource_version { nil } end diff --git a/ee/spec/features/remote_development/workspaces_dropdown_group_spec.rb b/ee/spec/features/remote_development/workspaces_dropdown_group_spec.rb index 03b9d2948b02ec6ae1316b2bf43c4ded35652fb3..f774cec96de62b124d59244a2746d789638a2ae9 100644 --- a/ee/spec/features/remote_development/workspaces_dropdown_group_spec.rb +++ b/ee/spec/features/remote_development/workspaces_dropdown_group_spec.rb @@ -24,8 +24,8 @@ let_it_be(:workspace) do create(:workspace, user: user, updated_at: 2.days.ago, project_id: project.id, - actual_state: ::RemoteDevelopment::Workspaces::States::RUNNING, - desired_state: ::RemoteDevelopment::Workspaces::States::RUNNING + actual_state: ::RemoteDevelopment::WorkspaceOperations::States::RUNNING, + desired_state: ::RemoteDevelopment::WorkspaceOperations::States::RUNNING ) end diff --git a/ee/spec/features/remote_development/workspaces_spec.rb b/ee/spec/features/remote_development/workspaces_spec.rb index 0fef0da7609eb97e3c06f0a78c7bd1682cd4dde5..d8f83c3eba5e73606de182a4c1a8c8caaed03f79 100644 --- a/ee/spec/features/remote_development/workspaces_spec.rb +++ b/ee/spec/features/remote_development/workspaces_spec.rb @@ -115,7 +115,7 @@ end # ASSERT WORKSPACE SHOWS RUNNING STATE IN UI AND UPDATES URL - expect_workspace_state_indicator(RemoteDevelopment::Workspaces::States::RUNNING) + expect_workspace_state_indicator(RemoteDevelopment::WorkspaceOperations::States::RUNNING) expect(page).to have_selector('a', text: workspace.url) # ASSERT ACTION BUTTONS ARE CORRECT FOR RUNNING STATE @@ -138,7 +138,7 @@ end # ASSERT WORKSPACE SHOWS STOPPING STATE IN UI - expect_workspace_state_indicator(RemoteDevelopment::Workspaces::States::STOPPING) + expect_workspace_state_indicator(RemoteDevelopment::WorkspaceOperations::States::STOPPING) # ASSERT ACTION BUTTONS ARE CORRECT FOR STOPPING STATE # TODO: What other buttons are there? @@ -154,7 +154,7 @@ end # ASSERT WORKSPACE SHOWS STOPPED STATE IN UI - expect_workspace_state_indicator(RemoteDevelopment::Workspaces::States::STOPPED) + expect_workspace_state_indicator(RemoteDevelopment::WorkspaceOperations::States::STOPPED) # ASSERT ACTION BUTTONS ARE CORRECT FOR STOPPED STATE expect(page).to have_button('Start') diff --git a/ee/spec/finders/remote_development/workspaces_finder_spec.rb b/ee/spec/finders/remote_development/workspaces_finder_spec.rb index 556aff610d7ee03b64bc8ecd1eabcb1d240235b3..94390aa6097d14ed17a2c2d586dde257b564ea26 100644 --- a/ee/spec/finders/remote_development/workspaces_finder_spec.rb +++ b/ee/spec/finders/remote_development/workspaces_finder_spec.rb @@ -3,7 +3,7 @@ require "spec_helper" RSpec.describe RemoteDevelopment::WorkspacesFinder, feature_category: :remote_development do - include ::RemoteDevelopment::Workspaces::States + include ::RemoteDevelopment::WorkspaceOperations::States let_it_be(:current_user) { create(:user) } @@ -22,20 +22,20 @@ let_it_be(:project_c) { create(:project, :public) } let_it_be(:workspace_a) do create(:workspace, user: workspace_owner_user, updated_at: 2.days.ago, project: project_a, - actual_state: ::RemoteDevelopment::Workspaces::States::RUNNING, agent: agent_a + actual_state: ::RemoteDevelopment::WorkspaceOperations::States::RUNNING, agent: agent_a ) end let_it_be(:workspace_b) do create(:workspace, user: workspace_owner_user, updated_at: 1.day.ago, project: project_b, - actual_state: ::RemoteDevelopment::Workspaces::States::TERMINATED, agent: agent_b + actual_state: ::RemoteDevelopment::WorkspaceOperations::States::TERMINATED, agent: agent_b ) end let_it_be(:other_user) { create(:user) } let_it_be(:other_users_workspace) do create(:workspace, user: other_user, project_id: project_c.id, - actual_state: ::RemoteDevelopment::Workspaces::States::TERMINATED, agent: agent_b + actual_state: ::RemoteDevelopment::WorkspaceOperations::States::TERMINATED, agent: agent_b ) end @@ -85,7 +85,7 @@ end context "with actual_states argument" do - let(:filter_arguments) { { actual_states: [::RemoteDevelopment::Workspaces::States::RUNNING] } } + let(:filter_arguments) { { actual_states: [::RemoteDevelopment::WorkspaceOperations::States::RUNNING] } } it "returns only workspaces matching the specified actual_states" do expect(collection_proxy).to contain_exactly(workspace_a) @@ -100,8 +100,8 @@ project_ids: [project_a.id, project_b.id, project_c.id], agent_ids: [agent_a.id, agent_b.id], actual_states: [ - ::RemoteDevelopment::Workspaces::States::RUNNING, - ::RemoteDevelopment::Workspaces::States::TERMINATED + ::RemoteDevelopment::WorkspaceOperations::States::RUNNING, + ::RemoteDevelopment::WorkspaceOperations::States::TERMINATED ] } end diff --git a/ee/spec/lib/gitlab/background_migration/update_workspaces_config_version_spec.rb b/ee/spec/lib/gitlab/background_migration/update_workspaces_config_version_spec.rb index 078f3155456c485555aa597b2b6c0cb3c0679410..e122700f319af7ec94db20f78ae1bf07720f2556 100644 --- a/ee/spec/lib/gitlab/background_migration/update_workspaces_config_version_spec.rb +++ b/ee/spec/lib/gitlab/background_migration/update_workspaces_config_version_spec.rb @@ -4,8 +4,8 @@ RSpec.describe Gitlab::BackgroundMigration::UpdateWorkspacesConfigVersion, feature_category: :remote_development do describe "#perform" do - let(:v1) { RemoteDevelopment::Workspaces::ConfigVersion::VERSION_1 } - let(:v2) { RemoteDevelopment::Workspaces::ConfigVersion::VERSION_2 } + let(:v1) { RemoteDevelopment::WorkspaceOperations::ConfigVersion::VERSION_1 } + let(:v2) { RemoteDevelopment::WorkspaceOperations::ConfigVersion::VERSION_2 } let(:personal_access_tokens_table) { table(:personal_access_tokens) } let(:pat) do personal_access_tokens_table.create!(name: 'workspace1', user_id: user.id, scopes: "---\n- api\n", @@ -21,7 +21,7 @@ desired_state_updated_at: 2.seconds.ago, max_hours_before_termination: 19, namespace: 'ns', - desired_state: ::RemoteDevelopment::Workspaces::States::RUNNING, + desired_state: ::RemoteDevelopment::WorkspaceOperations::States::RUNNING, editor: 'e', devfile_ref: 'dfr', devfile_path: 'dev/path', @@ -42,7 +42,7 @@ workspaces_table.create!({ name: 'workspace1', config_version: v1, - actual_state: ::RemoteDevelopment::Workspaces::States::TERMINATED, + actual_state: ::RemoteDevelopment::WorkspaceOperations::States::TERMINATED, force_include_all_resources: false }.merge!(workspace_attrs)) end @@ -51,7 +51,7 @@ workspaces_table.create!({ name: 'workspace2', config_version: v1, - actual_state: ::RemoteDevelopment::Workspaces::States::RUNNING + actual_state: ::RemoteDevelopment::WorkspaceOperations::States::RUNNING }.merge!(workspace_attrs)) end @@ -59,7 +59,7 @@ workspaces_table.create!({ name: 'workspace3', config_version: v2, - actual_state: ::RemoteDevelopment::Workspaces::States::RUNNING, + actual_state: ::RemoteDevelopment::WorkspaceOperations::States::RUNNING, force_include_all_resources: false }.merge!(workspace_attrs)) end diff --git a/ee/spec/lib/remote_development/agent_config/license_checker_spec.rb b/ee/spec/lib/remote_development/agent_config_operations/license_checker_spec.rb similarity index 87% rename from ee/spec/lib/remote_development/agent_config/license_checker_spec.rb rename to ee/spec/lib/remote_development/agent_config_operations/license_checker_spec.rb index 639bae06009049db928f7bb26eca39db527b5d49..c9d1ab92b370ae2ef96417c1f10047c259631547 100644 --- a/ee/spec/lib/remote_development/agent_config/license_checker_spec.rb +++ b/ee/spec/lib/remote_development/agent_config_operations/license_checker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe RemoteDevelopment::AgentConfig::LicenseChecker, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::AgentConfigOperations::LicenseChecker, feature_category: :remote_development do include ResultMatchers let(:context) { instance_double(Hash) } diff --git a/ee/spec/lib/remote_development/agent_config/main_integration_spec.rb b/ee/spec/lib/remote_development/agent_config_operations/main_integration_spec.rb similarity index 97% rename from ee/spec/lib/remote_development/agent_config/main_integration_spec.rb rename to ee/spec/lib/remote_development/agent_config_operations/main_integration_spec.rb index 5947a5011bfadc8b310e8709de72432c76e5fddf..fd598ae98d965eedfd7268769e54e0187e9e0550 100644 --- a/ee/spec/lib/remote_development/agent_config/main_integration_spec.rb +++ b/ee/spec/lib/remote_development/agent_config_operations/main_integration_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::RemoteDevelopment::AgentConfig::Main, "Integration", feature_category: :remote_development do +RSpec.describe ::RemoteDevelopment::AgentConfigOperations::Main, "Integration", feature_category: :remote_development do let(:enabled) { true } let(:dns_zone) { 'my-awesome-domain.me' } diff --git a/ee/spec/lib/remote_development/agent_config/main_spec.rb b/ee/spec/lib/remote_development/agent_config_operations/main_spec.rb similarity index 88% rename from ee/spec/lib/remote_development/agent_config/main_spec.rb rename to ee/spec/lib/remote_development/agent_config_operations/main_spec.rb index e74d2d11163da162ad3da1138a0e80ca2e67ef4a..13e886fec6655c71714b9c9c3232f665e8b87c67 100644 --- a/ee/spec/lib/remote_development/agent_config/main_spec.rb +++ b/ee/spec/lib/remote_development/agent_config_operations/main_spec.rb @@ -2,13 +2,13 @@ require "fast_spec_helper" -RSpec.describe RemoteDevelopment::AgentConfig::Main, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::AgentConfigOperations::Main, feature_category: :remote_development do let(:context_passed_along_steps) { {} } let(:rop_steps) do [ - [RemoteDevelopment::AgentConfig::LicenseChecker, :and_then], - [RemoteDevelopment::AgentConfig::Updater, :and_then] + [RemoteDevelopment::AgentConfigOperations::LicenseChecker, :and_then], + [RemoteDevelopment::AgentConfigOperations::Updater, :and_then] ] end @@ -37,7 +37,7 @@ [ "when Updater returns AgentConfigUpdateSuccessful", { - step_class: RemoteDevelopment::AgentConfig::Updater, + step_class: RemoteDevelopment::AgentConfigOperations::Updater, returned_message: lazy { RemoteDevelopment::Messages::AgentConfigUpdateSuccessful.new(ok_message_content) } }, { @@ -48,7 +48,7 @@ [ "when Updater returns AgentConfigUpdateSkippedBecauseNoConfigFileEntryFound", { - step_class: RemoteDevelopment::AgentConfig::Updater, + step_class: RemoteDevelopment::AgentConfigOperations::Updater, returned_message: lazy { RemoteDevelopment::Messages::AgentConfigUpdateSkippedBecauseNoConfigFileEntryFound.new(skipped_message_content) } }, { @@ -90,7 +90,7 @@ [ "when LicenseChecker returns LicenseCheckFailed", { - step_class: RemoteDevelopment::AgentConfig::LicenseChecker, + step_class: RemoteDevelopment::AgentConfigOperations::LicenseChecker, returned_message: lazy { RemoteDevelopment::Messages::LicenseCheckFailed.new(err_message_content) } }, { @@ -102,7 +102,7 @@ [ "when Updater returns AgentConfigUpdateFailed", { - step_class: RemoteDevelopment::AgentConfig::Updater, + step_class: RemoteDevelopment::AgentConfigOperations::Updater, returned_message: lazy { RemoteDevelopment::Messages::AgentConfigUpdateFailed.new(err_message_content) } }, { @@ -114,7 +114,7 @@ [ "when an unmatched error is returned, an exception is raised", { - step_class: RemoteDevelopment::NamespaceClusterAgentMappings::Delete::MappingDeleter, + step_class: RemoteDevelopment::NamespaceClusterAgentMappingOperations::Delete::MappingDeleter, returned_message: lazy { Class.new(Gitlab::Fp::Message).new(err_message_content) } }, Gitlab::Fp::UnmatchedResultError diff --git a/ee/spec/lib/remote_development/agent_config/updater_spec.rb b/ee/spec/lib/remote_development/agent_config_operations/updater_spec.rb similarity index 97% rename from ee/spec/lib/remote_development/agent_config/updater_spec.rb rename to ee/spec/lib/remote_development/agent_config_operations/updater_spec.rb index 0e2476e5dc6b612691720558ee754e89e4433d88..b71d24e13501c81c786cf50ba2e1eba6265a0c19 100644 --- a/ee/spec/lib/remote_development/agent_config/updater_spec.rb +++ b/ee/spec/lib/remote_development/agent_config_operations/updater_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' # rubocop:disable RSpec/MultipleMemoizedHelpers -- Can we have less? -RSpec.describe ::RemoteDevelopment::AgentConfig::Updater, feature_category: :remote_development do +RSpec.describe ::RemoteDevelopment::AgentConfigOperations::Updater, feature_category: :remote_development do include ResultMatchers let(:enabled) { true } @@ -277,8 +277,8 @@ create( :workspace, agent: agent, - actual_state: RemoteDevelopment::Workspaces::States::RUNNING, - desired_state: RemoteDevelopment::Workspaces::States::RUNNING, + actual_state: RemoteDevelopment::WorkspaceOperations::States::RUNNING, + desired_state: RemoteDevelopment::WorkspaceOperations::States::RUNNING, dns_zone: old_dns_zone, force_include_all_resources: false ) @@ -288,8 +288,8 @@ create( :workspace, agent: agent, - actual_state: RemoteDevelopment::Workspaces::States::RUNNING, - desired_state: RemoteDevelopment::Workspaces::States::TERMINATED, + actual_state: RemoteDevelopment::WorkspaceOperations::States::RUNNING, + desired_state: RemoteDevelopment::WorkspaceOperations::States::TERMINATED, dns_zone: old_dns_zone, force_include_all_resources: false ) diff --git a/ee/spec/lib/remote_development/namespace_cluster_agent_mappings/create/cluster_agent_validator_spec.rb b/ee/spec/lib/remote_development/namespace_cluster_agent_mapping_operations/create/cluster_agent_validator_spec.rb similarity index 87% rename from ee/spec/lib/remote_development/namespace_cluster_agent_mappings/create/cluster_agent_validator_spec.rb rename to ee/spec/lib/remote_development/namespace_cluster_agent_mapping_operations/create/cluster_agent_validator_spec.rb index 37893d6b2ac202ddf56b52a133622f224dec02bc..5e6c9c6e442f108f70f895d97aaae716e8a9a0ad 100644 --- a/ee/spec/lib/remote_development/namespace_cluster_agent_mappings/create/cluster_agent_validator_spec.rb +++ b/ee/spec/lib/remote_development/namespace_cluster_agent_mapping_operations/create/cluster_agent_validator_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe RemoteDevelopment::NamespaceClusterAgentMappings::Create::ClusterAgentValidator, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::NamespaceClusterAgentMappingOperations::Create::ClusterAgentValidator, feature_category: :remote_development do include ResultMatchers # NOTE: reload is necessary to calculate traversal IDs diff --git a/ee/spec/lib/remote_development/namespace_cluster_agent_mappings/create/main_integration_spec.rb b/ee/spec/lib/remote_development/namespace_cluster_agent_mapping_operations/create/main_integration_spec.rb similarity index 97% rename from ee/spec/lib/remote_development/namespace_cluster_agent_mappings/create/main_integration_spec.rb rename to ee/spec/lib/remote_development/namespace_cluster_agent_mapping_operations/create/main_integration_spec.rb index e36faed1f4904aa2bca5da879f8ac54ee3d010de..f1d1b42475312ff6b1b8548d4bce868d7b4bde3b 100644 --- a/ee/spec/lib/remote_development/namespace_cluster_agent_mappings/create/main_integration_spec.rb +++ b/ee/spec/lib/remote_development/namespace_cluster_agent_mapping_operations/create/main_integration_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::RemoteDevelopment::NamespaceClusterAgentMappings::Create::Main, feature_category: :remote_development do +RSpec.describe ::RemoteDevelopment::NamespaceClusterAgentMappingOperations::Create::Main, feature_category: :remote_development do let_it_be(:creator) { create(:user) } # NOTE: reload is necessary to calculate traversal IDs let_it_be_with_reload(:cluster_agent) do diff --git a/ee/spec/lib/remote_development/namespace_cluster_agent_mappings/create/main_spec.rb b/ee/spec/lib/remote_development/namespace_cluster_agent_mapping_operations/create/main_spec.rb similarity index 88% rename from ee/spec/lib/remote_development/namespace_cluster_agent_mappings/create/main_spec.rb rename to ee/spec/lib/remote_development/namespace_cluster_agent_mapping_operations/create/main_spec.rb index 7d658ad0cef83d0c8ed321c17ca969aa9b856f7f..c8dd54aab521d55ea6d01e2850125f7560892cff 100644 --- a/ee/spec/lib/remote_development/namespace_cluster_agent_mappings/create/main_spec.rb +++ b/ee/spec/lib/remote_development/namespace_cluster_agent_mapping_operations/create/main_spec.rb @@ -2,12 +2,12 @@ require "fast_spec_helper" -RSpec.describe RemoteDevelopment::NamespaceClusterAgentMappings::Create::Main, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::NamespaceClusterAgentMappingOperations::Create::Main, feature_category: :remote_development do let(:context_passed_along_steps) { {} } let(:rop_steps) do [ - [RemoteDevelopment::NamespaceClusterAgentMappings::Create::ClusterAgentValidator, :and_then], - [RemoteDevelopment::NamespaceClusterAgentMappings::Create::MappingCreator, :and_then] + [RemoteDevelopment::NamespaceClusterAgentMappingOperations::Create::ClusterAgentValidator, :and_then], + [RemoteDevelopment::NamespaceClusterAgentMappingOperations::Create::MappingCreator, :and_then] ] end @@ -31,7 +31,7 @@ .with_context_passed_along_steps(context_passed_along_steps) .with_ok_result_for_step( { - step_class: RemoteDevelopment::NamespaceClusterAgentMappings::Create::MappingCreator, + step_class: RemoteDevelopment::NamespaceClusterAgentMappingOperations::Create::MappingCreator, returned_message: RemoteDevelopment::Messages::NamespaceClusterAgentMappingCreateSuccessful.new( ok_message_content ) @@ -66,7 +66,7 @@ [ "when ClusterAgentValidator returns NamespaceClusterAgentMappingCreateValidationFailed", { - step_class: RemoteDevelopment::NamespaceClusterAgentMappings::Create::ClusterAgentValidator, + step_class: RemoteDevelopment::NamespaceClusterAgentMappingOperations::Create::ClusterAgentValidator, returned_message: lazy { RemoteDevelopment::Messages::NamespaceClusterAgentMappingCreateValidationFailed.new(err_message_content) } }, { @@ -78,7 +78,7 @@ [ "when MappingCreator returns NamespaceClusterAgentMappingCreateFailed", { - step_class: RemoteDevelopment::NamespaceClusterAgentMappings::Create::MappingCreator, + step_class: RemoteDevelopment::NamespaceClusterAgentMappingOperations::Create::MappingCreator, returned_message: lazy { RemoteDevelopment::Messages::NamespaceClusterAgentMappingCreateFailed.new(err_message_content) } }, @@ -92,7 +92,7 @@ [ "when MappingCreator returns NamespaceClusterAgentMappingAlreadyExists", { - step_class: RemoteDevelopment::NamespaceClusterAgentMappings::Create::MappingCreator, + step_class: RemoteDevelopment::NamespaceClusterAgentMappingOperations::Create::MappingCreator, returned_message: lazy { RemoteDevelopment::Messages::NamespaceClusterAgentMappingAlreadyExists.new(err_message_content) } }, @@ -105,7 +105,7 @@ [ "when an unmatched error is returned, an exception is raised", { - step_class: RemoteDevelopment::NamespaceClusterAgentMappings::Create::ClusterAgentValidator, + step_class: RemoteDevelopment::NamespaceClusterAgentMappingOperations::Create::ClusterAgentValidator, returned_message: lazy { Class.new(Gitlab::Fp::Message).new(err_message_content) } }, Gitlab::Fp::UnmatchedResultError, diff --git a/ee/spec/lib/remote_development/namespace_cluster_agent_mappings/create/mapping_creator_spec.rb b/ee/spec/lib/remote_development/namespace_cluster_agent_mapping_operations/create/mapping_creator_spec.rb similarity index 97% rename from ee/spec/lib/remote_development/namespace_cluster_agent_mappings/create/mapping_creator_spec.rb rename to ee/spec/lib/remote_development/namespace_cluster_agent_mapping_operations/create/mapping_creator_spec.rb index 43278b74aa367a5fa5472ab5c8c87f14eaa2d511..516612fee2c0749387ccdcfc2cfb293377395a43 100644 --- a/ee/spec/lib/remote_development/namespace_cluster_agent_mappings/create/mapping_creator_spec.rb +++ b/ee/spec/lib/remote_development/namespace_cluster_agent_mapping_operations/create/mapping_creator_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::RemoteDevelopment::NamespaceClusterAgentMappings::Create::MappingCreator, feature_category: :remote_development do +RSpec.describe ::RemoteDevelopment::NamespaceClusterAgentMappingOperations::Create::MappingCreator, feature_category: :remote_development do include ResultMatchers let_it_be(:namespace) { create(:group) } diff --git a/ee/spec/lib/remote_development/namespace_cluster_agent_mappings/delete/main_integration_spec.rb b/ee/spec/lib/remote_development/namespace_cluster_agent_mapping_operations/delete/main_integration_spec.rb similarity index 95% rename from ee/spec/lib/remote_development/namespace_cluster_agent_mappings/delete/main_integration_spec.rb rename to ee/spec/lib/remote_development/namespace_cluster_agent_mapping_operations/delete/main_integration_spec.rb index ad8117dc7c6db67f9c00321c386f26fe0ba6d117..5012792614bf918fada3e1925a21c5b99d83973d 100644 --- a/ee/spec/lib/remote_development/namespace_cluster_agent_mappings/delete/main_integration_spec.rb +++ b/ee/spec/lib/remote_development/namespace_cluster_agent_mapping_operations/delete/main_integration_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::RemoteDevelopment::NamespaceClusterAgentMappings::Delete::Main, feature_category: :remote_development do +RSpec.describe ::RemoteDevelopment::NamespaceClusterAgentMappingOperations::Delete::Main, feature_category: :remote_development do let_it_be(:namespace_cluster_agent_mapping) do create(:remote_development_namespace_cluster_agent_mapping) end diff --git a/ee/spec/lib/remote_development/namespace_cluster_agent_mappings/delete/main_spec.rb b/ee/spec/lib/remote_development/namespace_cluster_agent_mapping_operations/delete/main_spec.rb similarity index 90% rename from ee/spec/lib/remote_development/namespace_cluster_agent_mappings/delete/main_spec.rb rename to ee/spec/lib/remote_development/namespace_cluster_agent_mapping_operations/delete/main_spec.rb index 24f1b80203cfb79fcdf44bf2805b7c5371e591d4..0fee22f62ca8ed8bdbed5adbbf1470a6cbbcb839 100644 --- a/ee/spec/lib/remote_development/namespace_cluster_agent_mappings/delete/main_spec.rb +++ b/ee/spec/lib/remote_development/namespace_cluster_agent_mapping_operations/delete/main_spec.rb @@ -2,11 +2,11 @@ require "fast_spec_helper" -RSpec.describe RemoteDevelopment::NamespaceClusterAgentMappings::Delete::Main, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::NamespaceClusterAgentMappingOperations::Delete::Main, feature_category: :remote_development do let(:context_passed_along_steps) { {} } let(:rop_steps) do [ - [RemoteDevelopment::NamespaceClusterAgentMappings::Delete::MappingDeleter, :and_then] + [RemoteDevelopment::NamespaceClusterAgentMappingOperations::Delete::MappingDeleter, :and_then] ] end @@ -30,7 +30,7 @@ .with_context_passed_along_steps(context_passed_along_steps) .with_ok_result_for_step( { - step_class: RemoteDevelopment::NamespaceClusterAgentMappings::Delete::MappingDeleter, + step_class: RemoteDevelopment::NamespaceClusterAgentMappingOperations::Delete::MappingDeleter, returned_message: RemoteDevelopment::Messages::NamespaceClusterAgentMappingDeleteSuccessful.new( ok_message_content ) @@ -65,7 +65,7 @@ [ "when MappingDeleter returns NamespaceClusterAgentMappingNotFound", { - step_class: RemoteDevelopment::NamespaceClusterAgentMappings::Delete::MappingDeleter, + step_class: RemoteDevelopment::NamespaceClusterAgentMappingOperations::Delete::MappingDeleter, returned_message: lazy { RemoteDevelopment::Messages::NamespaceClusterAgentMappingNotFound.new(err_message_content) } }, { @@ -77,7 +77,7 @@ [ "when an unmatched error is returned, an exception is raised", { - step_class: RemoteDevelopment::NamespaceClusterAgentMappings::Delete::MappingDeleter, + step_class: RemoteDevelopment::NamespaceClusterAgentMappingOperations::Delete::MappingDeleter, returned_message: lazy { Class.new(Gitlab::Fp::Message).new(err_message_content) } }, Gitlab::Fp::UnmatchedResultError diff --git a/ee/spec/lib/remote_development/namespace_cluster_agent_mappings/delete/mapping_deleter_spec.rb b/ee/spec/lib/remote_development/namespace_cluster_agent_mapping_operations/delete/mapping_deleter_spec.rb similarity index 93% rename from ee/spec/lib/remote_development/namespace_cluster_agent_mappings/delete/mapping_deleter_spec.rb rename to ee/spec/lib/remote_development/namespace_cluster_agent_mapping_operations/delete/mapping_deleter_spec.rb index e230ea2b9ff4ebc3b01afc5c2d46cbe087db9d20..30be46b064c45279b825bb95d3799b4a1d5ebc9a 100644 --- a/ee/spec/lib/remote_development/namespace_cluster_agent_mappings/delete/mapping_deleter_spec.rb +++ b/ee/spec/lib/remote_development/namespace_cluster_agent_mapping_operations/delete/mapping_deleter_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::RemoteDevelopment::NamespaceClusterAgentMappings::Delete::MappingDeleter, feature_category: :remote_development do +RSpec.describe ::RemoteDevelopment::NamespaceClusterAgentMappingOperations::Delete::MappingDeleter, feature_category: :remote_development do include ResultMatchers let_it_be(:namespace) { create(:group) } diff --git a/ee/spec/lib/remote_development/namespace_cluster_agent_mappings/validations_spec.rb b/ee/spec/lib/remote_development/namespace_cluster_agent_mapping_operations/validations_spec.rb similarity index 95% rename from ee/spec/lib/remote_development/namespace_cluster_agent_mappings/validations_spec.rb rename to ee/spec/lib/remote_development/namespace_cluster_agent_mapping_operations/validations_spec.rb index eeb30209338b223c3a52e34ef9524f2619f07003..13f3525c060b9ce7424640acec04a0341b5b7517 100644 --- a/ee/spec/lib/remote_development/namespace_cluster_agent_mappings/validations_spec.rb +++ b/ee/spec/lib/remote_development/namespace_cluster_agent_mapping_operations/validations_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe RemoteDevelopment::NamespaceClusterAgentMappings::Validations, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::NamespaceClusterAgentMappingOperations::Validations, feature_category: :remote_development do describe 'filter_valid_namespace_cluster_agent_mappings' do let_it_be(:user) { create(:user) } let_it_be(:root_agent) { create(:cluster_agent) } diff --git a/ee/spec/lib/remote_development/workspaces/create/authorizer_spec.rb b/ee/spec/lib/remote_development/workspace_operations/create/authorizer_spec.rb similarity index 89% rename from ee/spec/lib/remote_development/workspaces/create/authorizer_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/create/authorizer_spec.rb index 594d60db71740f2f3128f62c9d00e146454c187c..f508c2f105da054e883c1cde81c5419fff4b1ea0 100644 --- a/ee/spec/lib/remote_development/workspaces/create/authorizer_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/create/authorizer_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe RemoteDevelopment::Workspaces::Create::Authorizer, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Create::Authorizer, feature_category: :remote_development do include ResultMatchers let(:project) { build_stubbed(:project) } diff --git a/ee/spec/lib/remote_development/workspaces/create/creator_spec.rb b/ee/spec/lib/remote_development/workspace_operations/create/creator_spec.rb similarity index 84% rename from ee/spec/lib/remote_development/workspaces/create/creator_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/create/creator_spec.rb index 71cb0eddd15e7200bd2225fb2627b61c6a58fe39..4a3cffc5e46ed7cd101507532feede316d3134a1 100644 --- a/ee/spec/lib/remote_development/workspaces/create/creator_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/create/creator_spec.rb @@ -4,12 +4,12 @@ Messages = RemoteDevelopment::Messages -RSpec.describe ::RemoteDevelopment::Workspaces::Create::Creator, feature_category: :remote_development do +RSpec.describe ::RemoteDevelopment::WorkspaceOperations::Create::Creator, feature_category: :remote_development do let(:rop_steps) do [ - [RemoteDevelopment::Workspaces::Create::PersonalAccessTokenCreator, :and_then], - [RemoteDevelopment::Workspaces::Create::WorkspaceCreator, :and_then], - [RemoteDevelopment::Workspaces::Create::WorkspaceVariablesCreator, :and_then] + [RemoteDevelopment::WorkspaceOperations::Create::PersonalAccessTokenCreator, :and_then], + [RemoteDevelopment::WorkspaceOperations::Create::WorkspaceCreator, :and_then], + [RemoteDevelopment::WorkspaceOperations::Create::WorkspaceVariablesCreator, :and_then] ] end @@ -86,7 +86,7 @@ [ "when PersonalAccessTokenCreator returns PersonalAccessTokenModelCreateFailed", { - step_class: RemoteDevelopment::Workspaces::Create::PersonalAccessTokenCreator, + step_class: RemoteDevelopment::WorkspaceOperations::Create::PersonalAccessTokenCreator, returned_message: lazy { Messages::PersonalAccessTokenModelCreateFailed.new(err_message_content) } }, lazy { Gitlab::Fp::Result.err(Messages::WorkspaceCreateFailed.new(err_message_content)) } @@ -94,7 +94,7 @@ [ "when WorkspaceCreator returns WorkspaceModelCreateFailed", { - step_class: RemoteDevelopment::Workspaces::Create::WorkspaceCreator, + step_class: RemoteDevelopment::WorkspaceOperations::Create::WorkspaceCreator, returned_message: lazy { Messages::WorkspaceModelCreateFailed.new(err_message_content) } }, lazy { Gitlab::Fp::Result.err(Messages::WorkspaceCreateFailed.new(err_message_content)) } @@ -102,7 +102,7 @@ [ "when WorkspaceVariablesCreator returns WorkspaceVariablesModelCreateFailed", { - step_class: RemoteDevelopment::Workspaces::Create::WorkspaceVariablesCreator, + step_class: RemoteDevelopment::WorkspaceOperations::Create::WorkspaceVariablesCreator, returned_message: lazy { Messages::WorkspaceVariablesModelCreateFailed.new(err_message_content) } }, lazy { Gitlab::Fp::Result.err(Messages::WorkspaceCreateFailed.new(err_message_content)) } diff --git a/ee/spec/lib/remote_development/workspaces/create/devfile_fetcher_spec.rb b/ee/spec/lib/remote_development/workspace_operations/create/devfile_fetcher_spec.rb similarity index 95% rename from ee/spec/lib/remote_development/workspaces/create/devfile_fetcher_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/create/devfile_fetcher_spec.rb index 96e1fec6ed81c073dc7bdf9c0fe5a8f62b8745db..2465ed8bbd197e8247149d801310e6927613a0f4 100644 --- a/ee/spec/lib/remote_development/workspaces/create/devfile_fetcher_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/create/devfile_fetcher_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::RemoteDevelopment::Workspaces::Create::DevfileFetcher, feature_category: :remote_development do +RSpec.describe ::RemoteDevelopment::WorkspaceOperations::Create::DevfileFetcher, feature_category: :remote_development do include ResultMatchers include_context 'with remote development shared fixtures' @@ -28,7 +28,7 @@ project: project, editor: editor, max_hours_before_termination: 24, - desired_state: RemoteDevelopment::Workspaces::States::RUNNING, + desired_state: RemoteDevelopment::WorkspaceOperations::States::RUNNING, devfile_ref: devfile_ref, devfile_path: devfile_path } diff --git a/ee/spec/lib/remote_development/workspaces/create/devfile_flattener_spec.rb b/ee/spec/lib/remote_development/workspace_operations/create/devfile_flattener_spec.rb similarity index 93% rename from ee/spec/lib/remote_development/workspaces/create/devfile_flattener_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/create/devfile_flattener_spec.rb index 05ea03a61b81f89df897f04c735f474cc8afda9f..41d7ccf8434c00c888160a4079619a773aa08273 100644 --- a/ee/spec/lib/remote_development/workspaces/create/devfile_flattener_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/create/devfile_flattener_spec.rb @@ -2,7 +2,7 @@ require "fast_spec_helper" -RSpec.describe RemoteDevelopment::Workspaces::Create::DevfileFlattener, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Create::DevfileFlattener, feature_category: :remote_development do include_context 'with remote development shared fixtures' let(:devfile_yaml) { example_devfile } diff --git a/ee/spec/lib/remote_development/workspaces/create/main_integration_spec.rb b/ee/spec/lib/remote_development/workspace_operations/create/main_integration_spec.rb similarity index 96% rename from ee/spec/lib/remote_development/workspaces/create/main_integration_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/create/main_integration_spec.rb index 9045a93130acafbe0dd327051356ad2a04455054..5452e69a2ef176d411c9cdff5cff100ff572d3fc 100644 --- a/ee/spec/lib/remote_development/workspaces/create/main_integration_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/create/main_integration_spec.rb @@ -7,7 +7,7 @@ # and any changes made to it are not reverted by let it be (even with reload). This means we also cannot use # these `let` declarations in a `before` context, so any mocking of them must occur in the examples themselves. -RSpec.describe ::RemoteDevelopment::Workspaces::Create::Main, :freeze_time, feature_category: :remote_development do +RSpec.describe ::RemoteDevelopment::WorkspaceOperations::Create::Main, :freeze_time, feature_category: :remote_development do include_context 'with remote development shared fixtures' let(:user) { create(:user) } @@ -44,7 +44,7 @@ project: project, editor: editor, max_hours_before_termination: 24, - desired_state: RemoteDevelopment::Workspaces::States::RUNNING, + desired_state: RemoteDevelopment::WorkspaceOperations::States::RUNNING, devfile_ref: devfile_ref, devfile_path: devfile_path, variables: variables @@ -105,10 +105,10 @@ workspace = response.fetch(:payload).fetch(:workspace) expect(workspace.user).to eq(user) expect(workspace.agent).to eq(agent) - expect(workspace.desired_state).to eq(RemoteDevelopment::Workspaces::States::RUNNING) + expect(workspace.desired_state).to eq(RemoteDevelopment::WorkspaceOperations::States::RUNNING) # noinspection RubyResolve expect(workspace.desired_state_updated_at).to eq(Time.current) - expect(workspace.actual_state).to eq(RemoteDevelopment::Workspaces::States::CREATION_REQUESTED) + expect(workspace.actual_state).to eq(RemoteDevelopment::WorkspaceOperations::States::CREATION_REQUESTED) expect(workspace.name).to eq("workspace-#{agent.id}-#{user.id}-#{random_string}") expect(workspace.namespace).to eq("gl-rd-ns-#{agent.id}-#{user.id}-#{random_string}") expect(workspace.editor).to eq('webide') diff --git a/ee/spec/lib/remote_development/workspaces/create/main_spec.rb b/ee/spec/lib/remote_development/workspace_operations/create/main_spec.rb similarity index 76% rename from ee/spec/lib/remote_development/workspaces/create/main_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/create/main_spec.rb index 2418ec64f3777e5d20800fdea715deb9cf6f8489..9def43acb93426089e209a1d4acf57f30b70167a 100644 --- a/ee/spec/lib/remote_development/workspaces/create/main_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/create/main_spec.rb @@ -2,20 +2,20 @@ require "fast_spec_helper" -RSpec.describe RemoteDevelopment::Workspaces::Create::Main, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Create::Main, feature_category: :remote_development do let(:context_passed_along_steps) { {} } let(:rop_steps) do [ - [RemoteDevelopment::Workspaces::Create::Authorizer, :and_then], - [RemoteDevelopment::Workspaces::Create::DevfileFetcher, :and_then], - [RemoteDevelopment::Workspaces::Create::PreFlattenDevfileValidator, :and_then], - [RemoteDevelopment::Workspaces::Create::DevfileFlattener, :and_then], - [RemoteDevelopment::Workspaces::Create::PostFlattenDevfileValidator, :and_then], - [RemoteDevelopment::Workspaces::Create::VolumeDefiner, :map], - [RemoteDevelopment::Workspaces::Create::ToolsComponentInjector, :map], - [RemoteDevelopment::Workspaces::Create::ProjectClonerComponentInjector, :map], - [RemoteDevelopment::Workspaces::Create::VolumeComponentInjector, :map], - [RemoteDevelopment::Workspaces::Create::Creator, :and_then] + [RemoteDevelopment::WorkspaceOperations::Create::Authorizer, :and_then], + [RemoteDevelopment::WorkspaceOperations::Create::DevfileFetcher, :and_then], + [RemoteDevelopment::WorkspaceOperations::Create::PreFlattenDevfileValidator, :and_then], + [RemoteDevelopment::WorkspaceOperations::Create::DevfileFlattener, :and_then], + [RemoteDevelopment::WorkspaceOperations::Create::PostFlattenDevfileValidator, :and_then], + [RemoteDevelopment::WorkspaceOperations::Create::VolumeDefiner, :map], + [RemoteDevelopment::WorkspaceOperations::Create::ToolsComponentInjector, :map], + [RemoteDevelopment::WorkspaceOperations::Create::ProjectClonerComponentInjector, :map], + [RemoteDevelopment::WorkspaceOperations::Create::VolumeComponentInjector, :map], + [RemoteDevelopment::WorkspaceOperations::Create::Creator, :and_then] ] end @@ -39,7 +39,7 @@ .with_context_passed_along_steps(context_passed_along_steps) .with_ok_result_for_step( { - step_class: RemoteDevelopment::Workspaces::Create::Creator, + step_class: RemoteDevelopment::WorkspaceOperations::Create::Creator, returned_message: RemoteDevelopment::Messages::WorkspaceCreateSuccessful.new(ok_message_content) } ) @@ -72,7 +72,7 @@ [ "when Authorizer returns Unauthorized", { - step_class: RemoteDevelopment::Workspaces::Create::Authorizer, + step_class: RemoteDevelopment::WorkspaceOperations::Create::Authorizer, returned_message: lazy { RemoteDevelopment::Messages::Unauthorized.new(err_message_content) } }, { @@ -84,7 +84,7 @@ [ "when DevfileFetcher returns WorkspaceCreateParamsValidationFailed", { - step_class: RemoteDevelopment::Workspaces::Create::DevfileFetcher, + step_class: RemoteDevelopment::WorkspaceOperations::Create::DevfileFetcher, returned_message: lazy { RemoteDevelopment::Messages::WorkspaceCreateParamsValidationFailed.new(err_message_content) } }, @@ -97,7 +97,7 @@ [ "when DevfileFetcher returns WorkspaceCreateDevfileLoadFailed", { - step_class: RemoteDevelopment::Workspaces::Create::DevfileFetcher, + step_class: RemoteDevelopment::WorkspaceOperations::Create::DevfileFetcher, returned_message: lazy { RemoteDevelopment::Messages::WorkspaceCreateDevfileLoadFailed.new(err_message_content) } }, { @@ -109,7 +109,7 @@ [ "when DevfileFetcher returns WorkspaceCreateDevfileYamlParseFailed", { - step_class: RemoteDevelopment::Workspaces::Create::DevfileFetcher, + step_class: RemoteDevelopment::WorkspaceOperations::Create::DevfileFetcher, returned_message: lazy { RemoteDevelopment::Messages::WorkspaceCreateDevfileYamlParseFailed.new(err_message_content) } }, { @@ -121,7 +121,7 @@ [ "when PreFlattenDevfileValidator returns WorkspaceCreatePreFlattenDevfileValidationFailed", { - step_class: RemoteDevelopment::Workspaces::Create::PreFlattenDevfileValidator, + step_class: RemoteDevelopment::WorkspaceOperations::Create::PreFlattenDevfileValidator, returned_message: lazy { RemoteDevelopment::Messages::WorkspaceCreatePreFlattenDevfileValidationFailed.new(err_message_content) } }, { @@ -133,7 +133,7 @@ [ "when DevfileFlattener returns WorkspaceCreatePreFlattenDevfileValidationFailed", { - step_class: RemoteDevelopment::Workspaces::Create::DevfileFlattener, + step_class: RemoteDevelopment::WorkspaceOperations::Create::DevfileFlattener, returned_message: lazy { RemoteDevelopment::Messages::WorkspaceCreateDevfileFlattenFailed.new(err_message_content) } }, { @@ -145,7 +145,7 @@ [ "when PostFlattenDevfileValidator returns WorkspaceCreatePostFlattenDevfileValidationFailed", { - step_class: RemoteDevelopment::Workspaces::Create::PostFlattenDevfileValidator, + step_class: RemoteDevelopment::WorkspaceOperations::Create::PostFlattenDevfileValidator, returned_message: lazy { RemoteDevelopment::Messages::WorkspaceCreatePostFlattenDevfileValidationFailed.new(err_message_content) } }, { @@ -157,7 +157,7 @@ [ "when Creator returns WorkspaceCreateFailed", { - step_class: RemoteDevelopment::Workspaces::Create::Creator, + step_class: RemoteDevelopment::WorkspaceOperations::Create::Creator, returned_message: lazy { RemoteDevelopment::Messages::WorkspaceCreateFailed.new(err_message_content) } }, { @@ -169,7 +169,7 @@ [ "when an unmatched error is returned, an exception is raised", { - step_class: RemoteDevelopment::Workspaces::Create::Creator, + step_class: RemoteDevelopment::WorkspaceOperations::Create::Creator, returned_message: lazy { Class.new(Gitlab::Fp::Message).new(err_message_content) } }, Gitlab::Fp::UnmatchedResultError diff --git a/ee/spec/lib/remote_development/workspaces/create/personal_access_token_creator_spec.rb b/ee/spec/lib/remote_development/workspace_operations/create/personal_access_token_creator_spec.rb similarity index 92% rename from ee/spec/lib/remote_development/workspaces/create/personal_access_token_creator_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/create/personal_access_token_creator_spec.rb index 56142d6823769329e15a3cf19b908e7982a5ffb9..2820ef87dd0f5deba25c80fe2ab6ca0e7ca2113c 100644 --- a/ee/spec/lib/remote_development/workspaces/create/personal_access_token_creator_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/create/personal_access_token_creator_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::RemoteDevelopment::Workspaces::Create::PersonalAccessTokenCreator, feature_category: :remote_development do +RSpec.describe ::RemoteDevelopment::WorkspaceOperations::Create::PersonalAccessTokenCreator, feature_category: :remote_development do include ResultMatchers include_context 'with remote development shared fixtures' diff --git a/ee/spec/lib/remote_development/workspaces/create/post_flatten_devfile_validator_spec.rb b/ee/spec/lib/remote_development/workspace_operations/create/post_flatten_devfile_validator_spec.rb similarity index 97% rename from ee/spec/lib/remote_development/workspaces/create/post_flatten_devfile_validator_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/create/post_flatten_devfile_validator_spec.rb index 94b1cad4dd4cfbe1431581b84c88b559dba8aaf3..8b822ff780abc852f6b51ee47539d6cc5377fade 100644 --- a/ee/spec/lib/remote_development/workspaces/create/post_flatten_devfile_validator_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/create/post_flatten_devfile_validator_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::RemoteDevelopment::Workspaces::Create::PostFlattenDevfileValidator, feature_category: :remote_development do +RSpec.describe ::RemoteDevelopment::WorkspaceOperations::Create::PostFlattenDevfileValidator, feature_category: :remote_development do include ResultMatchers include_context 'with remote development shared fixtures' diff --git a/ee/spec/lib/remote_development/workspaces/create/pre_flatten_devfile_validator_spec.rb b/ee/spec/lib/remote_development/workspace_operations/create/pre_flatten_devfile_validator_spec.rb similarity index 92% rename from ee/spec/lib/remote_development/workspaces/create/pre_flatten_devfile_validator_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/create/pre_flatten_devfile_validator_spec.rb index c55e782e597ceb68176a7c2511fd82fb6cf6d48a..bf3ab1a539e9b55385761f77eec79c7bfe975672 100644 --- a/ee/spec/lib/remote_development/workspaces/create/pre_flatten_devfile_validator_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/create/pre_flatten_devfile_validator_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::RemoteDevelopment::Workspaces::Create::PreFlattenDevfileValidator, feature_category: :remote_development do +RSpec.describe ::RemoteDevelopment::WorkspaceOperations::Create::PreFlattenDevfileValidator, feature_category: :remote_development do include ResultMatchers include_context 'with remote development shared fixtures' diff --git a/ee/spec/lib/remote_development/workspaces/create/project_cloner_component_injector_spec.rb b/ee/spec/lib/remote_development/workspace_operations/create/project_cloner_component_injector_spec.rb similarity index 90% rename from ee/spec/lib/remote_development/workspaces/create/project_cloner_component_injector_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/create/project_cloner_component_injector_spec.rb index d316dd41fb3a9b052c16a735dbad04de5eca9a83..0b07bf8aa1da9ce96c9b60072bf46ccccc25a623 100644 --- a/ee/spec/lib/remote_development/workspaces/create/project_cloner_component_injector_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/create/project_cloner_component_injector_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" -RSpec.describe RemoteDevelopment::Workspaces::Create::ProjectClonerComponentInjector, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Create::ProjectClonerComponentInjector, feature_category: :remote_development do include_context 'with remote development shared fixtures' let_it_be(:group) { create(:group, name: "test-group") } diff --git a/ee/spec/lib/remote_development/workspaces/create/tools_component_injector_spec.rb b/ee/spec/lib/remote_development/workspace_operations/create/tools_component_injector_spec.rb similarity index 94% rename from ee/spec/lib/remote_development/workspaces/create/tools_component_injector_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/create/tools_component_injector_spec.rb index 8fb1b7a5893948eaf0083d301851a5ea5a1a0bfe..fdc64ff134ac9989c0d7eb0ed47ba024163a6f79 100644 --- a/ee/spec/lib/remote_development/workspaces/create/tools_component_injector_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/create/tools_component_injector_spec.rb @@ -2,7 +2,7 @@ require "fast_spec_helper" -RSpec.describe RemoteDevelopment::Workspaces::Create::ToolsComponentInjector, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Create::ToolsComponentInjector, feature_category: :remote_development do include_context 'with remote development shared fixtures' let(:input_processed_devfile_name) { 'example.flattened-devfile.yaml' } diff --git a/ee/spec/lib/remote_development/workspaces/create/volume_component_injector_spec.rb b/ee/spec/lib/remote_development/workspace_operations/create/volume_component_injector_spec.rb similarity index 88% rename from ee/spec/lib/remote_development/workspaces/create/volume_component_injector_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/create/volume_component_injector_spec.rb index 9d7bf3b3d077f157d3bd2c4c63f3d9ecfdd38816..55d87fdc951d436d9c2584b4a373fd738b7f382c 100644 --- a/ee/spec/lib/remote_development/workspaces/create/volume_component_injector_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/create/volume_component_injector_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" -RSpec.describe RemoteDevelopment::Workspaces::Create::VolumeComponentInjector, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Create::VolumeComponentInjector, feature_category: :remote_development do include_context 'with remote development shared fixtures' let(:input_processed_devfile_name) { 'example.project-cloner-injected-devfile.yaml' } diff --git a/ee/spec/lib/remote_development/workspaces/create/volume_definer_spec.rb b/ee/spec/lib/remote_development/workspace_operations/create/volume_definer_spec.rb similarity index 78% rename from ee/spec/lib/remote_development/workspaces/create/volume_definer_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/create/volume_definer_spec.rb index dfc47360f16d581235e20d66fc699ce2f8e2eb9c..ce859479d1299fbbf67169912aefd0b27dd8d83d 100644 --- a/ee/spec/lib/remote_development/workspaces/create/volume_definer_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/create/volume_definer_spec.rb @@ -2,7 +2,7 @@ require "fast_spec_helper" -RSpec.describe RemoteDevelopment::Workspaces::Create::VolumeDefiner, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Create::VolumeDefiner, feature_category: :remote_development do let(:context) { { params: 1 } } subject(:returned_value) do diff --git a/ee/spec/lib/remote_development/workspaces/create/workspace_creator_spec.rb b/ee/spec/lib/remote_development/workspace_operations/create/workspace_creator_spec.rb similarity index 93% rename from ee/spec/lib/remote_development/workspaces/create/workspace_creator_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/create/workspace_creator_spec.rb index e7233b45aa7ef693a6d9097ecf1e05d0751fa79f..7bce6cc5a68e71ef1be0f4679e05a1c6946293a5 100644 --- a/ee/spec/lib/remote_development/workspaces/create/workspace_creator_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/create/workspace_creator_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::RemoteDevelopment::Workspaces::Create::WorkspaceCreator, feature_category: :remote_development do +RSpec.describe ::RemoteDevelopment::WorkspaceOperations::Create::WorkspaceCreator, feature_category: :remote_development do include ResultMatchers include_context 'with remote development shared fixtures' @@ -15,7 +15,7 @@ let(:devfile_path) { '.devfile.yaml' } let(:devfile_yaml) { example_devfile } let(:processed_devfile) { YAML.safe_load(example_flattened_devfile) } - let(:desired_state) { RemoteDevelopment::Workspaces::States::RUNNING } + let(:desired_state) { RemoteDevelopment::WorkspaceOperations::States::RUNNING } let(:processed_devfile_yaml) { YAML.safe_load(example_processed_devfile) } let(:editor) { 'webide' } diff --git a/ee/spec/lib/remote_development/workspaces/create/workspace_variables_creator_spec.rb b/ee/spec/lib/remote_development/workspace_operations/create/workspace_variables_creator_spec.rb similarity index 94% rename from ee/spec/lib/remote_development/workspaces/create/workspace_variables_creator_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/create/workspace_variables_creator_spec.rb index 5e5203d5f4a6109ce1bad20666c290ef9eb1165b..5477cf5bbf4363e63eb52d3e89c498aaa10a314d 100644 --- a/ee/spec/lib/remote_development/workspaces/create/workspace_variables_creator_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/create/workspace_variables_creator_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::RemoteDevelopment::Workspaces::Create::WorkspaceVariablesCreator, feature_category: :remote_development do +RSpec.describe ::RemoteDevelopment::WorkspaceOperations::Create::WorkspaceVariablesCreator, feature_category: :remote_development do include ResultMatchers include_context 'with remote development shared fixtures' @@ -59,7 +59,7 @@ end before do - allow(RemoteDevelopment::Workspaces::Create::WorkspaceVariables) + allow(RemoteDevelopment::WorkspaceOperations::Create::WorkspaceVariables) .to receive(:variables).with(workspace_variables_params) { returned_workspace_variables } end diff --git a/ee/spec/lib/remote_development/workspaces/create/workspace_variables_spec.rb b/ee/spec/lib/remote_development/workspace_operations/create/workspace_variables_spec.rb similarity index 98% rename from ee/spec/lib/remote_development/workspaces/create/workspace_variables_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/create/workspace_variables_spec.rb index f066bf9604e83df400f535b50f01749a35512c79..53a1b62b9ed975c8887139c06269bfa8e64664a8 100644 --- a/ee/spec/lib/remote_development/workspaces/create/workspace_variables_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/create/workspace_variables_spec.rb @@ -2,7 +2,7 @@ require "fast_spec_helper" -RSpec.describe ::RemoteDevelopment::Workspaces::Create::WorkspaceVariables, feature_category: :remote_development do +RSpec.describe ::RemoteDevelopment::WorkspaceOperations::Create::WorkspaceVariables, feature_category: :remote_development do let(:name) { "name" } let(:dns_zone) { "example.dns.zone" } let(:personal_access_token_value) { "example-pat-value" } diff --git a/ee/spec/lib/remote_development/workspaces/reconcile/input/actual_state_calculator_spec.rb b/ee/spec/lib/remote_development/workspace_operations/reconcile/input/actual_state_calculator_spec.rb similarity index 83% rename from ee/spec/lib/remote_development/workspaces/reconcile/input/actual_state_calculator_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/reconcile/input/actual_state_calculator_spec.rb index 84bda8d2e4614d2ba95f9b1c9f034e97a4ea4bb5..97bb73a2a79d79485a315591f818373e8895e6c6 100644 --- a/ee/spec/lib/remote_development/workspaces/reconcile/input/actual_state_calculator_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/reconcile/input/actual_state_calculator_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe RemoteDevelopment::Workspaces::Reconcile::Input::ActualStateCalculator, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Reconcile::Input::ActualStateCalculator, feature_category: :remote_development do include_context 'with remote development shared fixtures' describe '.calculate_actual_state' do @@ -12,6 +12,7 @@ context 'with cases parameterized from shared fixtures' do where(:previous_actual_state, :current_actual_state, :workspace_exists) do + # rubocop:disable Layout/LineLength -- Keep table rows on single lines for readability [ # TODO: https://gitlab.com/gitlab-org/gitlab/-/issues/409783 # These are currently taken from only the currently supported cases in @@ -20,26 +21,26 @@ # realistic coverage of all possible relevant states. # Note that `nil` is passed when the argument will not be used by # remote_development_shared_contexts.rb - [RemoteDevelopment::Workspaces::States::CREATION_REQUESTED, RemoteDevelopment::Workspaces::States::STARTING, - nil], - [RemoteDevelopment::Workspaces::States::STARTING, RemoteDevelopment::Workspaces::States::STARTING, false], - [RemoteDevelopment::Workspaces::States::STARTING, RemoteDevelopment::Workspaces::States::RUNNING, false], - [RemoteDevelopment::Workspaces::States::STARTING, RemoteDevelopment::Workspaces::States::FAILED, false], - [RemoteDevelopment::Workspaces::States::FAILED, RemoteDevelopment::Workspaces::States::STARTING, false], - [RemoteDevelopment::Workspaces::States::RUNNING, RemoteDevelopment::Workspaces::States::FAILED, nil], - [RemoteDevelopment::Workspaces::States::RUNNING, RemoteDevelopment::Workspaces::States::STOPPING, nil], - [RemoteDevelopment::Workspaces::States::STOPPING, RemoteDevelopment::Workspaces::States::STOPPED, nil], - [RemoteDevelopment::Workspaces::States::STOPPING, RemoteDevelopment::Workspaces::States::FAILED, nil], - [RemoteDevelopment::Workspaces::States::STOPPED, RemoteDevelopment::Workspaces::States::STARTING, nil], - [RemoteDevelopment::Workspaces::States::STOPPED, RemoteDevelopment::Workspaces::States::STOPPED, true], - [RemoteDevelopment::Workspaces::States::STOPPED, RemoteDevelopment::Workspaces::States::FAILED, nil], - [RemoteDevelopment::Workspaces::States::STARTING, RemoteDevelopment::Workspaces::States::STARTING, true], - [RemoteDevelopment::Workspaces::States::STARTING, RemoteDevelopment::Workspaces::States::RUNNING, true], - [RemoteDevelopment::Workspaces::States::STARTING, RemoteDevelopment::Workspaces::States::FAILED, true], - [RemoteDevelopment::Workspaces::States::FAILED, RemoteDevelopment::Workspaces::States::STARTING, true], - [RemoteDevelopment::Workspaces::States::FAILED, RemoteDevelopment::Workspaces::States::STOPPING, nil], - [nil, RemoteDevelopment::Workspaces::States::FAILED, nil] + [RemoteDevelopment::WorkspaceOperations::States::CREATION_REQUESTED, RemoteDevelopment::WorkspaceOperations::States::STARTING, nil], + [RemoteDevelopment::WorkspaceOperations::States::STARTING, RemoteDevelopment::WorkspaceOperations::States::STARTING, false], + [RemoteDevelopment::WorkspaceOperations::States::STARTING, RemoteDevelopment::WorkspaceOperations::States::RUNNING, false], + [RemoteDevelopment::WorkspaceOperations::States::STARTING, RemoteDevelopment::WorkspaceOperations::States::FAILED, false], + [RemoteDevelopment::WorkspaceOperations::States::FAILED, RemoteDevelopment::WorkspaceOperations::States::STARTING, false], + [RemoteDevelopment::WorkspaceOperations::States::RUNNING, RemoteDevelopment::WorkspaceOperations::States::FAILED, nil], + [RemoteDevelopment::WorkspaceOperations::States::RUNNING, RemoteDevelopment::WorkspaceOperations::States::STOPPING, nil], + [RemoteDevelopment::WorkspaceOperations::States::STOPPING, RemoteDevelopment::WorkspaceOperations::States::STOPPED, nil], + [RemoteDevelopment::WorkspaceOperations::States::STOPPING, RemoteDevelopment::WorkspaceOperations::States::FAILED, nil], + [RemoteDevelopment::WorkspaceOperations::States::STOPPED, RemoteDevelopment::WorkspaceOperations::States::STARTING, nil], + [RemoteDevelopment::WorkspaceOperations::States::STOPPED, RemoteDevelopment::WorkspaceOperations::States::STOPPED, true], + [RemoteDevelopment::WorkspaceOperations::States::STOPPED, RemoteDevelopment::WorkspaceOperations::States::FAILED, nil], + [RemoteDevelopment::WorkspaceOperations::States::STARTING, RemoteDevelopment::WorkspaceOperations::States::STARTING, true], + [RemoteDevelopment::WorkspaceOperations::States::STARTING, RemoteDevelopment::WorkspaceOperations::States::RUNNING, true], + [RemoteDevelopment::WorkspaceOperations::States::STARTING, RemoteDevelopment::WorkspaceOperations::States::FAILED, true], + [RemoteDevelopment::WorkspaceOperations::States::FAILED, RemoteDevelopment::WorkspaceOperations::States::STARTING, true], + [RemoteDevelopment::WorkspaceOperations::States::FAILED, RemoteDevelopment::WorkspaceOperations::States::STOPPING, nil], + [nil, RemoteDevelopment::WorkspaceOperations::States::FAILED, nil] ] + # rubocop:enable Layout/LineLength end with_them do @@ -84,7 +85,7 @@ context 'when the deployment is completed successfully' do context 'when new workspace has been created or existing workspace has been scaled up' do - let(:expected_actual_state) { RemoteDevelopment::Workspaces::States::RUNNING } + let(:expected_actual_state) { RemoteDevelopment::WorkspaceOperations::States::RUNNING } let(:latest_k8s_deployment_info) do YAML.safe_load( <<~WORKSPACE_STATUS_YAML @@ -108,7 +109,7 @@ end context 'when existing workspace has been scaled down' do - let(:expected_actual_state) { RemoteDevelopment::Workspaces::States::STOPPED } + let(:expected_actual_state) { RemoteDevelopment::WorkspaceOperations::States::STOPPED } let(:latest_k8s_deployment_info) do YAML.safe_load( <<~WORKSPACE_STATUS_YAML @@ -131,7 +132,7 @@ end context 'when status does not contain required information' do - let(:expected_actual_state) { RemoteDevelopment::Workspaces::States::UNKNOWN } + let(:expected_actual_state) { RemoteDevelopment::WorkspaceOperations::States::UNKNOWN } let(:latest_k8s_deployment_info) do YAML.safe_load( <<~WORKSPACE_STATUS_YAML @@ -156,7 +157,7 @@ context 'when the deployment is in progress' do context 'when new workspace has been created' do - let(:expected_actual_state) { RemoteDevelopment::Workspaces::States::STARTING } + let(:expected_actual_state) { RemoteDevelopment::WorkspaceOperations::States::STARTING } let(:latest_k8s_deployment_info) do YAML.safe_load( <<~WORKSPACE_STATUS_YAML @@ -177,7 +178,7 @@ end context 'when existing workspace has been updated' do - let(:expected_actual_state) { RemoteDevelopment::Workspaces::States::STARTING } + let(:expected_actual_state) { RemoteDevelopment::WorkspaceOperations::States::STARTING } let(:latest_k8s_deployment_info) do YAML.safe_load( <<~WORKSPACE_STATUS_YAML @@ -198,7 +199,7 @@ end context 'when existing workspace has been scaled up' do - let(:expected_actual_state) { RemoteDevelopment::Workspaces::States::STARTING } + let(:expected_actual_state) { RemoteDevelopment::WorkspaceOperations::States::STARTING } let(:latest_k8s_deployment_info) do YAML.safe_load( <<~WORKSPACE_STATUS_YAML @@ -219,7 +220,7 @@ end context 'when existing workspace has been scaled down' do - let(:expected_actual_state) { RemoteDevelopment::Workspaces::States::STOPPING } + let(:expected_actual_state) { RemoteDevelopment::WorkspaceOperations::States::STOPPING } let(:latest_k8s_deployment_info) do YAML.safe_load( <<~WORKSPACE_STATUS_YAML @@ -240,7 +241,7 @@ end context 'when spec replicas is more than 1' do - let(:expected_actual_state) { RemoteDevelopment::Workspaces::States::UNKNOWN } + let(:expected_actual_state) { RemoteDevelopment::WorkspaceOperations::States::UNKNOWN } let(:latest_k8s_deployment_info) do YAML.safe_load( <<~WORKSPACE_STATUS_YAML @@ -261,7 +262,7 @@ end context 'when status does not contain required information' do - let(:expected_actual_state) { RemoteDevelopment::Workspaces::States::UNKNOWN } + let(:expected_actual_state) { RemoteDevelopment::WorkspaceOperations::States::UNKNOWN } let(:latest_k8s_deployment_info) do YAML.safe_load( <<~WORKSPACE_STATUS_YAML @@ -284,7 +285,7 @@ context 'when the deployment is failed' do context 'when new workspace has been created or existing workspace has been scaled up' do - let(:expected_actual_state) { RemoteDevelopment::Workspaces::States::FAILED } + let(:expected_actual_state) { RemoteDevelopment::WorkspaceOperations::States::FAILED } let(:latest_k8s_deployment_info) do YAML.safe_load( <<~WORKSPACE_STATUS_YAML @@ -308,7 +309,7 @@ end context 'when existing scaled down workspace which was failing has been scaled up' do - let(:expected_actual_state) { RemoteDevelopment::Workspaces::States::FAILED } + let(:expected_actual_state) { RemoteDevelopment::WorkspaceOperations::States::FAILED } let(:latest_k8s_deployment_info) do YAML.safe_load( <<~WORKSPACE_STATUS_YAML @@ -334,7 +335,7 @@ end context 'when the deployment status is unknown' do - let(:expected_actual_state) { RemoteDevelopment::Workspaces::States::UNKNOWN } + let(:expected_actual_state) { RemoteDevelopment::WorkspaceOperations::States::UNKNOWN } context 'when spec is missing' do let(:latest_k8s_deployment_info) do @@ -455,9 +456,9 @@ end context 'when termination_progress is Terminating' do - let(:expected_actual_state) { RemoteDevelopment::Workspaces::States::TERMINATING } + let(:expected_actual_state) { RemoteDevelopment::WorkspaceOperations::States::TERMINATING } let(:termination_progress) do - RemoteDevelopment::Workspaces::Reconcile::Input::ActualStateCalculator::TERMINATING + RemoteDevelopment::WorkspaceOperations::Reconcile::Input::ActualStateCalculator::TERMINATING end it 'returns the expected actual state' do @@ -471,9 +472,9 @@ end context 'when termination_progress is Terminated' do - let(:expected_actual_state) { RemoteDevelopment::Workspaces::States::TERMINATED } + let(:expected_actual_state) { RemoteDevelopment::WorkspaceOperations::States::TERMINATED } let(:termination_progress) do - RemoteDevelopment::Workspaces::Reconcile::Input::ActualStateCalculator::TERMINATED + RemoteDevelopment::WorkspaceOperations::Reconcile::Input::ActualStateCalculator::TERMINATED end it 'returns the expected actual state' do @@ -490,7 +491,7 @@ let(:latest_error_details) do { error_details: { - error_type: RemoteDevelopment::Workspaces::Reconcile::ErrorType::APPLIER, + error_type: RemoteDevelopment::WorkspaceOperations::Reconcile::ErrorType::APPLIER, error_details: "error encountered while applying k8s configs" } } @@ -498,7 +499,7 @@ context "and termination_progress is missing" do let(:termination_progress) { nil } - let(:expected_actual_state) { RemoteDevelopment::Workspaces::States::ERROR } + let(:expected_actual_state) { RemoteDevelopment::WorkspaceOperations::States::ERROR } it 'returns the expected actual state' do expect( @@ -511,14 +512,14 @@ end context "and termination_progress is Terminated" do - let(:expected_actual_state) { RemoteDevelopment::Workspaces::States::TERMINATED } + let(:expected_actual_state) { RemoteDevelopment::WorkspaceOperations::States::TERMINATED } it 'returns the expected actual state' do expect( actual_state_calculator.calculate_actual_state( latest_k8s_deployment_info: nil, termination_progress: - RemoteDevelopment::Workspaces::Reconcile::Input::ActualStateCalculator::TERMINATED, + RemoteDevelopment::WorkspaceOperations::Reconcile::Input::ActualStateCalculator::TERMINATED, latest_error_details: latest_error_details ) ).to be(expected_actual_state) @@ -526,14 +527,14 @@ end context "and termination_progress is Terminating" do - let(:expected_actual_state) { RemoteDevelopment::Workspaces::States::ERROR } + let(:expected_actual_state) { RemoteDevelopment::WorkspaceOperations::States::ERROR } it 'returns the expected actual state' do expect( actual_state_calculator.calculate_actual_state( latest_k8s_deployment_info: nil, termination_progress: - RemoteDevelopment::Workspaces::Reconcile::Input::ActualStateCalculator::TERMINATING, + RemoteDevelopment::WorkspaceOperations::Reconcile::Input::ActualStateCalculator::TERMINATING, latest_error_details: latest_error_details ) ).to be(expected_actual_state) diff --git a/ee/spec/lib/remote_development/workspaces/reconcile/input/agent_info_spec.rb b/ee/spec/lib/remote_development/workspace_operations/reconcile/input/agent_info_spec.rb similarity index 78% rename from ee/spec/lib/remote_development/workspaces/reconcile/input/agent_info_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/reconcile/input/agent_info_spec.rb index a6c6c79dc87509b93196a3aa6de62af1ec3d5752..385f6af7290a4cac72ec408b362a1245ac6ba332 100644 --- a/ee/spec/lib/remote_development/workspaces/reconcile/input/agent_info_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/reconcile/input/agent_info_spec.rb @@ -2,12 +2,12 @@ require "fast_spec_helper" -RSpec.describe RemoteDevelopment::Workspaces::Reconcile::Input::AgentInfo, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Reconcile::Input::AgentInfo, feature_category: :remote_development do let(:agent_info_constructor_args) do { name: 'name', namespace: 'namespace', - actual_state: ::RemoteDevelopment::Workspaces::States::RUNNING, + actual_state: ::RemoteDevelopment::WorkspaceOperations::States::RUNNING, deployment_resource_version: '1' } end diff --git a/ee/spec/lib/remote_development/workspaces/reconcile/input/agent_infos_observer_spec.rb b/ee/spec/lib/remote_development/workspace_operations/reconcile/input/agent_infos_observer_spec.rb similarity index 74% rename from ee/spec/lib/remote_development/workspaces/reconcile/input/agent_infos_observer_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/reconcile/input/agent_infos_observer_spec.rb index 69682d9e752c9711309f2ece3ec4bebd46d6ab92..06b87913b736d8cab86f18f583bfae47f3de80eb 100644 --- a/ee/spec/lib/remote_development/workspaces/reconcile/input/agent_infos_observer_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/reconcile/input/agent_infos_observer_spec.rb @@ -2,33 +2,33 @@ require "fast_spec_helper" -RSpec.describe RemoteDevelopment::Workspaces::Reconcile::Input::AgentInfosObserver, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Reconcile::Input::AgentInfosObserver, feature_category: :remote_development do let(:agent) { instance_double("Clusters::Agent", id: 1) } - let(:update_type) { RemoteDevelopment::Workspaces::Reconcile::UpdateTypes::PARTIAL } + let(:update_type) { RemoteDevelopment::WorkspaceOperations::Reconcile::UpdateTypes::PARTIAL } let(:logger) { instance_double(::Logger) } let(:normal_agent_info) do - RemoteDevelopment::Workspaces::Reconcile::Input::AgentInfo.new( + RemoteDevelopment::WorkspaceOperations::Reconcile::Input::AgentInfo.new( name: "normal_workspace", namespace: "namespace", - actual_state: RemoteDevelopment::Workspaces::States::STARTING, + actual_state: RemoteDevelopment::WorkspaceOperations::States::STARTING, deployment_resource_version: "1" ) end let(:abnormal_agent_info1) do - RemoteDevelopment::Workspaces::Reconcile::Input::AgentInfo.new( + RemoteDevelopment::WorkspaceOperations::Reconcile::Input::AgentInfo.new( name: "abnormal_workspace1", namespace: "namespace", - actual_state: RemoteDevelopment::Workspaces::States::ERROR, + actual_state: RemoteDevelopment::WorkspaceOperations::States::ERROR, deployment_resource_version: "1" ) end let(:abnormal_agent_info2) do - RemoteDevelopment::Workspaces::Reconcile::Input::AgentInfo.new( + RemoteDevelopment::WorkspaceOperations::Reconcile::Input::AgentInfo.new( name: "abnormal_workspace2", namespace: "namespace", - actual_state: RemoteDevelopment::Workspaces::States::UNKNOWN, + actual_state: RemoteDevelopment::WorkspaceOperations::States::UNKNOWN, deployment_resource_version: "1" ) end @@ -66,7 +66,7 @@ "with 1 in a NORMAL actual_state and 2 in an ABNORMAL actual_state", agent_id: agent.id, update_type: update_type, - actual_state_type: RemoteDevelopment::Workspaces::Reconcile::Input::AgentInfosObserver::NORMAL, + actual_state_type: RemoteDevelopment::WorkspaceOperations::Reconcile::Input::AgentInfosObserver::NORMAL, total_count: 3, normal_count: 1, abnormal_count: 2, @@ -74,7 +74,7 @@ { name: "normal_workspace", namespace: "namespace", - actual_state: RemoteDevelopment::Workspaces::States::STARTING, + actual_state: RemoteDevelopment::WorkspaceOperations::States::STARTING, deployment_resource_version: "1" } ], @@ -82,13 +82,13 @@ { name: "abnormal_workspace1", namespace: "namespace", - actual_state: RemoteDevelopment::Workspaces::States::ERROR, + actual_state: RemoteDevelopment::WorkspaceOperations::States::ERROR, deployment_resource_version: "1" }, { name: "abnormal_workspace2", namespace: "namespace", - actual_state: RemoteDevelopment::Workspaces::States::UNKNOWN, + actual_state: RemoteDevelopment::WorkspaceOperations::States::UNKNOWN, deployment_resource_version: "1" } ] @@ -103,7 +103,7 @@ error_type: "abnormal_actual_state", agent_id: agent.id, update_type: update_type, - actual_state_type: RemoteDevelopment::Workspaces::Reconcile::Input::AgentInfosObserver::ABNORMAL, + actual_state_type: RemoteDevelopment::WorkspaceOperations::Reconcile::Input::AgentInfosObserver::ABNORMAL, total_count: 3, normal_count: 1, abnormal_count: 2, @@ -111,13 +111,13 @@ { name: "abnormal_workspace1", namespace: "namespace", - actual_state: RemoteDevelopment::Workspaces::States::ERROR, + actual_state: RemoteDevelopment::WorkspaceOperations::States::ERROR, deployment_resource_version: "1" }, { name: "abnormal_workspace2", namespace: "namespace", - actual_state: RemoteDevelopment::Workspaces::States::UNKNOWN, + actual_state: RemoteDevelopment::WorkspaceOperations::States::UNKNOWN, deployment_resource_version: "1" } ] @@ -140,7 +140,7 @@ "with 1 in a NORMAL actual_state and 0 in an ABNORMAL actual_state", agent_id: agent.id, update_type: update_type, - actual_state_type: RemoteDevelopment::Workspaces::Reconcile::Input::AgentInfosObserver::NORMAL, + actual_state_type: RemoteDevelopment::WorkspaceOperations::Reconcile::Input::AgentInfosObserver::NORMAL, total_count: 1, normal_count: 1, abnormal_count: 0, @@ -148,7 +148,7 @@ { name: "normal_workspace", namespace: "namespace", - actual_state: RemoteDevelopment::Workspaces::States::STARTING, + actual_state: RemoteDevelopment::WorkspaceOperations::States::STARTING, deployment_resource_version: "1" } ], @@ -178,7 +178,7 @@ "with 0 in a NORMAL actual_state and 2 in an ABNORMAL actual_state", agent_id: agent.id, update_type: update_type, - actual_state_type: RemoteDevelopment::Workspaces::Reconcile::Input::AgentInfosObserver::NORMAL, + actual_state_type: RemoteDevelopment::WorkspaceOperations::Reconcile::Input::AgentInfosObserver::NORMAL, total_count: 2, normal_count: 0, abnormal_count: 2, @@ -187,13 +187,13 @@ { name: "abnormal_workspace1", namespace: "namespace", - actual_state: RemoteDevelopment::Workspaces::States::ERROR, + actual_state: RemoteDevelopment::WorkspaceOperations::States::ERROR, deployment_resource_version: "1" }, { name: "abnormal_workspace2", namespace: "namespace", - actual_state: RemoteDevelopment::Workspaces::States::UNKNOWN, + actual_state: RemoteDevelopment::WorkspaceOperations::States::UNKNOWN, deployment_resource_version: "1" } ] @@ -208,7 +208,7 @@ error_type: "abnormal_actual_state", agent_id: agent.id, update_type: update_type, - actual_state_type: RemoteDevelopment::Workspaces::Reconcile::Input::AgentInfosObserver::ABNORMAL, + actual_state_type: RemoteDevelopment::WorkspaceOperations::Reconcile::Input::AgentInfosObserver::ABNORMAL, total_count: 2, normal_count: 0, abnormal_count: 2, @@ -216,13 +216,13 @@ { name: "abnormal_workspace1", namespace: "namespace", - actual_state: RemoteDevelopment::Workspaces::States::ERROR, + actual_state: RemoteDevelopment::WorkspaceOperations::States::ERROR, deployment_resource_version: "1" }, { name: "abnormal_workspace2", namespace: "namespace", - actual_state: RemoteDevelopment::Workspaces::States::UNKNOWN, + actual_state: RemoteDevelopment::WorkspaceOperations::States::UNKNOWN, deployment_resource_version: "1" } ] @@ -243,7 +243,7 @@ "with 0 in a NORMAL actual_state and 0 in an ABNORMAL actual_state", agent_id: agent.id, update_type: update_type, - actual_state_type: RemoteDevelopment::Workspaces::Reconcile::Input::AgentInfosObserver::NORMAL, + actual_state_type: RemoteDevelopment::WorkspaceOperations::Reconcile::Input::AgentInfosObserver::NORMAL, total_count: 0, normal_count: 0, abnormal_count: 0, diff --git a/ee/spec/lib/remote_development/workspaces/reconcile/input/factory_spec.rb b/ee/spec/lib/remote_development/workspace_operations/reconcile/input/factory_spec.rb similarity index 79% rename from ee/spec/lib/remote_development/workspaces/reconcile/input/factory_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/reconcile/input/factory_spec.rb index e6c6f17596beb23d9623fb3878fc53c54e5b625c..2c4ae96ca44279f59894a840f8c1cac76fb649b1 100644 --- a/ee/spec/lib/remote_development/workspaces/reconcile/input/factory_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/reconcile/input/factory_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe RemoteDevelopment::Workspaces::Reconcile::Input::Factory, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Reconcile::Input::Factory, feature_category: :remote_development do include_context 'with remote development shared fixtures' let(:agent) { instance_double("Clusters::Agent", id: 1) } @@ -25,7 +25,7 @@ let(:expected_deployment_resource_version) { "1" } let(:expected_agent_info) do - ::RemoteDevelopment::Workspaces::Reconcile::Input::AgentInfo.new( + ::RemoteDevelopment::WorkspaceOperations::Reconcile::Input::AgentInfo.new( name: workspace.name, namespace: expected_namespace, actual_state: current_actual_state, @@ -38,7 +38,9 @@ end before do - allow_next_instance_of(::RemoteDevelopment::Workspaces::Reconcile::Input::ActualStateCalculator) do |instance| + # rubocop:todo Layout/LineLength -- this line will not be too long once we rename RemoteDevelopment namespace to Workspaces + allow_next_instance_of(RemoteDevelopment::WorkspaceOperations::Reconcile::Input::ActualStateCalculator) do |instance| + # rubocop:enable Layout/LineLength # rubocop:disable RSpec/ExpectInHook -- we want to assert expectations on this mock, otherwise we'd just have to duplicate the assertions expect(instance).to receive(:calculate_actual_state).with( latest_k8s_deployment_info: workspace_agent_info_hash[:latest_k8s_deployment_info], @@ -51,8 +53,8 @@ describe '#build' do context 'when current actual state is not Terminated or Unknown' do - let(:previous_actual_state) { ::RemoteDevelopment::Workspaces::States::STARTING } - let(:current_actual_state) { ::RemoteDevelopment::Workspaces::States::RUNNING } + let(:previous_actual_state) { ::RemoteDevelopment::WorkspaceOperations::States::STARTING } + let(:current_actual_state) { ::RemoteDevelopment::WorkspaceOperations::States::RUNNING } let(:termination_progress) { nil } it 'returns an AgentInfo object with namespace and deployment_resource_version populated' do @@ -61,11 +63,11 @@ end context 'when current actual state is Terminating' do - let(:previous_actual_state) { ::RemoteDevelopment::Workspaces::States::RUNNING } - let(:current_actual_state) { ::RemoteDevelopment::Workspaces::States::TERMINATING } + let(:previous_actual_state) { ::RemoteDevelopment::WorkspaceOperations::States::RUNNING } + let(:current_actual_state) { ::RemoteDevelopment::WorkspaceOperations::States::TERMINATING } let(:expected_deployment_resource_version) { nil } let(:termination_progress) do - RemoteDevelopment::Workspaces::Reconcile::Input::ActualStateCalculator::TERMINATING + RemoteDevelopment::WorkspaceOperations::Reconcile::Input::ActualStateCalculator::TERMINATING end it 'returns an AgentInfo object without deployment_resource_version populated' do @@ -74,11 +76,11 @@ end context 'when current actual state is Terminated' do - let(:previous_actual_state) { ::RemoteDevelopment::Workspaces::States::TERMINATING } - let(:current_actual_state) { ::RemoteDevelopment::Workspaces::States::TERMINATED } + let(:previous_actual_state) { ::RemoteDevelopment::WorkspaceOperations::States::TERMINATING } + let(:current_actual_state) { ::RemoteDevelopment::WorkspaceOperations::States::TERMINATED } let(:expected_deployment_resource_version) { nil } let(:termination_progress) do - RemoteDevelopment::Workspaces::Reconcile::Input::ActualStateCalculator::TERMINATED + RemoteDevelopment::WorkspaceOperations::Reconcile::Input::ActualStateCalculator::TERMINATED end it 'returns an AgentInfo object without deployment_resource_version populated' do @@ -90,8 +92,8 @@ # - https://gitlab.com/gitlab-org/gitlab/-/merge_requests/126127#note_1492911475 # - https://gitlab.com/gitlab-org/gitlab/-/issues/420709 context "when namespace is missing in the payload" do - let(:previous_actual_state) { ::RemoteDevelopment::Workspaces::States::STARTING } - let(:current_actual_state) { ::RemoteDevelopment::Workspaces::States::RUNNING } + let(:previous_actual_state) { ::RemoteDevelopment::WorkspaceOperations::States::STARTING } + let(:current_actual_state) { ::RemoteDevelopment::WorkspaceOperations::States::RUNNING } let(:termination_progress) { nil } let(:namespace) { nil } let(:expected_namespace) { nil } diff --git a/ee/spec/lib/remote_development/workspaces/reconcile/input/params_extractor_spec.rb b/ee/spec/lib/remote_development/workspace_operations/reconcile/input/params_extractor_spec.rb similarity index 89% rename from ee/spec/lib/remote_development/workspaces/reconcile/input/params_extractor_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/reconcile/input/params_extractor_spec.rb index e3a16d4870b08a12d4203a2dfa09f9c65320ebbe..4641f2ae57c31b34338365d5bdb9a782a2612050 100644 --- a/ee/spec/lib/remote_development/workspaces/reconcile/input/params_extractor_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/reconcile/input/params_extractor_spec.rb @@ -2,7 +2,7 @@ require "fast_spec_helper" -RSpec.describe RemoteDevelopment::Workspaces::Reconcile::Input::ParamsExtractor, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Reconcile::Input::ParamsExtractor, feature_category: :remote_development do let(:agent) { instance_double("Clusters::Agent") } let(:original_params) do { diff --git a/ee/spec/lib/remote_development/workspaces/reconcile/input/params_to_infos_converter_spec.rb b/ee/spec/lib/remote_development/workspace_operations/reconcile/input/params_to_infos_converter_spec.rb similarity index 68% rename from ee/spec/lib/remote_development/workspaces/reconcile/input/params_to_infos_converter_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/reconcile/input/params_to_infos_converter_spec.rb index b27904f9332ee009997afd8fdf8c771cf8fea171..17fba4d1584e8c956a0c7666cc45abec9a51068b 100644 --- a/ee/spec/lib/remote_development/workspaces/reconcile/input/params_to_infos_converter_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/reconcile/input/params_to_infos_converter_spec.rb @@ -2,7 +2,7 @@ require "fast_spec_helper" -RSpec.describe RemoteDevelopment::Workspaces::Reconcile::Input::ParamsToInfosConverter, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Reconcile::Input::ParamsToInfosConverter, feature_category: :remote_development do let(:workspace_agent_info_hashes_from_params) do [ { @@ -15,11 +15,11 @@ end let(:expected_agent_info_1) do - instance_double("RemoteDevelopment::Workspaces::Reconcile::Input::AgentInfo", name: "workspace1") + instance_double("RemoteDevelopment::WorkspaceOperations::Reconcile::Input::AgentInfo", name: "workspace1") end let(:expected_agent_info_2) do - instance_double("RemoteDevelopment::Workspaces::Reconcile::Input::AgentInfo", name: "workspace2") + instance_double("RemoteDevelopment::WorkspaceOperations::Reconcile::Input::AgentInfo", name: "workspace2") end let(:context) { { workspace_agent_info_hashes_from_params: workspace_agent_info_hashes_from_params } } @@ -29,10 +29,10 @@ end before do - allow(RemoteDevelopment::Workspaces::Reconcile::Input::Factory) + allow(RemoteDevelopment::WorkspaceOperations::Reconcile::Input::Factory) .to receive(:build) .with(agent_info_hash_from_params: workspace_agent_info_hashes_from_params[0]) { expected_agent_info_1 } - allow(RemoteDevelopment::Workspaces::Reconcile::Input::Factory) + allow(RemoteDevelopment::WorkspaceOperations::Reconcile::Input::Factory) .to receive(:build) .with(agent_info_hash_from_params: workspace_agent_info_hashes_from_params[1]) { expected_agent_info_2 } end diff --git a/ee/spec/lib/remote_development/workspaces/reconcile/input/params_validator_spec.rb b/ee/spec/lib/remote_development/workspace_operations/reconcile/input/params_validator_spec.rb similarity index 96% rename from ee/spec/lib/remote_development/workspaces/reconcile/input/params_validator_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/reconcile/input/params_validator_spec.rb index 6c0fcc3a35aeddffae544ec56d2066522a50035c..3a76e3b5faf0553dd588d2cba8f3ab78b0b24ed5 100644 --- a/ee/spec/lib/remote_development/workspaces/reconcile/input/params_validator_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/reconcile/input/params_validator_spec.rb @@ -2,7 +2,7 @@ require "fast_spec_helper" -RSpec.describe RemoteDevelopment::Workspaces::Reconcile::Input::ParamsValidator, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Reconcile::Input::ParamsValidator, feature_category: :remote_development do include ResultMatchers let(:update_type) { "partial" } diff --git a/ee/spec/lib/remote_development/workspaces/reconcile/main_integration_spec.rb b/ee/spec/lib/remote_development/workspace_operations/reconcile/main_integration_spec.rb similarity index 91% rename from ee/spec/lib/remote_development/workspaces/reconcile/main_integration_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/reconcile/main_integration_spec.rb index f182a738811b4a9023d8e924ab96c76e7fb4d57c..cbff65e082076cbd718534d3ecca46fc8fa9a0c3 100644 --- a/ee/spec/lib/remote_development/workspaces/reconcile/main_integration_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/reconcile/main_integration_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' # rubocop:disable RSpec/MultipleMemoizedHelpers -- needed helpers for multiple cases -RSpec.describe RemoteDevelopment::Workspaces::Reconcile::Main, "Integration", :freeze_time, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Reconcile::Main, "Integration", :freeze_time, feature_category: :remote_development do include_context 'with remote development shared fixtures' shared_examples 'max_hours_before_termination handling' do @@ -12,7 +12,7 @@ expect(response[:message]).to be_nil expect(response.dig(:payload, :workspace_rails_infos)).not_to be_nil - expect(workspace.reload.desired_state).to eq(RemoteDevelopment::Workspaces::States::TERMINATED) + expect(workspace.reload.desired_state).to eq(RemoteDevelopment::WorkspaceOperations::States::TERMINATED) end end @@ -61,7 +61,7 @@ end context 'when update_type is full' do - let(:update_type) { RemoteDevelopment::Workspaces::Reconcile::UpdateTypes::FULL } + let(:update_type) { RemoteDevelopment::WorkspaceOperations::Reconcile::UpdateTypes::FULL } let(:workspace_agent_infos) { [] } it 'returns expected keys within the response payload' do @@ -84,13 +84,13 @@ end context 'when update_type is partial' do - let(:update_type) { RemoteDevelopment::Workspaces::Reconcile::UpdateTypes::PARTIAL } + let(:update_type) { RemoteDevelopment::WorkspaceOperations::Reconcile::UpdateTypes::PARTIAL } context 'when receiving agent updates for a workspace which exists in the db' do - let(:desired_state) { RemoteDevelopment::Workspaces::States::STOPPED } + let(:desired_state) { RemoteDevelopment::WorkspaceOperations::States::STOPPED } let(:actual_state) { current_actual_state } - let(:previous_actual_state) { RemoteDevelopment::Workspaces::States::STOPPING } - let(:current_actual_state) { RemoteDevelopment::Workspaces::States::STOPPED } + let(:previous_actual_state) { RemoteDevelopment::WorkspaceOperations::States::STOPPING } + let(:current_actual_state) { RemoteDevelopment::WorkspaceOperations::States::STOPPED } let(:workspace_exists) { false } let(:deployment_resource_version_from_agent) { '2' } let(:expected_desired_state) { desired_state } @@ -152,27 +152,27 @@ end context 'when state would otherwise be sent' do - let(:desired_state) { RemoteDevelopment::Workspaces::States::STOPPED } - let(:actual_state) { RemoteDevelopment::Workspaces::States::RUNNING } + let(:desired_state) { RemoteDevelopment::WorkspaceOperations::States::STOPPED } + let(:actual_state) { RemoteDevelopment::WorkspaceOperations::States::RUNNING } it_behaves_like 'max_hours_before_termination handling' end context 'when desired_state is RestartRequested and actual_state is Stopped' do - let(:desired_state) { RemoteDevelopment::Workspaces::States::RESTART_REQUESTED } - let(:actual_state) { RemoteDevelopment::Workspaces::States::STOPPED } + let(:desired_state) { RemoteDevelopment::WorkspaceOperations::States::RESTART_REQUESTED } + let(:actual_state) { RemoteDevelopment::WorkspaceOperations::States::STOPPED } it_behaves_like 'max_hours_before_termination handling' end end context "when the agent encounters an error while starting the workspace" do - let(:actual_state) { RemoteDevelopment::Workspaces::States::STARTING } - let(:desired_state) { RemoteDevelopment::Workspaces::States::RUNNING } - let(:expected_actual_state) { RemoteDevelopment::Workspaces::States::ERROR } + let(:actual_state) { RemoteDevelopment::WorkspaceOperations::States::STARTING } + let(:desired_state) { RemoteDevelopment::WorkspaceOperations::States::RUNNING } + let(:expected_actual_state) { RemoteDevelopment::WorkspaceOperations::States::ERROR } let(:error_from_agent) do { - error_type: RemoteDevelopment::Workspaces::Reconcile::ErrorType::APPLIER, + error_type: RemoteDevelopment::WorkspaceOperations::Reconcile::ErrorType::APPLIER, error_message: "some applier error" } end @@ -309,7 +309,7 @@ # rubocop:enable RSpec/ExpectInHook context 'when state is Stopped' do - let(:desired_state) { RemoteDevelopment::Workspaces::States::STOPPED } + let(:desired_state) { RemoteDevelopment::WorkspaceOperations::States::STOPPED } it 'updates workspace record and returns proper workspace_rails_info entry' do # verify initial states in db (sanity check of match between factory and fixtures) @@ -331,9 +331,9 @@ end context 'when state is Terminated' do - let(:desired_state) { RemoteDevelopment::Workspaces::States::TERMINATED } - let(:previous_actual_state) { RemoteDevelopment::Workspaces::States::TERMINATED } - let(:current_actual_state) { RemoteDevelopment::Workspaces::States::TERMINATED } + let(:desired_state) { RemoteDevelopment::WorkspaceOperations::States::TERMINATED } + let(:previous_actual_state) { RemoteDevelopment::WorkspaceOperations::States::TERMINATED } + let(:current_actual_state) { RemoteDevelopment::WorkspaceOperations::States::TERMINATED } let(:expected_deployment_resource_version) { workspace.deployment_resource_version } it 'updates workspace record and returns proper workspace_rails_info entry' do @@ -381,7 +381,7 @@ # rubocop:enable RSpec/ExpectInHook context 'when desired_state is Running' do - let(:desired_state) { RemoteDevelopment::Workspaces::States::RUNNING } + let(:desired_state) { RemoteDevelopment::WorkspaceOperations::States::RUNNING } it 'returns proper workspace_rails_info entry with config_to_apply' do # verify initial states in db (sanity check of match between factory and fixtures) @@ -409,7 +409,7 @@ end context 'when desired_state is Terminated' do - let(:desired_state) { RemoteDevelopment::Workspaces::States::TERMINATED } + let(:desired_state) { RemoteDevelopment::WorkspaceOperations::States::TERMINATED } let(:expected_value_for_started) { false } it 'returns proper workspace_rails_info entry with config_to_apply' do @@ -438,8 +438,8 @@ end context 'when desired_state is RestartRequested and actual_state is Stopped' do - let(:desired_state) { RemoteDevelopment::Workspaces::States::RESTART_REQUESTED } - let(:expected_desired_state) { RemoteDevelopment::Workspaces::States::RUNNING } + let(:desired_state) { RemoteDevelopment::WorkspaceOperations::States::RESTART_REQUESTED } + let(:expected_desired_state) { RemoteDevelopment::WorkspaceOperations::States::RUNNING } it 'changes desired_state to Running' do # verify initial states in db (sanity check of match between factory and fixtures) @@ -465,8 +465,8 @@ end context 'when actual_state is Unknown' do - let(:current_actual_state) { RemoteDevelopment::Workspaces::States::UNKNOWN } - let(:expected_actual_state) { RemoteDevelopment::Workspaces::States::UNKNOWN } + let(:current_actual_state) { RemoteDevelopment::WorkspaceOperations::States::UNKNOWN } + let(:expected_actual_state) { RemoteDevelopment::WorkspaceOperations::States::UNKNOWN } let(:expected_value_for_started) { false } let(:expected_config_to_apply) do @@ -510,8 +510,8 @@ let(:workspace_agent_info) do create_workspace_agent_info_hash( workspace: nonexistent_workspace, - previous_actual_state: RemoteDevelopment::Workspaces::States::STOPPING, - current_actual_state: RemoteDevelopment::Workspaces::States::STOPPED, + previous_actual_state: RemoteDevelopment::WorkspaceOperations::States::STOPPING, + current_actual_state: RemoteDevelopment::WorkspaceOperations::States::STOPPED, workspace_exists: false, workspace_variables_environment: {}, workspace_variables_file: {} @@ -539,8 +539,8 @@ end context 'when new unprovisioned workspace exists in database"' do - let(:desired_state) { RemoteDevelopment::Workspaces::States::RUNNING } - let(:actual_state) { RemoteDevelopment::Workspaces::States::CREATION_REQUESTED } + let(:desired_state) { RemoteDevelopment::WorkspaceOperations::States::RUNNING } + let(:actual_state) { RemoteDevelopment::WorkspaceOperations::States::CREATION_REQUESTED } let_it_be(:unprovisioned_workspace) do create(:workspace, :unprovisioned, agent: agent, user: user) diff --git a/ee/spec/lib/remote_development/workspaces/reconcile/main_reconcile_scenarios_spec.rb b/ee/spec/lib/remote_development/workspace_operations/reconcile/main_reconcile_scenarios_spec.rb similarity index 98% rename from ee/spec/lib/remote_development/workspaces/reconcile/main_reconcile_scenarios_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/reconcile/main_reconcile_scenarios_spec.rb index 14ab82228fc4501f46d9aa3ff9f7854566139b7f..4d275649036e9ec3772113f6daa40d049d146618 100644 --- a/ee/spec/lib/remote_development/workspaces/reconcile/main_reconcile_scenarios_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/reconcile/main_reconcile_scenarios_spec.rb @@ -7,7 +7,7 @@ # https://gitlab.com/gitlab-org/remote-development/gitlab-remote-development-docs/-/blob/main/doc/workspace-updates.md # are not yet implemented - most or all are related to ERROR or FAILURE states, because the fixtures are not yet # implemented. -RSpec.describe RemoteDevelopment::Workspaces::Reconcile::Main, 'Partial Update Scenarios', feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Reconcile::Main, 'Partial Update Scenarios', feature_category: :remote_development do include_context 'with remote development shared fixtures' let(:logger) { instance_double(::Logger) } @@ -193,7 +193,7 @@ # Handle agent updates agent_actual_state_updates.each_with_index do |actual_state_update_fixture_args, response_expectations_index| - update_type = RemoteDevelopment::Workspaces::Reconcile::UpdateTypes::PARTIAL + update_type = RemoteDevelopment::WorkspaceOperations::Reconcile::UpdateTypes::PARTIAL deployment_resource_version_from_agent ||= initial_resource_version workspace_agent_infos = diff --git a/ee/spec/lib/remote_development/workspaces/reconcile/main_spec.rb b/ee/spec/lib/remote_development/workspace_operations/reconcile/main_spec.rb similarity index 70% rename from ee/spec/lib/remote_development/workspaces/reconcile/main_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/reconcile/main_spec.rb index 40e6c91290db9c119735d3a5919ade3aa2cbc65e..08d60d28682128d7d929853d0bdb52023570bfff 100644 --- a/ee/spec/lib/remote_development/workspaces/reconcile/main_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/reconcile/main_spec.rb @@ -2,7 +2,7 @@ require "fast_spec_helper" -RSpec.describe RemoteDevelopment::Workspaces::Reconcile::Main, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Reconcile::Main, feature_category: :remote_development do let(:context_passed_along_steps) { {} } let(:response_payload) do { @@ -13,16 +13,16 @@ let(:rop_steps) do [ - [RemoteDevelopment::Workspaces::Reconcile::Input::ParamsValidator, :and_then], - [RemoteDevelopment::Workspaces::Reconcile::Input::ParamsExtractor, :map], - [RemoteDevelopment::Workspaces::Reconcile::Input::ParamsToInfosConverter, :map], - [RemoteDevelopment::Workspaces::Reconcile::Input::AgentInfosObserver, :map], - [RemoteDevelopment::Workspaces::Reconcile::Persistence::WorkspacesFromAgentInfosUpdater, :map], - [RemoteDevelopment::Workspaces::Reconcile::Persistence::OrphanedWorkspacesObserver, :map], - [RemoteDevelopment::Workspaces::Reconcile::Persistence::WorkspacesToBeReturnedFinder, :map], - [RemoteDevelopment::Workspaces::Reconcile::Output::ResponsePayloadBuilder, :map], - [RemoteDevelopment::Workspaces::Reconcile::Persistence::WorkspacesToBeReturnedUpdater, :map], - [RemoteDevelopment::Workspaces::Reconcile::Output::ResponsePayloadObserver, :map] + [RemoteDevelopment::WorkspaceOperations::Reconcile::Input::ParamsValidator, :and_then], + [RemoteDevelopment::WorkspaceOperations::Reconcile::Input::ParamsExtractor, :map], + [RemoteDevelopment::WorkspaceOperations::Reconcile::Input::ParamsToInfosConverter, :map], + [RemoteDevelopment::WorkspaceOperations::Reconcile::Input::AgentInfosObserver, :map], + [RemoteDevelopment::WorkspaceOperations::Reconcile::Persistence::WorkspacesFromAgentInfosUpdater, :map], + [RemoteDevelopment::WorkspaceOperations::Reconcile::Persistence::OrphanedWorkspacesObserver, :map], + [RemoteDevelopment::WorkspaceOperations::Reconcile::Persistence::WorkspacesToBeReturnedFinder, :map], + [RemoteDevelopment::WorkspaceOperations::Reconcile::Output::ResponsePayloadBuilder, :map], + [RemoteDevelopment::WorkspaceOperations::Reconcile::Persistence::WorkspacesToBeReturnedUpdater, :map], + [RemoteDevelopment::WorkspaceOperations::Reconcile::Output::ResponsePayloadObserver, :map] ] end @@ -78,7 +78,7 @@ [ "when ParamsValidator returns WorkspaceReconcileParamsValidationFailed", { - step_class: RemoteDevelopment::Workspaces::Reconcile::Input::ParamsValidator, + step_class: RemoteDevelopment::WorkspaceOperations::Reconcile::Input::ParamsValidator, returned_message: lazy { RemoteDevelopment::Messages::WorkspaceReconcileParamsValidationFailed.new(err_message_content) } }, { @@ -90,7 +90,7 @@ [ "when an unmatched error is returned, an exception is raised", { - step_class: RemoteDevelopment::Workspaces::Reconcile::Input::ParamsValidator, + step_class: RemoteDevelopment::WorkspaceOperations::Reconcile::Input::ParamsValidator, returned_message: lazy { Class.new(Gitlab::Fp::Message).new(err_message_content) } }, Gitlab::Fp::UnmatchedResultError diff --git a/ee/spec/lib/remote_development/workspaces/reconcile/output/desired_config_generator_spec.rb b/ee/spec/lib/remote_development/workspace_operations/reconcile/output/desired_config_generator_spec.rb similarity index 88% rename from ee/spec/lib/remote_development/workspaces/reconcile/output/desired_config_generator_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/reconcile/output/desired_config_generator_spec.rb index fc14910a44dcdc39db146af2ea8c0752419da298..aab4f34a8b1e07f95763ab84dd7cda213290ec08 100644 --- a/ee/spec/lib/remote_development/workspaces/reconcile/output/desired_config_generator_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/reconcile/output/desired_config_generator_spec.rb @@ -2,15 +2,15 @@ require 'spec_helper' -RSpec.describe RemoteDevelopment::Workspaces::Reconcile::Output::DesiredConfigGenerator, :freeze_time, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Reconcile::Output::DesiredConfigGenerator, :freeze_time, feature_category: :remote_development do include_context 'with remote development shared fixtures' describe '#generate_desired_config' do let(:logger) { instance_double(Logger) } let(:user) { create(:user) } let(:agent) { create(:ee_cluster_agent, :with_remote_development_agent_config) } - let(:desired_state) { RemoteDevelopment::Workspaces::States::RUNNING } - let(:actual_state) { RemoteDevelopment::Workspaces::States::STOPPED } + let(:desired_state) { RemoteDevelopment::WorkspaceOperations::States::RUNNING } + let(:actual_state) { RemoteDevelopment::WorkspaceOperations::States::STOPPED } let(:started) { true } let(:include_all_resources) { false } let(:deployment_resource_version_from_agent) { workspace.deployment_resource_version } @@ -68,7 +68,7 @@ end context 'when desired_state results in started=false' do - let(:desired_state) { RemoteDevelopment::Workspaces::States::STOPPED } + let(:desired_state) { RemoteDevelopment::WorkspaceOperations::States::STOPPED } let(:started) { false } it 'returns expected config' do @@ -156,7 +156,9 @@ context 'when DevfileParser returns empty array' do before do - allow(RemoteDevelopment::Workspaces::Reconcile::Output::DevfileParser).to receive(:get_all).and_return([]) + # rubocop:todo Layout/LineLength -- this line will not be too long once we rename RemoteDevelopment namespace to Workspaces + allow(RemoteDevelopment::WorkspaceOperations::Reconcile::Output::DevfileParser).to receive(:get_all).and_return([]) + # rubocop:enable Layout/LineLength end it 'returns an empty array' do diff --git a/ee/spec/lib/remote_development/workspaces/reconcile/output/desired_config_generator_v2_spec.rb b/ee/spec/lib/remote_development/workspace_operations/reconcile/output/desired_config_generator_v2_spec.rb similarity index 83% rename from ee/spec/lib/remote_development/workspaces/reconcile/output/desired_config_generator_v2_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/reconcile/output/desired_config_generator_v2_spec.rb index 322d47f77bced5eca7aa1e554576d0f0a752f0b9..58596c6d34aaeba135e6a3d3015228f786d8341d 100644 --- a/ee/spec/lib/remote_development/workspaces/reconcile/output/desired_config_generator_v2_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/reconcile/output/desired_config_generator_v2_spec.rb @@ -2,15 +2,15 @@ require 'spec_helper' -RSpec.describe RemoteDevelopment::Workspaces::Reconcile::Output::DesiredConfigGeneratorV2, :freeze_time, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Reconcile::Output::DesiredConfigGeneratorV2, :freeze_time, feature_category: :remote_development do include_context 'with remote development shared fixtures' describe '#generate_desired_config' do let(:logger) { instance_double(Logger) } let(:user) { create(:user) } let(:agent) { create(:ee_cluster_agent, :with_remote_development_agent_config) } - let(:desired_state) { RemoteDevelopment::Workspaces::States::RUNNING } - let(:actual_state) { RemoteDevelopment::Workspaces::States::STOPPED } + let(:desired_state) { RemoteDevelopment::WorkspaceOperations::States::RUNNING } + let(:actual_state) { RemoteDevelopment::WorkspaceOperations::States::STOPPED } let(:started) { true } let(:include_all_resources) { false } let(:deployment_resource_version_from_agent) { workspace.deployment_resource_version } @@ -63,7 +63,7 @@ end context 'when desired_state results in started=false' do - let(:desired_state) { RemoteDevelopment::Workspaces::States::STOPPED } + let(:desired_state) { RemoteDevelopment::WorkspaceOperations::States::STOPPED } let(:started) { false } it 'returns expected config' do @@ -107,7 +107,9 @@ context 'when DevfileParser returns empty array' do before do - allow(RemoteDevelopment::Workspaces::Reconcile::Output::DevfileParserV2).to receive(:get_all).and_return([]) + # rubocop:todo Layout/LineLength -- this line will not be too long once we rename RemoteDevelopment namespace to Workspaces + allow(RemoteDevelopment::WorkspaceOperations::Reconcile::Output::DevfileParserV2).to receive(:get_all).and_return([]) + # rubocop:enable Layout/LineLength end it 'returns an empty array' do diff --git a/ee/spec/lib/remote_development/workspaces/reconcile/output/devfile_parser_spec.rb b/ee/spec/lib/remote_development/workspace_operations/reconcile/output/devfile_parser_spec.rb similarity index 93% rename from ee/spec/lib/remote_development/workspaces/reconcile/output/devfile_parser_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/reconcile/output/devfile_parser_spec.rb index a0611146a49f4584eeb8d558c5a37086bf86d824..e1572b34ff28935580ac738dd7b514ee3185aaea 100644 --- a/ee/spec/lib/remote_development/workspaces/reconcile/output/devfile_parser_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/reconcile/output/devfile_parser_spec.rb @@ -2,7 +2,7 @@ require "fast_spec_helper" -RSpec.describe RemoteDevelopment::Workspaces::Reconcile::Output::DevfileParser, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Reconcile::Output::DevfileParser, feature_category: :remote_development do include_context 'with remote development shared fixtures' let(:dns_zone) { "workspaces.localdev.me" } @@ -16,8 +16,8 @@ name: "name", namespace: "namespace", deployment_resource_version: "1", - desired_state: RemoteDevelopment::Workspaces::States::RUNNING, - actual_state: RemoteDevelopment::Workspaces::States::STOPPED, + desired_state: RemoteDevelopment::WorkspaceOperations::States::RUNNING, + actual_state: RemoteDevelopment::WorkspaceOperations::States::STOPPED, dns_zone: dns_zone, processed_devfile: example_processed_devfile, user: user, diff --git a/ee/spec/lib/remote_development/workspaces/reconcile/output/devfile_parser_v2_spec.rb b/ee/spec/lib/remote_development/workspace_operations/reconcile/output/devfile_parser_v2_spec.rb similarity index 91% rename from ee/spec/lib/remote_development/workspaces/reconcile/output/devfile_parser_v2_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/reconcile/output/devfile_parser_v2_spec.rb index f4a554ed30ed2e1e4057270dd0b07c6594ecd014..9d97482ece0b084a791ce05617e0756102f329f6 100644 --- a/ee/spec/lib/remote_development/workspaces/reconcile/output/devfile_parser_v2_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/reconcile/output/devfile_parser_v2_spec.rb @@ -2,7 +2,7 @@ require "fast_spec_helper" -RSpec.describe RemoteDevelopment::Workspaces::Reconcile::Output::DevfileParserV2, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Reconcile::Output::DevfileParserV2, feature_category: :remote_development do include_context 'with remote development shared fixtures' let(:dns_zone) { "workspaces.localdev.me" } @@ -17,8 +17,8 @@ name: "name", namespace: "namespace", deployment_resource_version: "1", - desired_state: RemoteDevelopment::Workspaces::States::RUNNING, - actual_state: RemoteDevelopment::Workspaces::States::STOPPED, + desired_state: RemoteDevelopment::WorkspaceOperations::States::RUNNING, + actual_state: RemoteDevelopment::WorkspaceOperations::States::STOPPED, dns_zone: dns_zone, processed_devfile: processed_devfile, user: user, diff --git a/ee/spec/lib/remote_development/workspaces/reconcile/output/response_payload_builder_spec.rb b/ee/spec/lib/remote_development/workspace_operations/reconcile/output/response_payload_builder_spec.rb similarity index 86% rename from ee/spec/lib/remote_development/workspaces/reconcile/output/response_payload_builder_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/reconcile/output/response_payload_builder_spec.rb index c575e92b0a5f320b10e247a434ce2cc5b28629a6..a7508aafa1203c11b24f11e05772b7ab461a30af 100644 --- a/ee/spec/lib/remote_development/workspaces/reconcile/output/response_payload_builder_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/reconcile/output/response_payload_builder_spec.rb @@ -2,16 +2,16 @@ require "fast_spec_helper" -RSpec.describe RemoteDevelopment::Workspaces::Reconcile::Output::ResponsePayloadBuilder, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Reconcile::Output::ResponsePayloadBuilder, feature_category: :remote_development do include_context 'with remote development shared fixtures' let(:logger) { instance_double(Logger) } - let(:desired_state) { RemoteDevelopment::Workspaces::States::RUNNING } - let(:actual_state) { RemoteDevelopment::Workspaces::States::STOPPED } + let(:desired_state) { RemoteDevelopment::WorkspaceOperations::States::RUNNING } + let(:actual_state) { RemoteDevelopment::WorkspaceOperations::States::STOPPED } let(:processed_devfile) { example_processed_devfile } let(:force_include_all_resources) { false } - let(:current_config_version) { RemoteDevelopment::Workspaces::ConfigVersion::VERSION_3 } - let(:previous_config_version) { RemoteDevelopment::Workspaces::ConfigVersion::VERSION_2 } + let(:current_config_version) { RemoteDevelopment::WorkspaceOperations::ConfigVersion::VERSION_3 } + let(:previous_config_version) { RemoteDevelopment::WorkspaceOperations::ConfigVersion::VERSION_2 } let(:workspace) do instance_double( "RemoteDevelopment::Workspace", @@ -103,14 +103,14 @@ let(:config_version) { current_config_version } before do - allow(RemoteDevelopment::Workspaces::Reconcile::Output::DesiredConfigGenerator) + allow(RemoteDevelopment::WorkspaceOperations::Reconcile::Output::DesiredConfigGenerator) .to(receive(:generate_desired_config)) .with(hash_including(include_all_resources: expected_include_all_resources)) { generated_config_to_apply } end context "when update_type is FULL" do let(:desired_state_updated_more_recently_than_last_response_to_agent) { false } - let(:update_type) { RemoteDevelopment::Workspaces::Reconcile::UpdateTypes::FULL } + let(:update_type) { RemoteDevelopment::WorkspaceOperations::Reconcile::UpdateTypes::FULL } let(:expected_include_all_resources) { true } it "includes config_to_apply with all resources included" do @@ -119,7 +119,7 @@ end context "when update_type is PARTIAL" do - let(:update_type) { RemoteDevelopment::Workspaces::Reconcile::UpdateTypes::PARTIAL } + let(:update_type) { RemoteDevelopment::WorkspaceOperations::Reconcile::UpdateTypes::PARTIAL } context 'when force_include_all_resources is true' do let(:force_include_all_resources) { true } @@ -174,12 +174,12 @@ context "when workspace.config_version is previous version" do let(:config_version) { previous_config_version } - let(:update_type) { RemoteDevelopment::Workspaces::Reconcile::UpdateTypes::FULL } + let(:update_type) { RemoteDevelopment::WorkspaceOperations::Reconcile::UpdateTypes::FULL } let(:desired_state_updated_more_recently_than_last_response_to_agent) { false } let(:expected_include_all_resources) { true } it "includes config_to_apply with all resources included" do - allow(RemoteDevelopment::Workspaces::Reconcile::Output::DesiredConfigGeneratorV2) + allow(RemoteDevelopment::WorkspaceOperations::Reconcile::Output::DesiredConfigGeneratorV2) .to(receive(:generate_desired_config)) .with(hash_including(include_all_resources: expected_include_all_resources)) { generated_config_to_apply } diff --git a/ee/spec/lib/remote_development/workspaces/reconcile/output/response_payload_observer_spec.rb b/ee/spec/lib/remote_development/workspace_operations/reconcile/output/response_payload_observer_spec.rb similarity index 86% rename from ee/spec/lib/remote_development/workspaces/reconcile/output/response_payload_observer_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/reconcile/output/response_payload_observer_spec.rb index 59d63a2a6a5bd44699a652dfd0d8f81189607025..d09b9bde4309f6b3dc0350c59119b46d46036a8c 100644 --- a/ee/spec/lib/remote_development/workspaces/reconcile/output/response_payload_observer_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/reconcile/output/response_payload_observer_spec.rb @@ -2,11 +2,11 @@ require "fast_spec_helper" -RSpec.describe RemoteDevelopment::Workspaces::Reconcile::Output::ResponsePayloadObserver, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Reconcile::Output::ResponsePayloadObserver, feature_category: :remote_development do let(:agent) { instance_double("Clusters::Agent", id: 1) } - let(:update_type) { RemoteDevelopment::Workspaces::Reconcile::UpdateTypes::PARTIAL } - let(:desired_state) { RemoteDevelopment::Workspaces::States::RUNNING } - let(:actual_state) { RemoteDevelopment::Workspaces::States::STOPPED } + let(:update_type) { RemoteDevelopment::WorkspaceOperations::Reconcile::UpdateTypes::PARTIAL } + let(:desired_state) { RemoteDevelopment::WorkspaceOperations::States::RUNNING } + let(:actual_state) { RemoteDevelopment::WorkspaceOperations::States::STOPPED } let(:logger) { instance_double(::Logger) } let(:workspace_rails_infos) do diff --git a/ee/spec/lib/remote_development/workspaces/reconcile/persistence/orphaned_workspaces_observer_spec.rb b/ee/spec/lib/remote_development/workspace_operations/reconcile/persistence/orphaned_workspaces_observer_spec.rb similarity index 80% rename from ee/spec/lib/remote_development/workspaces/reconcile/persistence/orphaned_workspaces_observer_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/reconcile/persistence/orphaned_workspaces_observer_spec.rb index c9095c6fd5f2c427d551271a66768390aed54afb..f58b77f6a59aeca16cd1d0a72d37bc265dd1be08 100644 --- a/ee/spec/lib/remote_development/workspaces/reconcile/persistence/orphaned_workspaces_observer_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/reconcile/persistence/orphaned_workspaces_observer_spec.rb @@ -2,27 +2,27 @@ require "fast_spec_helper" -RSpec.describe RemoteDevelopment::Workspaces::Reconcile::Persistence::OrphanedWorkspacesObserver, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Reconcile::Persistence::OrphanedWorkspacesObserver, feature_category: :remote_development do let(:agent) { instance_double("Clusters::Agent", id: 1) } - let(:update_type) { RemoteDevelopment::Workspaces::Reconcile::UpdateTypes::PARTIAL } + let(:update_type) { RemoteDevelopment::WorkspaceOperations::Reconcile::UpdateTypes::PARTIAL } let(:logger) { instance_double(::Logger) } let(:workspace) { instance_double("RemoteDevelopment::Workspace", name: "name", namespace: "namespace") } let(:persisted_workspace_agent_info) do - RemoteDevelopment::Workspaces::Reconcile::Input::AgentInfo.new( + RemoteDevelopment::WorkspaceOperations::Reconcile::Input::AgentInfo.new( name: workspace.name, namespace: workspace.namespace, - actual_state: RemoteDevelopment::Workspaces::States::STOPPED, + actual_state: RemoteDevelopment::WorkspaceOperations::States::STOPPED, deployment_resource_version: "1" ) end let(:orphaned_workspace_agent_info) do - RemoteDevelopment::Workspaces::Reconcile::Input::AgentInfo.new( + RemoteDevelopment::WorkspaceOperations::Reconcile::Input::AgentInfo.new( name: "orphaned_workspace", namespace: "orphaned_workspace_namespace", - actual_state: RemoteDevelopment::Workspaces::States::RUNNING, + actual_state: RemoteDevelopment::WorkspaceOperations::States::RUNNING, deployment_resource_version: "1" ) end diff --git a/ee/spec/lib/remote_development/workspaces/reconcile/persistence/workspaces_from_agent_infos_updater_spec.rb b/ee/spec/lib/remote_development/workspace_operations/reconcile/persistence/workspaces_from_agent_infos_updater_spec.rb similarity index 74% rename from ee/spec/lib/remote_development/workspaces/reconcile/persistence/workspaces_from_agent_infos_updater_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/reconcile/persistence/workspaces_from_agent_infos_updater_spec.rb index c098fd8d6f57a77c6567ccef08a498273e65d701..ba9e06f696409813decd13019675b5d170566777 100644 --- a/ee/spec/lib/remote_development/workspaces/reconcile/persistence/workspaces_from_agent_infos_updater_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/reconcile/persistence/workspaces_from_agent_infos_updater_spec.rb @@ -2,14 +2,14 @@ require 'spec_helper' -RSpec.describe RemoteDevelopment::Workspaces::Reconcile::Persistence::WorkspacesFromAgentInfosUpdater, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Reconcile::Persistence::WorkspacesFromAgentInfosUpdater, feature_category: :remote_development do include_context 'with remote development shared fixtures' let_it_be(:user) { create(:user) } let_it_be(:agent) { create(:ee_cluster_agent, :with_remote_development_agent_config) } - let(:desired_state) { RemoteDevelopment::Workspaces::States::RUNNING } - let(:actual_state) { RemoteDevelopment::Workspaces::States::STARTING } + let(:desired_state) { RemoteDevelopment::WorkspaceOperations::States::RUNNING } + let(:actual_state) { RemoteDevelopment::WorkspaceOperations::States::STARTING } let(:workspace) do create( @@ -22,7 +22,7 @@ end let(:workspace_agent_info) do - RemoteDevelopment::Workspaces::Reconcile::Input::AgentInfo.new( + RemoteDevelopment::WorkspaceOperations::Reconcile::Input::AgentInfo.new( name: workspace.name, namespace: workspace.namespace, actual_state: actual_state, @@ -52,12 +52,12 @@ end context "when persisted workspace desired_state is RESTART_REQUESTED and actual_state is STOPPED" do - let(:desired_state) { RemoteDevelopment::Workspaces::States::RESTART_REQUESTED } - let(:actual_state) { RemoteDevelopment::Workspaces::States::STOPPED } + let(:desired_state) { RemoteDevelopment::WorkspaceOperations::States::RESTART_REQUESTED } + let(:actual_state) { RemoteDevelopment::WorkspaceOperations::States::STOPPED } it "sets persisted workspace desired state to RUNNING" do expect(returned_value).to eq(context.merge(workspaces_from_agent_infos: [workspace])) - expect(workspace.reload.desired_state).to eq(RemoteDevelopment::Workspaces::States::RUNNING) + expect(workspace.reload.desired_state).to eq(RemoteDevelopment::WorkspaceOperations::States::RUNNING) end end @@ -68,7 +68,7 @@ it "sets persisted workspace desired state to TERMINATED" do expect(returned_value).to eq(context.merge(workspaces_from_agent_infos: [workspace])) - expect(workspace.reload.desired_state).to eq(RemoteDevelopment::Workspaces::States::TERMINATED) + expect(workspace.reload.desired_state).to eq(RemoteDevelopment::WorkspaceOperations::States::TERMINATED) end end end diff --git a/ee/spec/lib/remote_development/workspaces/reconcile/persistence/workspaces_to_be_returned_finder_spec.rb b/ee/spec/lib/remote_development/workspace_operations/reconcile/persistence/workspaces_to_be_returned_finder_spec.rb similarity index 90% rename from ee/spec/lib/remote_development/workspaces/reconcile/persistence/workspaces_to_be_returned_finder_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/reconcile/persistence/workspaces_to_be_returned_finder_spec.rb index b6484b6bd4c631198437fc72fd1ebae1b7b67814..0259eb8f3c7d99848f4f18c61bc858bf196474f8 100644 --- a/ee/spec/lib/remote_development/workspaces/reconcile/persistence/workspaces_to_be_returned_finder_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/reconcile/persistence/workspaces_to_be_returned_finder_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 -RSpec.describe RemoteDevelopment::Workspaces::Reconcile::Persistence::WorkspacesToBeReturnedFinder, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Reconcile::Persistence::WorkspacesToBeReturnedFinder, feature_category: :remote_development do let_it_be(:user) { create(:user) } let_it_be(:agent) { create(:ee_cluster_agent, :with_remote_development_agent_config) } @@ -24,8 +24,8 @@ :workspace, :without_realistic_after_create_timestamp_updates, name: "workspace_that_is_terminated", - desired_state: RemoteDevelopment::Workspaces::States::TERMINATED, - actual_state: RemoteDevelopment::Workspaces::States::TERMINATED, + desired_state: RemoteDevelopment::WorkspaceOperations::States::TERMINATED, + actual_state: RemoteDevelopment::WorkspaceOperations::States::TERMINATED, agent: agent, user: user, force_include_all_resources: false, @@ -119,7 +119,7 @@ end context "with fixture sanity checks" do - let(:update_type) { RemoteDevelopment::Workspaces::Reconcile::UpdateTypes::FULL } + let(:update_type) { RemoteDevelopment::WorkspaceOperations::Reconcile::UpdateTypes::FULL } it "has the expected fixtures" do expect(workspace_only_returned_by_full_update.desired_state_updated_at) @@ -134,7 +134,7 @@ end context "for update_type FULL" do - let(:update_type) { RemoteDevelopment::Workspaces::Reconcile::UpdateTypes::FULL } + let(:update_type) { RemoteDevelopment::WorkspaceOperations::Reconcile::UpdateTypes::FULL } let(:expected_workspaces_to_be_returned) do [ @@ -163,7 +163,7 @@ end context "for update_type PARTIAL" do - let(:update_type) { RemoteDevelopment::Workspaces::Reconcile::UpdateTypes::PARTIAL } + let(:update_type) { RemoteDevelopment::WorkspaceOperations::Reconcile::UpdateTypes::PARTIAL } let(:expected_workspaces_to_be_returned) do [ diff --git a/ee/spec/lib/remote_development/workspaces/reconcile/persistence/workspaces_to_be_returned_updater_spec.rb b/ee/spec/lib/remote_development/workspace_operations/reconcile/persistence/workspaces_to_be_returned_updater_spec.rb similarity index 95% rename from ee/spec/lib/remote_development/workspaces/reconcile/persistence/workspaces_to_be_returned_updater_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/reconcile/persistence/workspaces_to_be_returned_updater_spec.rb index 9755c3a47bc04ec30d6f58e0ba371813735982d9..7442f0ef9544127d4d5a0c9b36430e8ff8e1446c 100644 --- a/ee/spec/lib/remote_development/workspaces/reconcile/persistence/workspaces_to_be_returned_updater_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/reconcile/persistence/workspaces_to_be_returned_updater_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe RemoteDevelopment::Workspaces::Reconcile::Persistence::WorkspacesToBeReturnedUpdater, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Reconcile::Persistence::WorkspacesToBeReturnedUpdater, feature_category: :remote_development do let_it_be(:user) { create(:user) } let_it_be(:agent) { create(:ee_cluster_agent, :with_remote_development_agent_config) } diff --git a/ee/spec/lib/remote_development/workspaces/states_spec.rb b/ee/spec/lib/remote_development/workspace_operations/states_spec.rb similarity index 69% rename from ee/spec/lib/remote_development/workspaces/states_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/states_spec.rb index 8591c5cc10312079a2df32d84aea43fc761db6fb..d494bb048282c9b7c262655d88aea57a8639863d 100644 --- a/ee/spec/lib/remote_development/workspaces/states_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/states_spec.rb @@ -2,26 +2,26 @@ require "fast_spec_helper" -RSpec.describe RemoteDevelopment::Workspaces::States, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::States, feature_category: :remote_development do let(:object) { Object.new.extend(described_class) } describe '.valid_desired_state?' do it 'returns true for a valid desired state' do - expect(object.valid_desired_state?(RemoteDevelopment::Workspaces::States::RESTART_REQUESTED)).to be(true) + expect(object.valid_desired_state?(RemoteDevelopment::WorkspaceOperations::States::RESTART_REQUESTED)).to be(true) end it 'returns false for an invalid desired state' do - expect(object.valid_desired_state?(RemoteDevelopment::Workspaces::States::FAILED)).to be(false) + expect(object.valid_desired_state?(RemoteDevelopment::WorkspaceOperations::States::FAILED)).to be(false) end end describe '.valid_actual_state?' do it 'returns true for a valid actual state' do - expect(object.valid_actual_state?(RemoteDevelopment::Workspaces::States::RUNNING)).to be(true) + expect(object.valid_actual_state?(RemoteDevelopment::WorkspaceOperations::States::RUNNING)).to be(true) end it 'returns false for an invalid actual state' do - expect(object.valid_actual_state?(RemoteDevelopment::Workspaces::States::RESTART_REQUESTED)).to be(false) + expect(object.valid_actual_state?(RemoteDevelopment::WorkspaceOperations::States::RESTART_REQUESTED)).to be(false) end end end diff --git a/ee/spec/lib/remote_development/workspaces/update/authorizer_spec.rb b/ee/spec/lib/remote_development/workspace_operations/update/authorizer_spec.rb similarity index 89% rename from ee/spec/lib/remote_development/workspaces/update/authorizer_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/update/authorizer_spec.rb index c2bb29e8b738322355d65c6a544586bea4a57158..5803d070a796fdb25ced081c62a9239599c9abd3 100644 --- a/ee/spec/lib/remote_development/workspaces/update/authorizer_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/update/authorizer_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe RemoteDevelopment::Workspaces::Update::Authorizer, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Update::Authorizer, feature_category: :remote_development do include ResultMatchers let(:workspace) { build_stubbed(:workspace) } diff --git a/ee/spec/lib/remote_development/workspaces/update/main_integration_spec.rb b/ee/spec/lib/remote_development/workspace_operations/update/main_integration_spec.rb similarity index 83% rename from ee/spec/lib/remote_development/workspaces/update/main_integration_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/update/main_integration_spec.rb index 74c39696056729824428208926767869577b3bce..8bd783defec66e061f8dfbfbbe1023f2756d9c03 100644 --- a/ee/spec/lib/remote_development/workspaces/update/main_integration_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/update/main_integration_spec.rb @@ -2,14 +2,14 @@ require 'spec_helper' -RSpec.describe ::RemoteDevelopment::Workspaces::Update::Main, "Integration", feature_category: :remote_development do +RSpec.describe ::RemoteDevelopment::WorkspaceOperations::Update::Main, "Integration", feature_category: :remote_development do let_it_be(:user) { create(:user) } let_it_be(:current_user) { user } let_it_be(:workspace, refind: true) do - create(:workspace, user: user, desired_state: RemoteDevelopment::Workspaces::States::RUNNING) + create(:workspace, user: user, desired_state: RemoteDevelopment::WorkspaceOperations::States::RUNNING) end - let(:new_desired_state) { RemoteDevelopment::Workspaces::States::STOPPED } + let(:new_desired_state) { RemoteDevelopment::WorkspaceOperations::States::STOPPED } let(:params) { { desired_state: new_desired_state } } let(:context) { { workspace: workspace, current_user: current_user, params: params } } diff --git a/ee/spec/lib/remote_development/workspaces/update/main_spec.rb b/ee/spec/lib/remote_development/workspace_operations/update/main_spec.rb similarity index 84% rename from ee/spec/lib/remote_development/workspaces/update/main_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/update/main_spec.rb index f831dd2c7740178846e70c275c5493deae83bfec..d6eeaac132bf6e1f52ab0cdcf85504443a857991 100644 --- a/ee/spec/lib/remote_development/workspaces/update/main_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/update/main_spec.rb @@ -2,13 +2,13 @@ require "fast_spec_helper" -RSpec.describe RemoteDevelopment::Workspaces::Update::Main, feature_category: :remote_development do +RSpec.describe RemoteDevelopment::WorkspaceOperations::Update::Main, feature_category: :remote_development do let(:context_passed_along_steps) { {} } let(:rop_steps) do [ - [RemoteDevelopment::Workspaces::Update::Authorizer, :and_then], - [RemoteDevelopment::Workspaces::Update::Updater, :and_then] + [RemoteDevelopment::WorkspaceOperations::Update::Authorizer, :and_then], + [RemoteDevelopment::WorkspaceOperations::Update::Updater, :and_then] ] end @@ -31,7 +31,7 @@ .with_context_passed_along_steps(context_passed_along_steps) .with_ok_result_for_step( { - step_class: RemoteDevelopment::Workspaces::Update::Updater, + step_class: RemoteDevelopment::WorkspaceOperations::Update::Updater, returned_message: RemoteDevelopment::Messages::WorkspaceUpdateSuccessful.new( ok_message_content ) @@ -65,7 +65,7 @@ [ "when Authorizer returns Unauthorized", { - step_class: RemoteDevelopment::Workspaces::Update::Authorizer, + step_class: RemoteDevelopment::WorkspaceOperations::Update::Authorizer, returned_message: lazy { RemoteDevelopment::Messages::Unauthorized.new(err_message_content) } }, { @@ -77,7 +77,7 @@ [ "when Updater returns WorkspaceUpdateFailed", { - step_class: RemoteDevelopment::Workspaces::Update::Updater, + step_class: RemoteDevelopment::WorkspaceOperations::Update::Updater, returned_message: lazy { RemoteDevelopment::Messages::WorkspaceUpdateFailed.new(err_message_content) } }, { @@ -89,7 +89,7 @@ [ "when an unmatched error is returned, an exception is raised", { - step_class: RemoteDevelopment::Workspaces::Update::Authorizer, + step_class: RemoteDevelopment::WorkspaceOperations::Update::Authorizer, returned_message: lazy { Class.new(Gitlab::Fp::Message).new(err_message_content) } }, Gitlab::Fp::UnmatchedResultError diff --git a/ee/spec/lib/remote_development/workspaces/update/updater_spec.rb b/ee/spec/lib/remote_development/workspace_operations/update/updater_spec.rb similarity index 88% rename from ee/spec/lib/remote_development/workspaces/update/updater_spec.rb rename to ee/spec/lib/remote_development/workspace_operations/update/updater_spec.rb index 0b031424d0e1d483e4e30321930ddb664044d488..c8c385ea27a6f7003812d56bc181d982786167f2 100644 --- a/ee/spec/lib/remote_development/workspaces/update/updater_spec.rb +++ b/ee/spec/lib/remote_development/workspace_operations/update/updater_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::RemoteDevelopment::Workspaces::Update::Updater, feature_category: :remote_development do +RSpec.describe ::RemoteDevelopment::WorkspaceOperations::Update::Updater, feature_category: :remote_development do include ResultMatchers subject(:result) do @@ -16,12 +16,12 @@ create( :workspace, user: user, - desired_state: RemoteDevelopment::Workspaces::States::RUNNING, + desired_state: RemoteDevelopment::WorkspaceOperations::States::RUNNING, personal_access_token: personal_access_token ) end - let(:new_desired_state) { RemoteDevelopment::Workspaces::States::STOPPED } + let(:new_desired_state) { RemoteDevelopment::WorkspaceOperations::States::STOPPED } let(:params) do { desired_state: new_desired_state @@ -61,7 +61,7 @@ end context 'when personal access token revocation fails' do - let(:new_desired_state) { RemoteDevelopment::Workspaces::States::TERMINATED } + let(:new_desired_state) { RemoteDevelopment::WorkspaceOperations::States::TERMINATED } let(:errors) { instance_double(ActiveModel::Errors) } let(:exception) { ActiveRecord::ActiveRecordError.new } let(:mock_personal_access_token) { instance_double(PersonalAccessToken) } diff --git a/ee/spec/models/remote_development/workspace_spec.rb b/ee/spec/models/remote_development/workspace_spec.rb index a71dcc72de51c4614efd44ee75df8dd7e73fa076..8b7d81bff4a312ea775049cd7f345d40374621d3 100644 --- a/ee/spec/models/remote_development/workspace_spec.rb +++ b/ee/spec/models/remote_development/workspace_spec.rb @@ -8,7 +8,7 @@ let_it_be(:project) { create(:project, :in_group) } let_it_be(:personal_access_token) { create(:personal_access_token, user: user) } - let(:desired_state) { ::RemoteDevelopment::Workspaces::States::STOPPED } + let(:desired_state) { ::RemoteDevelopment::WorkspaceOperations::States::STOPPED } subject(:workspace) do create(:workspace, @@ -87,7 +87,9 @@ describe 'when updating desired_state' do it 'sets desired_state_updated_at' do - expect { workspace.update!(desired_state: ::RemoteDevelopment::Workspaces::States::RUNNING) }.to change { + # rubocop:todo Layout/LineLength -- this line will not be too long once we rename RemoteDevelopment namespace to Workspaces + expect { workspace.update!(desired_state: ::RemoteDevelopment::WorkspaceOperations::States::RUNNING) }.to change { + # rubocop:enable Layout/LineLength workspace.desired_state_updated_at } end @@ -95,7 +97,9 @@ describe 'when updating a field other than desired_state' do it 'does not set desired_state_updated_at' do - expect { workspace.update!(actual_state: ::RemoteDevelopment::Workspaces::States::RUNNING) }.not_to change { + # rubocop:todo Layout/LineLength -- this line will not be too long once we rename RemoteDevelopment namespace to Workspaces + expect { workspace.update!(actual_state: ::RemoteDevelopment::WorkspaceOperations::States::RUNNING) }.not_to change { + # rubocop:enable Layout/LineLength workspace.desired_state_updated_at } end @@ -214,7 +218,7 @@ context "when workspace is in desired_state Terminated" do before do - workspace.desired_state = ::RemoteDevelopment::Workspaces::States::TERMINATED + workspace.desired_state = ::RemoteDevelopment::WorkspaceOperations::States::TERMINATED end it 'does not validate dns_zone matches agent.remote_development_agent_config.dns_zone' do @@ -224,7 +228,7 @@ context "when workspace is not in desired_state terminated" do before do - workspace.desired_state = ::RemoteDevelopment::Workspaces::States::RUNNING + workspace.desired_state = ::RemoteDevelopment::WorkspaceOperations::States::RUNNING end it 'validates dns_zone matches agent.remote_development_agent_config.dns_zone' do @@ -237,10 +241,10 @@ end context 'when desired_state is Terminated' do - let(:desired_state) { ::RemoteDevelopment::Workspaces::States::TERMINATED } + let(:desired_state) { ::RemoteDevelopment::WorkspaceOperations::States::TERMINATED } before do - workspace.desired_state = ::RemoteDevelopment::Workspaces::States::STOPPED + workspace.desired_state = ::RemoteDevelopment::WorkspaceOperations::States::STOPPED end it 'prevents changes to desired_state' do @@ -257,25 +261,28 @@ let_it_be(:agent1, reload: true) { create(:ee_cluster_agent, :with_remote_development_agent_config) } let_it_be(:agent2, reload: true) { create(:ee_cluster_agent, :with_remote_development_agent_config) } let_it_be(:workspace1) do - create(:workspace, user: user1, agent: agent1, desired_state: ::RemoteDevelopment::Workspaces::States::RUNNING) + create(:workspace, user: user1, agent: agent1, + desired_state: ::RemoteDevelopment::WorkspaceOperations::States::RUNNING) end let_it_be(:workspace2) do create(:workspace, user: user2, agent: agent1, - desired_state: ::RemoteDevelopment::Workspaces::States::TERMINATED) + desired_state: ::RemoteDevelopment::WorkspaceOperations::States::TERMINATED) end let_it_be(:workspace3) do - create(:workspace, user: user1, agent: agent1, desired_state: ::RemoteDevelopment::Workspaces::States::STOPPED) + create(:workspace, user: user1, agent: agent1, + desired_state: ::RemoteDevelopment::WorkspaceOperations::States::STOPPED) end let_it_be(:workspace4) do create(:workspace, user: user2, agent: agent2, - desired_state: ::RemoteDevelopment::Workspaces::States::TERMINATED) + desired_state: ::RemoteDevelopment::WorkspaceOperations::States::TERMINATED) end let_it_be(:workspace5) do - create(:workspace, user: user3, agent: agent2, desired_state: ::RemoteDevelopment::Workspaces::States::RUNNING) + create(:workspace, user: user3, agent: agent2, + desired_state: ::RemoteDevelopment::WorkspaceOperations::States::RUNNING) end it "returns the correct count for the current user and agent" do @@ -290,23 +297,23 @@ let_it_be(:agent1, reload: true) { create(:ee_cluster_agent, :with_remote_development_agent_config) } let_it_be(:agent2, reload: true) { create(:ee_cluster_agent, :with_remote_development_agent_config) } let_it_be(:workspace1) do - create(:workspace, agent: agent1, desired_state: ::RemoteDevelopment::Workspaces::States::RUNNING) + create(:workspace, agent: agent1, desired_state: ::RemoteDevelopment::WorkspaceOperations::States::RUNNING) end let_it_be(:workspace2) do - create(:workspace, agent: agent1, desired_state: ::RemoteDevelopment::Workspaces::States::TERMINATED) + create(:workspace, agent: agent1, desired_state: ::RemoteDevelopment::WorkspaceOperations::States::TERMINATED) end let_it_be(:workspace3) do - create(:workspace, agent: agent1, desired_state: ::RemoteDevelopment::Workspaces::States::STOPPED) + create(:workspace, agent: agent1, desired_state: ::RemoteDevelopment::WorkspaceOperations::States::STOPPED) end let_it_be(:workspace4) do - create(:workspace, agent: agent2, desired_state: ::RemoteDevelopment::Workspaces::States::TERMINATED) + create(:workspace, agent: agent2, desired_state: ::RemoteDevelopment::WorkspaceOperations::States::TERMINATED) end let_it_be(:workspace5) do - create(:workspace, agent: agent2, desired_state: ::RemoteDevelopment::Workspaces::States::RUNNING) + create(:workspace, agent: agent2, desired_state: ::RemoteDevelopment::WorkspaceOperations::States::RUNNING) end it "returns the correct count for the current agent" do diff --git a/ee/spec/requests/api/graphql/mutations/remote_development/namespace_cluster_agent_mappings/create_spec.rb b/ee/spec/requests/api/graphql/mutations/remote_development/namespace_cluster_agent_mapping_operations/create_spec.rb similarity index 99% rename from ee/spec/requests/api/graphql/mutations/remote_development/namespace_cluster_agent_mappings/create_spec.rb rename to ee/spec/requests/api/graphql/mutations/remote_development/namespace_cluster_agent_mapping_operations/create_spec.rb index bc7181057d4e7f3b7e0fb44815c9999b96ee1f6d..15068005902c4d63f1c9f0ef9aec494adcfc3476 100644 --- a/ee/spec/requests/api/graphql/mutations/remote_development/namespace_cluster_agent_mappings/create_spec.rb +++ b/ee/spec/requests/api/graphql/mutations/remote_development/namespace_cluster_agent_mapping_operations/create_spec.rb @@ -32,7 +32,7 @@ let(:mutation_args) { all_mutation_args } let(:expected_service_args) do { - domain_main_class: ::RemoteDevelopment::NamespaceClusterAgentMappings::Create::Main, + domain_main_class: ::RemoteDevelopment::NamespaceClusterAgentMappingOperations::Create::Main, domain_main_class_args: { namespace: namespace, cluster_agent: agent, diff --git a/ee/spec/requests/api/graphql/mutations/remote_development/namespace_cluster_agent_mappings/delete_spec.rb b/ee/spec/requests/api/graphql/mutations/remote_development/namespace_cluster_agent_mapping_operations/delete_spec.rb similarity index 99% rename from ee/spec/requests/api/graphql/mutations/remote_development/namespace_cluster_agent_mappings/delete_spec.rb rename to ee/spec/requests/api/graphql/mutations/remote_development/namespace_cluster_agent_mapping_operations/delete_spec.rb index 6fefbcd039a5c26f11e660fdd08a56235c74e010..3c2699a317d22b5c8ce48e6d313da0c1b063c8b2 100644 --- a/ee/spec/requests/api/graphql/mutations/remote_development/namespace_cluster_agent_mappings/delete_spec.rb +++ b/ee/spec/requests/api/graphql/mutations/remote_development/namespace_cluster_agent_mapping_operations/delete_spec.rb @@ -31,7 +31,7 @@ let(:expected_service_args) do { - domain_main_class: ::RemoteDevelopment::NamespaceClusterAgentMappings::Delete::Main, + domain_main_class: ::RemoteDevelopment::NamespaceClusterAgentMappingOperations::Delete::Main, domain_main_class_args: { namespace: namespace, cluster_agent: agent diff --git a/ee/spec/requests/api/graphql/mutations/remote_development/workspaces/create_spec.rb b/ee/spec/requests/api/graphql/mutations/remote_development/workspace_operations/create_spec.rb similarity index 97% rename from ee/spec/requests/api/graphql/mutations/remote_development/workspaces/create_spec.rb rename to ee/spec/requests/api/graphql/mutations/remote_development/workspace_operations/create_spec.rb index 3ec6d427c0e74b8c60790f441542d5319dbe5cd0..31cefd9fc1763fad3de8116d033b988b29c39573 100644 --- a/ee/spec/requests/api/graphql/mutations/remote_development/workspaces/create_spec.rb +++ b/ee/spec/requests/api/graphql/mutations/remote_development/workspace_operations/create_spec.rb @@ -35,7 +35,7 @@ create(:workspace, user: user, project: workspace_project) end - let(:desired_state) { RemoteDevelopment::Workspaces::States::RUNNING } + let(:desired_state) { RemoteDevelopment::WorkspaceOperations::States::RUNNING } let(:all_mutation_args) do { @@ -66,7 +66,7 @@ params[:project] = workspace_project { - domain_main_class: ::RemoteDevelopment::Workspaces::Create::Main, + domain_main_class: ::RemoteDevelopment::WorkspaceOperations::Create::Main, domain_main_class_args: { current_user: current_user, params: params, diff --git a/ee/spec/requests/api/graphql/mutations/remote_development/workspaces/update_spec.rb b/ee/spec/requests/api/graphql/mutations/remote_development/workspace_operations/update_spec.rb similarity index 88% rename from ee/spec/requests/api/graphql/mutations/remote_development/workspaces/update_spec.rb rename to ee/spec/requests/api/graphql/mutations/remote_development/workspace_operations/update_spec.rb index 524be2905d9b0c8f72766a701ae63ceb931aa357..2a580af443aef6c5c76c270b015ffdb1e2d0a278 100644 --- a/ee/spec/requests/api/graphql/mutations/remote_development/workspaces/update_spec.rb +++ b/ee/spec/requests/api/graphql/mutations/remote_development/workspace_operations/update_spec.rb @@ -22,7 +22,7 @@ agent: agent, project: project, user: user, - desired_state: RemoteDevelopment::Workspaces::States::RUNNING, + desired_state: RemoteDevelopment::WorkspaceOperations::States::RUNNING, editor: 'webide' ) end @@ -30,15 +30,18 @@ let(:all_mutation_args) do { id: workspace.to_global_id.to_s, - desired_state: RemoteDevelopment::Workspaces::States::STOPPED + desired_state: RemoteDevelopment::WorkspaceOperations::States::STOPPED } end - let(:mutation_args) { { id: global_id_of(workspace), desired_state: RemoteDevelopment::Workspaces::States::STOPPED } } + let(:mutation_args) do + { id: global_id_of(workspace), desired_state: RemoteDevelopment::WorkspaceOperations::States::STOPPED } + end + let(:mutation) { graphql_mutation(:workspace_update, mutation_args) } let(:expected_service_args) do { - domain_main_class: ::RemoteDevelopment::Workspaces::Update::Main, + domain_main_class: ::RemoteDevelopment::WorkspaceOperations::Update::Main, domain_main_class_args: { current_user: current_user, workspace: workspace, diff --git a/ee/spec/requests/api/graphql/remote_development/shared.rb b/ee/spec/requests/api/graphql/remote_development/shared.rb index f289773ca2a0dc7f5bddf66705645f5159920b39..9221229954d6824d6900bac9c4fa0b99219f6cfc 100644 --- a/ee/spec/requests/api/graphql/remote_development/shared.rb +++ b/ee/spec/requests/api/graphql/remote_development/shared.rb @@ -72,7 +72,7 @@ end RSpec.shared_context 'with actual_states argument' do - let_it_be(:matching_actual_state) { ::RemoteDevelopment::Workspaces::States::CREATION_REQUESTED } + let_it_be(:matching_actual_state) { ::RemoteDevelopment::WorkspaceOperations::States::CREATION_REQUESTED } include_context 'with unauthorized workspace created' @@ -81,7 +81,7 @@ end # create workspace with non-matching actual state, to ensure it is not returned by the query - let_it_be(:non_matching_actual_state) { ::RemoteDevelopment::Workspaces::States::RUNNING } + let_it_be(:non_matching_actual_state) { ::RemoteDevelopment::WorkspaceOperations::States::RUNNING } let_it_be(:non_matching_workspace, reload: true) do create(:workspace, actual_state: non_matching_actual_state, user: workspace.user, name: 'non-matching-workspace') end diff --git a/ee/spec/requests/api/internal/kubernetes_spec.rb b/ee/spec/requests/api/internal/kubernetes_spec.rb index 0b78c2eb074932a426d73b1dcc22821669150d67..797499c187af3aca14f8923436a9af9c7b58badc 100644 --- a/ee/spec/requests/api/internal/kubernetes_spec.rb +++ b/ee/spec/requests/api/internal/kubernetes_spec.rb @@ -62,7 +62,7 @@ def send_request(params: {}, headers: agent_token_headers) let(:params) { { some_param: "1" } } let(:expected_service_args) do { - domain_main_class: ::RemoteDevelopment::Workspaces::Reconcile::Main, + domain_main_class: ::RemoteDevelopment::WorkspaceOperations::Reconcile::Main, domain_main_class_args: { original_params: params, agent: agent diff --git a/ee/spec/requests/remote_development/integration_spec.rb b/ee/spec/requests/remote_development/integration_spec.rb index 1a78fcbbf4b0da1dd47bf624a2c260a0f4d48070..df91d31f79da2e3d5a3ad977fb29231bdd19196f 100644 --- a/ee/spec/requests/remote_development/integration_spec.rb +++ b/ee/spec/requests/remote_development/integration_spec.rb @@ -124,7 +124,7 @@ { key: "GL_WORKSPACE_DOMAIN_TEMPLATE", type: :environment, value: "${PORT}-workspace-#{agent.id}-#{user.id}-#{random_string}.#{dns_zone}" }, { key: "GITLAB_WORKFLOW_INSTANCE_URL", type: :environment, value: Gitlab::Routing.url_helpers.root_url }, { key: "GITLAB_WORKFLOW_TOKEN_FILE", type: :environment, value: "/.workspace-data/variables/file/gl_token" }, - { key: "gl_git_credential_store.sh", type: :file, value: RemoteDevelopment::Workspaces::Create::WorkspaceVariables::GIT_CREDENTIAL_STORE_SCRIPT }, + { key: "gl_git_credential_store.sh", type: :file, value: RemoteDevelopment::WorkspaceOperations::Create::WorkspaceVariables::GIT_CREDENTIAL_STORE_SCRIPT }, { key: "gl_token", type: :file, value: /glpat-.+/ } ] # rubocop:enable Layout/LineLength @@ -259,7 +259,7 @@ def do_create_workspace(cluster_agent_id) def workspace_create_mutation_args(cluster_agent_id) { - desired_state: RemoteDevelopment::Workspaces::States::RUNNING, + desired_state: RemoteDevelopment::WorkspaceOperations::States::RUNNING, editor: "webide", max_hours_before_termination: 24, cluster_agent_id: cluster_agent_id, @@ -275,7 +275,7 @@ def workspace_create_mutation_args(cluster_agent_id) def do_stop_workspace(workspace) workspace_update_mutation_args = { id: global_id_of(workspace), - desired_state: RemoteDevelopment::Workspaces::States::STOPPED + desired_state: RemoteDevelopment::WorkspaceOperations::States::STOPPED } do_graphql_mutation_post( diff --git a/ee/spec/support/helpers/remote_development/integration_spec_helpers.rb b/ee/spec/support/helpers/remote_development/integration_spec_helpers.rb index a9c24bc003db99beafccd0c8699a33223ee6a492..2a05b7514a2ce3aa5570049fd8001c087fb245c9 100644 --- a/ee/spec/support/helpers/remote_development/integration_spec_helpers.rb +++ b/ee/spec/support/helpers/remote_development/integration_spec_helpers.rb @@ -37,8 +37,8 @@ def simulate_first_poll( expect(info.fetch(:name)).to eq(workspace.name) expect(info.fetch(:namespace)).to eq(workspace.namespace) - expect(info.fetch(:desired_state)).to eq(RemoteDevelopment::Workspaces::States::RUNNING) - expect(info.fetch(:actual_state)).to eq(RemoteDevelopment::Workspaces::States::CREATION_REQUESTED) + expect(info.fetch(:desired_state)).to eq(RemoteDevelopment::WorkspaceOperations::States::RUNNING) + expect(info.fetch(:actual_state)).to eq(RemoteDevelopment::WorkspaceOperations::States::CREATION_REQUESTED) expect(info.fetch(:deployment_resource_version)).to be_nil expected_config_to_apply = create_config_to_apply( @@ -61,8 +61,8 @@ def simulate_second_poll( resource_version = '1' workspace_agent_info = create_workspace_agent_info_hash( workspace: workspace, - previous_actual_state: RemoteDevelopment::Workspaces::States::STARTING, - current_actual_state: RemoteDevelopment::Workspaces::States::RUNNING, + previous_actual_state: RemoteDevelopment::WorkspaceOperations::States::STARTING, + current_actual_state: RemoteDevelopment::WorkspaceOperations::States::RUNNING, workspace_exists: false, resource_version: resource_version ) @@ -81,8 +81,8 @@ def simulate_second_poll( expect(info.fetch(:name)).to eq(workspace.name) expect(info.fetch(:namespace)).to eq(workspace.namespace) - expect(info.fetch(:desired_state)).to eq(RemoteDevelopment::Workspaces::States::RUNNING) - expect(info.fetch(:actual_state)).to eq(RemoteDevelopment::Workspaces::States::RUNNING) + expect(info.fetch(:desired_state)).to eq(RemoteDevelopment::WorkspaceOperations::States::RUNNING) + expect(info.fetch(:actual_state)).to eq(RemoteDevelopment::WorkspaceOperations::States::RUNNING) expect(info.fetch(:deployment_resource_version)).to eq(resource_version) expect(info.fetch(:config_to_apply)).to be_nil end @@ -97,8 +97,8 @@ def simulate_third_poll( resource_version = '1' workspace_agent_info = create_workspace_agent_info_hash( workspace: workspace, - previous_actual_state: RemoteDevelopment::Workspaces::States::RUNNING, - current_actual_state: RemoteDevelopment::Workspaces::States::STOPPING, + previous_actual_state: RemoteDevelopment::WorkspaceOperations::States::RUNNING, + current_actual_state: RemoteDevelopment::WorkspaceOperations::States::STOPPING, workspace_exists: true, resource_version: resource_version ) @@ -117,8 +117,8 @@ def simulate_third_poll( expect(info.fetch(:name)).to eq(workspace.name) expect(info.fetch(:namespace)).to eq(workspace.namespace) - expect(info.fetch(:desired_state)).to eq(RemoteDevelopment::Workspaces::States::STOPPED) - expect(info.fetch(:actual_state)).to eq(RemoteDevelopment::Workspaces::States::STOPPING) + expect(info.fetch(:desired_state)).to eq(RemoteDevelopment::WorkspaceOperations::States::STOPPED) + expect(info.fetch(:actual_state)).to eq(RemoteDevelopment::WorkspaceOperations::States::STOPPING) expect(info.fetch(:deployment_resource_version)).to eq(resource_version) expected_config_to_apply = create_config_to_apply( @@ -140,8 +140,8 @@ def simulate_fourth_poll( resource_version = '2' workspace_agent_info = create_workspace_agent_info_hash( workspace: workspace, - previous_actual_state: RemoteDevelopment::Workspaces::States::STOPPING, - current_actual_state: RemoteDevelopment::Workspaces::States::STOPPED, + previous_actual_state: RemoteDevelopment::WorkspaceOperations::States::STOPPING, + current_actual_state: RemoteDevelopment::WorkspaceOperations::States::STOPPED, workspace_exists: true, resource_version: resource_version ) @@ -160,8 +160,8 @@ def simulate_fourth_poll( expect(info.fetch(:name)).to eq(workspace.name) expect(info.fetch(:namespace)).to eq(workspace.namespace) - expect(info.fetch(:desired_state)).to eq(RemoteDevelopment::Workspaces::States::STOPPED) - expect(info.fetch(:actual_state)).to eq(RemoteDevelopment::Workspaces::States::STOPPED) + expect(info.fetch(:desired_state)).to eq(RemoteDevelopment::WorkspaceOperations::States::STOPPED) + expect(info.fetch(:actual_state)).to eq(RemoteDevelopment::WorkspaceOperations::States::STOPPED) expect(info.fetch(:deployment_resource_version)).to eq(resource_version) expect(info.fetch(:config_to_apply)).to be_nil end @@ -191,8 +191,8 @@ def simulate_sixth_poll( resource_version = '2' workspace_agent_info = create_workspace_agent_info_hash( workspace: workspace, - previous_actual_state: RemoteDevelopment::Workspaces::States::STOPPED, - current_actual_state: RemoteDevelopment::Workspaces::States::STOPPED, + previous_actual_state: RemoteDevelopment::WorkspaceOperations::States::STOPPED, + current_actual_state: RemoteDevelopment::WorkspaceOperations::States::STOPPED, workspace_exists: true, resource_version: resource_version ) diff --git a/ee/spec/support/shared_contexts/remote_development/remote_development_shared_contexts.rb b/ee/spec/support/shared_contexts/remote_development/remote_development_shared_contexts.rb index 9dcf56d2d63806f4c0af4c1e5003043eb9086f3e..7082a4cab19197a4a6b7e64a98a845b7854c7fb2 100644 --- a/ee/spec/support/shared_contexts/remote_development/remote_development_shared_contexts.rb +++ b/ee/spec/support/shared_contexts/remote_development/remote_development_shared_contexts.rb @@ -21,26 +21,27 @@ def create_workspace_agent_info_hash( namespace: workspace.namespace } - if current_actual_state == RemoteDevelopment::Workspaces::States::TERMINATED + if current_actual_state == RemoteDevelopment::WorkspaceOperations::States::TERMINATED info[:termination_progress] = - RemoteDevelopment::Workspaces::States::TERMINATED + RemoteDevelopment::WorkspaceOperations::States::TERMINATED end - if current_actual_state == RemoteDevelopment::Workspaces::States::TERMINATING + if current_actual_state == RemoteDevelopment::WorkspaceOperations::States::TERMINATING info[:termination_progress] = - RemoteDevelopment::Workspaces::States::TERMINATING + RemoteDevelopment::WorkspaceOperations::States::TERMINATING end if [ - RemoteDevelopment::Workspaces::States::TERMINATING, - RemoteDevelopment::Workspaces::States::TERMINATED, - RemoteDevelopment::Workspaces::States::UNKNOWN + RemoteDevelopment::WorkspaceOperations::States::TERMINATING, + RemoteDevelopment::WorkspaceOperations::States::TERMINATED, + RemoteDevelopment::WorkspaceOperations::States::UNKNOWN ].include?(current_actual_state) return info end + # rubocop:disable Layout/LineLength -- Keep the individual 'in' cases on single lines for readability spec_replicas = - if [RemoteDevelopment::Workspaces::States::STOPPED, RemoteDevelopment::Workspaces::States::STOPPING] + if [RemoteDevelopment::WorkspaceOperations::States::STOPPED, RemoteDevelopment::WorkspaceOperations::States::STOPPING] .include?(current_actual_state) 0 else @@ -52,7 +53,7 @@ def create_workspace_agent_info_hash( # rubocop:todo Lint/DuplicateBranch -- Make this cop recognize that different arrays with different entries are not duplicates status = case [previous_actual_state, current_actual_state, workspace_exists] - in [RemoteDevelopment::Workspaces::States::CREATION_REQUESTED, RemoteDevelopment::Workspaces::States::STARTING, _] + in [RemoteDevelopment::WorkspaceOperations::States::CREATION_REQUESTED, RemoteDevelopment::WorkspaceOperations::States::STARTING, _] <<~STATUS_YAML conditions: - lastTransitionTime: "2023-04-10T10:14:14Z" @@ -62,7 +63,7 @@ def create_workspace_agent_info_hash( status: "True" type: Progressing STATUS_YAML - in [RemoteDevelopment::Workspaces::States::STARTING, RemoteDevelopment::Workspaces::States::STARTING, false] + in [RemoteDevelopment::WorkspaceOperations::States::STARTING, RemoteDevelopment::WorkspaceOperations::States::STARTING, false] <<~STATUS_YAML conditions: - lastTransitionTime: "2023-04-10T10:14:14Z" @@ -82,7 +83,7 @@ def create_workspace_agent_info_hash( unavailableReplicas: 1 updatedReplicas: 1 STATUS_YAML - in [RemoteDevelopment::Workspaces::States::STARTING, RemoteDevelopment::Workspaces::States::RUNNING, false] + in [RemoteDevelopment::WorkspaceOperations::States::STARTING, RemoteDevelopment::WorkspaceOperations::States::RUNNING, false] <<~STATUS_YAML availableReplicas: 1 conditions: @@ -102,13 +103,13 @@ def create_workspace_agent_info_hash( replicas: 1 updatedReplicas: 1 STATUS_YAML - in [RemoteDevelopment::Workspaces::States::STARTING, RemoteDevelopment::Workspaces::States::FAILED, false] + in [RemoteDevelopment::WorkspaceOperations::States::STARTING, RemoteDevelopment::WorkspaceOperations::States::FAILED, false] raise RemoteDevelopment::AgentInfoStatusFixtureNotImplementedError - in [RemoteDevelopment::Workspaces::States::FAILED, RemoteDevelopment::Workspaces::States::STARTING, false] + in [RemoteDevelopment::WorkspaceOperations::States::FAILED, RemoteDevelopment::WorkspaceOperations::States::STARTING, false] raise RemoteDevelopment::AgentInfoStatusFixtureNotImplementedError - in [RemoteDevelopment::Workspaces::States::RUNNING, RemoteDevelopment::Workspaces::States::FAILED, _] + in [RemoteDevelopment::WorkspaceOperations::States::RUNNING, RemoteDevelopment::WorkspaceOperations::States::FAILED, _] raise RemoteDevelopment::AgentInfoStatusFixtureNotImplementedError - in [RemoteDevelopment::Workspaces::States::RUNNING, RemoteDevelopment::Workspaces::States::STOPPING, _] + in [RemoteDevelopment::WorkspaceOperations::States::RUNNING, RemoteDevelopment::WorkspaceOperations::States::STOPPING, _] <<~STATUS_YAML availableReplicas: 1 conditions: @@ -129,7 +130,7 @@ def create_workspace_agent_info_hash( replicas: 1 updatedReplicas: 1 STATUS_YAML - in [RemoteDevelopment::Workspaces::States::STOPPING, RemoteDevelopment::Workspaces::States::STOPPED, _] + in [RemoteDevelopment::WorkspaceOperations::States::STOPPING, RemoteDevelopment::WorkspaceOperations::States::STOPPED, _] <<~STATUS_YAML conditions: - lastTransitionTime: "2023-04-10T10:40:35Z" @@ -146,7 +147,7 @@ def create_workspace_agent_info_hash( type: Progressing observedGeneration: 2 STATUS_YAML - in [RemoteDevelopment::Workspaces::States::STOPPED, RemoteDevelopment::Workspaces::States::STOPPED, true] + in [RemoteDevelopment::WorkspaceOperations::States::STOPPED, RemoteDevelopment::WorkspaceOperations::States::STOPPED, true] <<~STATUS_YAML conditions: - lastTransitionTime: "2023-04-10T10:40:24Z" @@ -163,9 +164,9 @@ def create_workspace_agent_info_hash( type: Progressing observedGeneration: 2 STATUS_YAML - in [RemoteDevelopment::Workspaces::States::STOPPING, RemoteDevelopment::Workspaces::States::FAILED, _] + in [RemoteDevelopment::WorkspaceOperations::States::STOPPING, RemoteDevelopment::WorkspaceOperations::States::FAILED, _] raise RemoteDevelopment::AgentInfoStatusFixtureNotImplementedError - in [RemoteDevelopment::Workspaces::States::STOPPED, RemoteDevelopment::Workspaces::States::STARTING, _] + in [RemoteDevelopment::WorkspaceOperations::States::STOPPED, RemoteDevelopment::WorkspaceOperations::States::STARTING, _] # There are multiple state transitions inside kubernetes # Fields like `replicas`, `unavailableReplicas` and `updatedReplicas` eventually become present <<~STATUS_YAML @@ -184,11 +185,11 @@ def create_workspace_agent_info_hash( type: Available observedGeneration: 3 STATUS_YAML - in [RemoteDevelopment::Workspaces::States::STOPPED, RemoteDevelopment::Workspaces::States::FAILED, _] + in [RemoteDevelopment::WorkspaceOperations::States::STOPPED, RemoteDevelopment::WorkspaceOperations::States::FAILED, _] # Stopped workspace is terminated by the user which results in a Failed actual state. # e.g. could not unmount volume and terminate the workspace raise RemoteDevelopment::AgentInfoStatusFixtureNotImplementedError - in [RemoteDevelopment::Workspaces::States::STARTING, RemoteDevelopment::Workspaces::States::STARTING, true] + in [RemoteDevelopment::WorkspaceOperations::States::STARTING, RemoteDevelopment::WorkspaceOperations::States::STARTING, true] # There are multiple state transitions inside kubernetes # Fields like `replicas`, `unavailableReplicas` and `updatedReplicas` eventually become present <<~STATUS_YAML @@ -210,7 +211,7 @@ def create_workspace_agent_info_hash( unavailableReplicas: 1 updatedReplicas: 1 STATUS_YAML - in [RemoteDevelopment::Workspaces::States::STARTING, RemoteDevelopment::Workspaces::States::RUNNING, true] + in [RemoteDevelopment::WorkspaceOperations::States::STARTING, RemoteDevelopment::WorkspaceOperations::States::RUNNING, true] <<~STATUS_YAML availableReplicas: 1 conditions: @@ -231,13 +232,13 @@ def create_workspace_agent_info_hash( replicas: 1 updatedReplicas: 1 STATUS_YAML - in [RemoteDevelopment::Workspaces::States::STARTING, RemoteDevelopment::Workspaces::States::FAILED, true] + in [RemoteDevelopment::WorkspaceOperations::States::STARTING, RemoteDevelopment::WorkspaceOperations::States::FAILED, true] raise RemoteDevelopment::AgentInfoStatusFixtureNotImplementedError - in [RemoteDevelopment::Workspaces::States::FAILED, RemoteDevelopment::Workspaces::States::STARTING, true] + in [RemoteDevelopment::WorkspaceOperations::States::FAILED, RemoteDevelopment::WorkspaceOperations::States::STARTING, true] raise RemoteDevelopment::AgentInfoStatusFixtureNotImplementedError - in [RemoteDevelopment::Workspaces::States::FAILED, RemoteDevelopment::Workspaces::States::STOPPING, _] + in [RemoteDevelopment::WorkspaceOperations::States::FAILED, RemoteDevelopment::WorkspaceOperations::States::STOPPING, _] raise RemoteDevelopment::AgentInfoStatusFixtureNotImplementedError - in [_, RemoteDevelopment::Workspaces::States::FAILED, _] + in [_, RemoteDevelopment::WorkspaceOperations::States::FAILED, _] raise RemoteDevelopment::AgentInfoStatusFixtureNotImplementedError # <<~STATUS_YAML # conditions: @@ -265,6 +266,7 @@ def create_workspace_agent_info_hash( raise RemoteDevelopment::AgentInfoStatusFixtureNotImplementedError, msg end # rubocop:enable Lint/DuplicateBranch + # rubocop:enable Layout/LineLength config_to_apply_yaml = create_config_to_apply( workspace: workspace, @@ -308,7 +310,7 @@ def create_workspace_rails_info( end def create_config_to_apply(workspace:, **args) - latest_config_version = ::RemoteDevelopment::Workspaces::ConfigVersion::LATEST_VERSION + latest_config_version = ::RemoteDevelopment::WorkspaceOperations::ConfigVersion::LATEST_VERSION config_version = workspace.respond_to?(:config_version) ? workspace.config_version : latest_config_version method_name = "create_config_to_apply_v#{config_version}" @@ -584,7 +586,7 @@ def workspace_deployment( spec_replicas:, default_resources_per_workspace_container: ) - variables_file_mount_path = RemoteDevelopment::Workspaces::FileMounts::VARIABLES_FILE_DIR + variables_file_mount_path = RemoteDevelopment::WorkspaceOperations::FileMounts::VARIABLES_FILE_DIR { apiVersion: "apps/v1", kind: "Deployment", diff --git a/lib/gitlab/fp/settings/README.md b/lib/gitlab/fp/settings/README.md index ec5516bbbfe16d16bcea30d453fbb43f5e571bdc..fcbd3ad2fafad6b9dfb81f22f0d7f839df393064 100644 --- a/lib/gitlab/fp/settings/README.md +++ b/lib/gitlab/fp/settings/README.md @@ -3,7 +3,7 @@ ## Overview The `Gitlab::Fp::Settings` module contains support for the Settings Module pattern used -currently by the Remote Development Workspaces and Web IDE domains. This pattern is +currently by the Remote Development Workspace and Web IDE domains. This pattern is based on the ["Functional Programming"](../../../ee/lib/remote_development/README.md#functional-patterns) and ["Railway Oriented Programming and the Result Class"](../../../ee/lib/remote_development/README.md#railway-oriented-programming-and-the-result-class) patterns. It is in the process of being extracted from the `RemoteDevelopment` domain code, diff --git a/scripts/verify-tff-mapping b/scripts/verify-tff-mapping index 6e3b81a349a6aba5f190de6d8b106104fa77599a..c24187c5904d32298d29317e7c7804f13568ffea 100755 --- a/scripts/verify-tff-mapping +++ b/scripts/verify-tff-mapping @@ -347,9 +347,9 @@ tests = [ }, { explanation: 'Map Remote Development GraphQL mutations to request specs', - changed_file: 'ee/app/graphql/mutations/remote_development/workspaces/create.rb', + changed_file: 'ee/app/graphql/mutations/remote_development/workspace_operations/create.rb', expected: %w[ - ee/spec/requests/api/graphql/mutations/remote_development/workspaces/create_spec.rb + ee/spec/requests/api/graphql/mutations/remote_development/workspace_operations/create_spec.rb ] }, {