From 3e418ec7a96a7e0985b41159c683f8c5de15813e Mon Sep 17 00:00:00 2001 From: Chad Woolley Date: Mon, 22 Jul 2024 19:20:58 +0200 Subject: [PATCH 1/2] Prep for remote_development -> workspace domain rename - Renames all 'workspace` subdirectories to 'workspace_operations' so they will not be duplicate - Names other subdomains like agent-related things to end in 'operations' to be consistent with 'workspace_operations' --- doc/api/graphql/reference/index.md | 14 +-- .../cluster_agents_finder.rb | 14 +-- .../remote_development/workspaces_finder.rb | 2 +- ee/app/graphql/ee/types/mutation_type.rb | 8 +- ee/app/graphql/ee/types/user_type.rb | 2 +- .../create.rb | 4 +- .../delete.rb | 4 +- .../create.rb | 6 +- .../update.rb | 4 +- ee/app/models/remote_development/workspace.rb | 8 +- ee/lib/ee/api/internal/kubernetes.rb | 4 +- ...ackfill_workspace_personal_access_token.rb | 2 +- ee/lib/remote_development/README.md | 18 ++-- .../license_checker.rb | 2 +- .../main.rb | 2 +- .../updater.rb | 2 +- ee/lib/remote_development/messages.rb | 4 +- .../create/cluster_agent_validator.rb | 2 +- .../create/main.rb | 2 +- .../create/mapping_creator.rb | 2 +- .../delete/main.rb | 2 +- .../delete/mapping_deleter.rb | 2 +- .../validations.rb | 2 +- .../config_version.rb | 2 +- .../create/authorizer.rb | 2 +- .../create/creator.rb | 2 +- .../create/devfile_fetcher.rb | 2 +- .../create/devfile_flattener.rb | 2 +- .../create/main.rb | 2 +- .../create/personal_access_token_creator.rb | 2 +- .../create/post_flatten_devfile_validator.rb | 2 +- .../create/pre_flatten_devfile_validator.rb | 2 +- .../project_cloner_component_injector.rb | 2 +- .../create/tools_component_injector.rb | 2 +- .../create/volume_component_injector.rb | 2 +- .../create/volume_definer.rb | 2 +- .../create/workspace_creator.rb | 4 +- .../create/workspace_variables.rb | 14 +-- .../create/workspace_variables_creator.rb | 2 +- .../file_mounts.rb | 2 +- .../reconcile/error_type.rb | 2 +- .../input/actual_state_calculator.rb | 2 +- .../reconcile/input/agent_info.rb | 6 +- .../reconcile/input/agent_infos_observer.rb | 2 +- .../reconcile/input/factory.rb | 4 +- .../reconcile/input/params_extractor.rb | 2 +- .../input/params_to_infos_converter.rb | 2 +- .../reconcile/input/params_validator.rb | 2 +- .../reconcile/main.rb | 2 +- .../output/desired_config_generator.rb | 6 +- .../output/desired_config_generator_v2.rb | 6 +- .../reconcile/output/devfile_parser.rb | 4 +- .../reconcile/output/devfile_parser_v2.rb | 4 +- .../output/response_payload_builder.rb | 4 +- .../output/response_payload_observer.rb | 2 +- .../orphaned_workspaces_observer.rb | 2 +- .../workspaces_from_agent_infos_updater.rb | 2 +- .../workspaces_to_be_returned_finder.rb | 6 +- .../workspaces_to_be_returned_updater.rb | 2 +- .../reconcile/termination_progress.rb | 2 +- .../reconcile/update_types.rb | 2 +- .../states.rb | 2 +- .../update/authorizer.rb | 2 +- .../update/main.rb | 2 +- .../update/updater.rb | 2 +- .../remote_development/workspaces.rb | 12 +-- .../workspaces_dropdown_group_spec.rb | 4 +- .../remote_development/workspaces_spec.rb | 6 +- .../workspaces_finder_spec.rb | 14 +-- .../update_workspaces_config_version_spec.rb | 12 +-- .../license_checker_spec.rb | 2 +- .../main_integration_spec.rb | 2 +- .../main_spec.rb | 16 ++-- .../updater_spec.rb | 10 +-- .../create/cluster_agent_validator_spec.rb | 2 +- .../create/main_integration_spec.rb | 2 +- .../create/main_spec.rb | 16 ++-- .../create/mapping_creator_spec.rb | 2 +- .../delete/main_integration_spec.rb | 2 +- .../delete/main_spec.rb | 10 +-- .../delete/mapping_deleter_spec.rb | 2 +- .../validations_spec.rb | 2 +- .../create/authorizer_spec.rb | 2 +- .../create/creator_spec.rb | 14 +-- .../create/devfile_fetcher_spec.rb | 4 +- .../create/devfile_flattener_spec.rb | 2 +- .../create/main_integration_spec.rb | 8 +- .../create/main_spec.rb | 42 ++++----- .../personal_access_token_creator_spec.rb | 2 +- .../post_flatten_devfile_validator_spec.rb | 2 +- .../pre_flatten_devfile_validator_spec.rb | 2 +- .../project_cloner_component_injector_spec.rb | 2 +- .../create/tools_component_injector_spec.rb | 2 +- .../create/volume_component_injector_spec.rb | 2 +- .../create/volume_definer_spec.rb | 2 +- .../create/workspace_creator_spec.rb | 4 +- .../workspace_variables_creator_spec.rb | 4 +- .../create/workspace_variables_spec.rb | 2 +- .../input/actual_state_calculator_spec.rb | 85 ++++++++++--------- .../reconcile/input/agent_info_spec.rb | 4 +- .../input/agent_infos_observer_spec.rb | 48 +++++------ .../reconcile/input/factory_spec.rb | 28 +++--- .../reconcile/input/params_extractor_spec.rb | 2 +- .../input/params_to_infos_converter_spec.rb | 10 +-- .../reconcile/input/params_validator_spec.rb | 2 +- .../reconcile/main_integration_spec.rb | 58 ++++++------- .../main_reconcile_scenarios_spec.rb | 4 +- .../reconcile/main_spec.rb | 26 +++--- .../output/desired_config_generator_spec.rb | 12 +-- .../desired_config_generator_v2_spec.rb | 12 +-- .../reconcile/output/devfile_parser_spec.rb | 6 +- .../output/devfile_parser_v2_spec.rb | 6 +- .../output/response_payload_builder_spec.rb | 20 ++--- .../output/response_payload_observer_spec.rb | 8 +- .../orphaned_workspaces_observer_spec.rb | 12 +-- ...orkspaces_from_agent_infos_updater_spec.rb | 16 ++-- .../workspaces_to_be_returned_finder_spec.rb | 12 +-- .../workspaces_to_be_returned_updater_spec.rb | 2 +- .../states_spec.rb | 10 +-- .../update/authorizer_spec.rb | 2 +- .../update/main_integration_spec.rb | 6 +- .../update/main_spec.rb | 14 +-- .../update/updater_spec.rb | 8 +- .../remote_development/workspace_spec.rb | 41 +++++---- .../create_spec.rb | 2 +- .../delete_spec.rb | 2 +- .../create_spec.rb | 4 +- .../update_spec.rb | 11 ++- .../api/graphql/remote_development/shared.rb | 4 +- .../requests/api/internal/kubernetes_spec.rb | 2 +- .../remote_development/integration_spec.rb | 6 +- .../integration_spec_helpers.rb | 32 +++---- .../remote_development_shared_contexts.rb | 58 +++++++------ lib/gitlab/fp/settings/README.md | 2 +- scripts/verify-tff-mapping | 4 +- 135 files changed, 524 insertions(+), 503 deletions(-) rename ee/app/graphql/mutations/remote_development/{namespace_cluster_agent_mappings => namespace_cluster_agent_mapping_operations}/create.rb (95%) rename ee/app/graphql/mutations/remote_development/{namespace_cluster_agent_mappings => namespace_cluster_agent_mapping_operations}/delete.rb (94%) rename ee/app/graphql/mutations/remote_development/{workspaces => workspace_operations}/create.rb (96%) rename ee/app/graphql/mutations/remote_development/{workspaces => workspace_operations}/update.rb (94%) rename ee/lib/remote_development/{agent_config => agent_config_operations}/license_checker.rb (93%) rename ee/lib/remote_development/{agent_config => agent_config_operations}/main.rb (98%) rename ee/lib/remote_development/{agent_config => agent_config_operations}/updater.rb (99%) rename ee/lib/remote_development/{namespace_cluster_agent_mappings => namespace_cluster_agent_mapping_operations}/create/cluster_agent_validator.rb (94%) rename ee/lib/remote_development/{namespace_cluster_agent_mappings => namespace_cluster_agent_mapping_operations}/create/main.rb (95%) rename ee/lib/remote_development/{namespace_cluster_agent_mappings => namespace_cluster_agent_mapping_operations}/create/mapping_creator.rb (96%) rename ee/lib/remote_development/{namespace_cluster_agent_mappings => namespace_cluster_agent_mapping_operations}/delete/main.rb (95%) rename ee/lib/remote_development/{namespace_cluster_agent_mappings => namespace_cluster_agent_mapping_operations}/delete/mapping_deleter.rb (94%) rename ee/lib/remote_development/{namespace_cluster_agent_mappings => namespace_cluster_agent_mapping_operations}/validations.rb (98%) rename ee/lib/remote_development/{workspaces => workspace_operations}/config_version.rb (86%) rename ee/lib/remote_development/{workspaces => workspace_operations}/create/authorizer.rb (95%) rename ee/lib/remote_development/{workspaces => workspace_operations}/create/creator.rb (98%) rename ee/lib/remote_development/{workspaces => workspace_operations}/create/devfile_fetcher.rb (98%) rename ee/lib/remote_development/{workspaces => workspace_operations}/create/devfile_flattener.rb (97%) rename ee/lib/remote_development/{workspaces => workspace_operations}/create/main.rb (98%) rename ee/lib/remote_development/{workspaces => workspace_operations}/create/personal_access_token_creator.rb (98%) rename ee/lib/remote_development/{workspaces => workspace_operations}/create/post_flatten_devfile_validator.rb (99%) rename ee/lib/remote_development/{workspaces => workspace_operations}/create/pre_flatten_devfile_validator.rb (98%) rename ee/lib/remote_development/{workspaces => workspace_operations}/create/project_cloner_component_injector.rb (99%) rename ee/lib/remote_development/{workspaces => workspace_operations}/create/tools_component_injector.rb (99%) rename ee/lib/remote_development/{workspaces => workspace_operations}/create/volume_component_injector.rb (97%) rename ee/lib/remote_development/{workspaces => workspace_operations}/create/volume_definer.rb (97%) rename ee/lib/remote_development/{workspaces => workspace_operations}/create/workspace_creator.rb (97%) rename ee/lib/remote_development/{workspaces => workspace_operations}/create/workspace_variables.rb (90%) rename ee/lib/remote_development/{workspaces => workspace_operations}/create/workspace_variables_creator.rb (98%) rename ee/lib/remote_development/{workspaces => workspace_operations}/file_mounts.rb (93%) rename ee/lib/remote_development/{workspaces => workspace_operations}/reconcile/error_type.rb (90%) rename ee/lib/remote_development/{workspaces => workspace_operations}/reconcile/input/actual_state_calculator.rb (99%) rename ee/lib/remote_development/{workspaces => workspace_operations}/reconcile/input/agent_info.rb (83%) rename ee/lib/remote_development/{workspaces => workspace_operations}/reconcile/input/agent_infos_observer.rb (99%) rename ee/lib/remote_development/{workspaces => workspace_operations}/reconcile/input/factory.rb (92%) rename ee/lib/remote_development/{workspaces => workspace_operations}/reconcile/input/params_extractor.rb (97%) rename ee/lib/remote_development/{workspaces => workspace_operations}/reconcile/input/params_to_infos_converter.rb (97%) rename ee/lib/remote_development/{workspaces => workspace_operations}/reconcile/input/params_validator.rb (98%) rename ee/lib/remote_development/{workspaces => workspace_operations}/reconcile/main.rb (98%) rename ee/lib/remote_development/{workspaces => workspace_operations}/reconcile/output/desired_config_generator.rb (98%) rename ee/lib/remote_development/{workspaces => workspace_operations}/reconcile/output/desired_config_generator_v2.rb (98%) rename ee/lib/remote_development/{workspaces => workspace_operations}/reconcile/output/devfile_parser.rb (98%) rename ee/lib/remote_development/{workspaces => workspace_operations}/reconcile/output/devfile_parser_v2.rb (97%) rename ee/lib/remote_development/{workspaces => workspace_operations}/reconcile/output/response_payload_builder.rb (97%) rename ee/lib/remote_development/{workspaces => workspace_operations}/reconcile/output/response_payload_observer.rb (98%) rename ee/lib/remote_development/{workspaces => workspace_operations}/reconcile/persistence/orphaned_workspaces_observer.rb (98%) rename ee/lib/remote_development/{workspaces => workspace_operations}/reconcile/persistence/workspaces_from_agent_infos_updater.rb (99%) rename ee/lib/remote_development/{workspaces => workspace_operations}/reconcile/persistence/workspaces_to_be_returned_finder.rb (90%) rename ee/lib/remote_development/{workspaces => workspace_operations}/reconcile/persistence/workspaces_to_be_returned_updater.rb (97%) rename ee/lib/remote_development/{workspaces => workspace_operations}/reconcile/termination_progress.rb (87%) rename ee/lib/remote_development/{workspaces => workspace_operations}/reconcile/update_types.rb (86%) rename ee/lib/remote_development/{workspaces => workspace_operations}/states.rb (98%) rename ee/lib/remote_development/{workspaces => workspace_operations}/update/authorizer.rb (95%) rename ee/lib/remote_development/{workspaces => workspace_operations}/update/main.rb (97%) rename ee/lib/remote_development/{workspaces => workspace_operations}/update/updater.rb (97%) rename ee/spec/lib/remote_development/{agent_config => agent_config_operations}/license_checker_spec.rb (87%) rename ee/spec/lib/remote_development/{agent_config => agent_config_operations}/main_integration_spec.rb (97%) rename ee/spec/lib/remote_development/{agent_config => agent_config_operations}/main_spec.rb (88%) rename ee/spec/lib/remote_development/{agent_config => agent_config_operations}/updater_spec.rb (97%) rename ee/spec/lib/remote_development/{namespace_cluster_agent_mappings => namespace_cluster_agent_mapping_operations}/create/cluster_agent_validator_spec.rb (87%) rename ee/spec/lib/remote_development/{namespace_cluster_agent_mappings => namespace_cluster_agent_mapping_operations}/create/main_integration_spec.rb (97%) rename ee/spec/lib/remote_development/{namespace_cluster_agent_mappings => namespace_cluster_agent_mapping_operations}/create/main_spec.rb (88%) rename ee/spec/lib/remote_development/{namespace_cluster_agent_mappings => namespace_cluster_agent_mapping_operations}/create/mapping_creator_spec.rb (97%) rename ee/spec/lib/remote_development/{namespace_cluster_agent_mappings => namespace_cluster_agent_mapping_operations}/delete/main_integration_spec.rb (95%) rename ee/spec/lib/remote_development/{namespace_cluster_agent_mappings => namespace_cluster_agent_mapping_operations}/delete/main_spec.rb (90%) rename ee/spec/lib/remote_development/{namespace_cluster_agent_mappings => namespace_cluster_agent_mapping_operations}/delete/mapping_deleter_spec.rb (93%) rename ee/spec/lib/remote_development/{namespace_cluster_agent_mappings => namespace_cluster_agent_mapping_operations}/validations_spec.rb (95%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/create/authorizer_spec.rb (89%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/create/creator_spec.rb (84%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/create/devfile_fetcher_spec.rb (95%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/create/devfile_flattener_spec.rb (93%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/create/main_integration_spec.rb (96%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/create/main_spec.rb (76%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/create/personal_access_token_creator_spec.rb (92%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/create/post_flatten_devfile_validator_spec.rb (97%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/create/pre_flatten_devfile_validator_spec.rb (92%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/create/project_cloner_component_injector_spec.rb (90%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/create/tools_component_injector_spec.rb (94%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/create/volume_component_injector_spec.rb (88%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/create/volume_definer_spec.rb (78%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/create/workspace_creator_spec.rb (93%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/create/workspace_variables_creator_spec.rb (94%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/create/workspace_variables_spec.rb (98%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/reconcile/input/actual_state_calculator_spec.rb (83%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/reconcile/input/agent_info_spec.rb (78%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/reconcile/input/agent_infos_observer_spec.rb (74%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/reconcile/input/factory_spec.rb (79%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/reconcile/input/params_extractor_spec.rb (89%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/reconcile/input/params_to_infos_converter_spec.rb (68%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/reconcile/input/params_validator_spec.rb (96%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/reconcile/main_integration_spec.rb (91%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/reconcile/main_reconcile_scenarios_spec.rb (98%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/reconcile/main_spec.rb (70%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/reconcile/output/desired_config_generator_spec.rb (88%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/reconcile/output/desired_config_generator_v2_spec.rb (83%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/reconcile/output/devfile_parser_spec.rb (93%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/reconcile/output/devfile_parser_v2_spec.rb (91%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/reconcile/output/response_payload_builder_spec.rb (86%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/reconcile/output/response_payload_observer_spec.rb (86%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/reconcile/persistence/orphaned_workspaces_observer_spec.rb (80%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/reconcile/persistence/workspaces_from_agent_infos_updater_spec.rb (74%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/reconcile/persistence/workspaces_to_be_returned_finder_spec.rb (90%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/reconcile/persistence/workspaces_to_be_returned_updater_spec.rb (95%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/states_spec.rb (69%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/update/authorizer_spec.rb (89%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/update/main_integration_spec.rb (83%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/update/main_spec.rb (84%) rename ee/spec/lib/remote_development/{workspaces => workspace_operations}/update/updater_spec.rb (88%) rename ee/spec/requests/api/graphql/mutations/remote_development/{namespace_cluster_agent_mappings => namespace_cluster_agent_mapping_operations}/create_spec.rb (99%) rename ee/spec/requests/api/graphql/mutations/remote_development/{namespace_cluster_agent_mappings => namespace_cluster_agent_mapping_operations}/delete_spec.rb (99%) rename ee/spec/requests/api/graphql/mutations/remote_development/{workspaces => workspace_operations}/create_spec.rb (97%) rename ee/spec/requests/api/graphql/mutations/remote_development/{workspaces => workspace_operations}/update_spec.rb (88%) diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index 6fa9aa092d9e0a..14d3cfdba34358 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -16982,7 +16982,7 @@ four standard [pagination arguments](#pagination-arguments): ##### `AddOnUser.workspaces` -Workspaces owned by the current user. +WorkspaceOperations owned by the current user. Returns [`WorkspaceConnection`](#workspaceconnection). @@ -17844,7 +17844,7 @@ four standard [pagination arguments](#pagination-arguments): ##### `AutocompletedUser.workspaces` -Workspaces owned by the current user. +WorkspaceOperations owned by the current user. Returns [`WorkspaceConnection`](#workspaceconnection). @@ -25630,7 +25630,7 @@ four standard [pagination arguments](#pagination-arguments): ##### `MergeRequestAssignee.workspaces` -Workspaces owned by the current user. +WorkspaceOperations owned by the current user. Returns [`WorkspaceConnection`](#workspaceconnection). @@ -26009,7 +26009,7 @@ four standard [pagination arguments](#pagination-arguments): ##### `MergeRequestAuthor.workspaces` -Workspaces owned by the current user. +WorkspaceOperations owned by the current user. Returns [`WorkspaceConnection`](#workspaceconnection). @@ -26434,7 +26434,7 @@ four standard [pagination arguments](#pagination-arguments): ##### `MergeRequestParticipant.workspaces` -Workspaces owned by the current user. +WorkspaceOperations owned by the current user. Returns [`WorkspaceConnection`](#workspaceconnection). @@ -26832,7 +26832,7 @@ four standard [pagination arguments](#pagination-arguments): ##### `MergeRequestReviewer.workspaces` -Workspaces owned by the current user. +WorkspaceOperations owned by the current user. Returns [`WorkspaceConnection`](#workspaceconnection). @@ -33069,7 +33069,7 @@ four standard [pagination arguments](#pagination-arguments): ##### `UserCore.workspaces` -Workspaces owned by the current user. +WorkspaceOperations owned by the current user. Returns [`WorkspaceConnection`](#workspaceconnection). diff --git a/ee/app/finders/remote_development/cluster_agents_finder.rb b/ee/app/finders/remote_development/cluster_agents_finder.rb index 29a26292067431..7eedf70acce6c4 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 9cbb6b1d02e9d5..1ca9f9f90656f1 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 cef26d40487626..52721a81ed2b8b 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/ee/types/user_type.rb b/ee/app/graphql/ee/types/user_type.rb index b2d035b5437397..153a41c4ccba77 100644 --- a/ee/app/graphql/ee/types/user_type.rb +++ b/ee/app/graphql/ee/types/user_type.rb @@ -8,7 +8,7 @@ module UserType prepended do field :workspaces, - description: 'Workspaces owned by the current user.', + description: 'WorkspaceOperations owned by the current user.', resolver: ::Resolvers::RemoteDevelopment::WorkspacesForCurrentUserResolver end end 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 728bf18d5228f9..7b969eafe54de8 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 0ec113348d5098..3ebfb673e9ac82 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 e0f829f96bdb37..aa404bc00a3aa5 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 e9e1ff0042d7a6..43c13a3ee7d986 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 377811bc1ea268..92380be79ec063 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 7640c7b813e82c..11ebdade20ebad 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 0d1687e8507ecf..832652c0a63c76 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 90009e3f7f7cd3..fd39c40234ee3e 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 ea9969f73a2e07..ba4aef70eee08e 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 c81c8d6fd89bbc..8ab59d71c542aa 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 25ebcddaae5de3..aff7fab5a557a6 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 6b0777922a607e..a9e4381077755a 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 98cc1ec5090251..b1f98d4aa7349a 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 9b464a88a14a38..b426d6a6d8c360 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 507282a92b3fe4..dd0b9f8b248020 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 60bd104d8b9bbc..4164359f8bac7c 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 94a2a857480af3..fc383282a48c62 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 4aaeea5093eae5..96fd63f4c99d69 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 967bbe9d740061..63e69c33032c02 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 7f64af8f4ebd76..d8f27c39338804 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 4cbafece11cd0c..af61a011bcaf83 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 e55965150d1411..942205b2a1da0e 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 e3b84a0f168cfc..da98b1c847e3bb 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 9f2a68b6753548..48169e0f2a8828 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 17c3422769908d..60794f948410e6 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 db312c88d642da..a32d64da422429 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 274a86917edb1c..81294c15083ac0 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 a5e05c2c43372b..aba91a1c5146a9 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 00fd644c27cc3a..82baaef21b9c52 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 c3aca03ea2e64e..774f94ed2d84b3 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 ff3244f2da5566..b5c1ec2320f516 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 344cbfdc740a60..ae68a950dfd07c 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 01dab747b2344c..3a4ade8e84986c 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 ab3874ecd7127b..56d972bc31844a 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 918c285e1328cd..596eb9bf05238c 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 30118540490467..e55d250a75c4d8 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 4ccdf9b0b068d3..b80dbf66013686 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 37b500c3a9aab9..d59ce191f4ba8a 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 e686990e61e1d1..7961bb555d1d86 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 c152b660816740..41dfe9d820561c 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 6a6071618ba9eb..e1a3ee25166c54 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 023eefbd643b6b..aeba6c58840002 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 bccdc22c53cf42..82396ca62507d6 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 3d93d5d1aefd99..c5e7a127abccfe 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 dd5d1ccb550b6c..1953a255726b72 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] @@ -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 6caa9f947c7474..595a7dde80c9e4 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] @@ -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 b4abd2a9f3dc3b..4270dd6b6e33e4 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 052adb51ce1e32..41b39ab61aa094 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 6ba67886247146..c35b4914897a21 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 b84d1b44d2ce71..d073ceb602d593 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 546c4eb835b283..416418b50c88d2 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 9a0c6be7d63087..5419bc06346527 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 5d82270e9df6ee..a190e3448a521d 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 e2251c7b7dc5c8..7ae13448ea138c 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 0b948c726b64ae..e08cc0ace1ea86 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 d4103febf67ae5..77c082f1b2316f 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 a8a4615876905c..e6fa846d7538d6 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 9170acf0f6737c..8375f326600e32 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 4a41c9d9dc2152..891bc533b729a9 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 f29693aae1f2c9..6e0eb053545179 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 0beae5e16d91bf..a90db067f1ee34 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 03b9d2948b02ec..f774cec96de62b 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 0fef0da7609eb9..d8f83c3eba5e73 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 556aff610d7ee0..94390aa6097d14 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 078f3155456c48..e122700f319af7 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 639bae06009049..c9d1ab92b370ae 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 5947a5011bfadc..fd598ae98d965e 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 e74d2d11163da1..13e886fec6655c 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 0e2476e5dc6b61..b71d24e13501c8 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 37893d6b2ac202..5e6c9c6e442f10 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 e36faed1f4904a..f1d1b42475312f 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 7d658ad0cef83d..c8dd54aab521d5 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 43278b74aa367a..516612fee2c074 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 ad8117dc7c6db6..5012792614bf91 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 24f1b80203cfb7..0fee22f62ca8ed 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 e230ea2b9ff4eb..30be46b064c452 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 eeb30209338b22..13f3525c060b9c 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 594d60db71740f..f508c2f105da05 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 71cb0eddd15e72..4a3cffc5e46ed7 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 96e1fec6ed81c0..2465ed8bbd197e 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 05ea03a61b81f8..41d7ccf8434c00 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 9045a93130acaf..5452e69a2ef176 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 2418ec64f3777e..9def43acb93426 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 56142d68237693..2820ef87dd0f5d 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 94b1cad4dd4cfb..8b822ff780abc8 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 c55e782e597ceb..bf3ab1a539e9b5 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 d316dd41fb3a9b..0b07bf8aa1da9c 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 8fb1b7a5893948..fdc64ff134ac99 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 9d7bf3b3d077f1..55d87fdc951d43 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 dfc47360f16d58..ce859479d1299f 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 e7233b45aa7ef6..7bce6cc5a68e71 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 5e5203d5f4a610..5477cf5bbf4363 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 f066bf9604e83d..53a1b62b9ed975 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 84bda8d2e4614d..97bb73a2a79d79 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 a6c6c79dc87509..385f6af7290a4c 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 69682d9e752c97..06b87913b736d8 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 e6c6f17596beb2..2c4ae96ca44279 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 e3a16d4870b08a..4641f2ae57c31b 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 b27904f9332ee0..17fba4d1584e8c 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 6c0fcc3a35aedd..3a76e3b5faf055 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 f182a738811b4a..cbff65e082076c 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 14ab82228fc450..4d275649036e9e 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 40e6c91290db9c..08d60d28682128 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 fc14910a44dcdc..aab4f34a8b1e07 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 322d47f77bced5..58596c6d34aaeb 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 a0611146a49f45..e1572b34ff2893 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 f4a554ed30ed2e..9d97482ece0b08 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 c575e92b0a5f32..a7508aafa1203c 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 59d63a2a6a5bd4..d09b9bde4309f6 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 c9095c6fd5f2c4..f58b77f6a59aec 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 c098fd8d6f57a7..ba9e06f6964098 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 b6484b6bd4c631..0259eb8f3c7d99 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 9755c3a47bc04e..7442f0ef954412 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 8591c5cc103120..d494bb048282c9 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 c2bb29e8b73832..5803d070a796fd 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 74c39696056729..8bd783defec66e 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 f831dd2c774017..d6eeaac132bf6e 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 0b031424d0e1d4..c8c385ea27a6f7 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 a71dcc72de51c4..8b7d81bff4a312 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 bc7181057d4e7f..15068005902c4d 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 6fefbcd039a5c2..3c2699a317d22b 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 3ec6d427c0e74b..31cefd9fc1763f 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 524be2905d9b0c..2a580af443aef6 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 f289773ca2a0dc..9221229954d682 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 0b78c2eb074932..797499c187af3a 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 1a78fcbbf4b0da..df91d31f79da2e 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 a9c24bc003db99..2a05b7514a2ce3 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 9dcf56d2d63806..7082a4cab19197 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 ec5516bbbfe16d..fcbd3ad2fafad6 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 6e3b81a349a6ab..c24187c5904d32 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 ] }, { -- GitLab From 59450227f7f5332efb5b5849d9c80294b1ee8c3a Mon Sep 17 00:00:00 2001 From: Chad Woolley Date: Mon, 12 Aug 2024 15:29:19 -0700 Subject: [PATCH 2/2] Revert incorrect doc update in ee/app/graphql/ee/types/user_type.rb --- doc/api/graphql/reference/index.md | 14 +++++++------- ee/app/graphql/ee/types/user_type.rb | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index 14d3cfdba34358..6fa9aa092d9e0a 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -16982,7 +16982,7 @@ four standard [pagination arguments](#pagination-arguments): ##### `AddOnUser.workspaces` -WorkspaceOperations owned by the current user. +Workspaces owned by the current user. Returns [`WorkspaceConnection`](#workspaceconnection). @@ -17844,7 +17844,7 @@ four standard [pagination arguments](#pagination-arguments): ##### `AutocompletedUser.workspaces` -WorkspaceOperations owned by the current user. +Workspaces owned by the current user. Returns [`WorkspaceConnection`](#workspaceconnection). @@ -25630,7 +25630,7 @@ four standard [pagination arguments](#pagination-arguments): ##### `MergeRequestAssignee.workspaces` -WorkspaceOperations owned by the current user. +Workspaces owned by the current user. Returns [`WorkspaceConnection`](#workspaceconnection). @@ -26009,7 +26009,7 @@ four standard [pagination arguments](#pagination-arguments): ##### `MergeRequestAuthor.workspaces` -WorkspaceOperations owned by the current user. +Workspaces owned by the current user. Returns [`WorkspaceConnection`](#workspaceconnection). @@ -26434,7 +26434,7 @@ four standard [pagination arguments](#pagination-arguments): ##### `MergeRequestParticipant.workspaces` -WorkspaceOperations owned by the current user. +Workspaces owned by the current user. Returns [`WorkspaceConnection`](#workspaceconnection). @@ -26832,7 +26832,7 @@ four standard [pagination arguments](#pagination-arguments): ##### `MergeRequestReviewer.workspaces` -WorkspaceOperations owned by the current user. +Workspaces owned by the current user. Returns [`WorkspaceConnection`](#workspaceconnection). @@ -33069,7 +33069,7 @@ four standard [pagination arguments](#pagination-arguments): ##### `UserCore.workspaces` -WorkspaceOperations owned by the current user. +Workspaces owned by the current user. Returns [`WorkspaceConnection`](#workspaceconnection). diff --git a/ee/app/graphql/ee/types/user_type.rb b/ee/app/graphql/ee/types/user_type.rb index 153a41c4ccba77..b2d035b5437397 100644 --- a/ee/app/graphql/ee/types/user_type.rb +++ b/ee/app/graphql/ee/types/user_type.rb @@ -8,7 +8,7 @@ module UserType prepended do field :workspaces, - description: 'WorkspaceOperations owned by the current user.', + description: 'Workspaces owned by the current user.', resolver: ::Resolvers::RemoteDevelopment::WorkspacesForCurrentUserResolver end end -- GitLab