diff --git a/ee/lib/remote_development/agent_config/updater.rb b/ee/lib/remote_development/agent_config/updater.rb index 7bde5a8574746d5180d53a8754186214fec0a77a..3c4645edcb196d7c87f47fcab3ed6931d73c044d 100644 --- a/ee/lib/remote_development/agent_config/updater.rb +++ b/ee/lib/remote_development/agent_config/updater.rb @@ -39,7 +39,7 @@ def self.update(value) config_from_agent_config_file.fetch(:gitlab_workspaces_proxy, {}).fetch(:namespace, 'gitlab-workspaces') if model_instance.save - model_instance.workspaces.update_all(force_include_all_resources: true) + model_instance.workspaces.without_terminated.update_all(force_include_all_resources: true) Result.ok(AgentConfigUpdateSuccessful.new({ remote_development_agent_config: model_instance })) else Result.err(AgentConfigUpdateFailed.new({ errors: model_instance.errors })) diff --git a/ee/spec/lib/remote_development/agent_config/updater_spec.rb b/ee/spec/lib/remote_development/agent_config/updater_spec.rb index e9f519e6e0edd15004e40364c0afec248f8b7564..53ee4d798f0764e9066d3772b88cc4b92ee51aa3 100644 --- a/ee/spec/lib/remote_development/agent_config/updater_spec.rb +++ b/ee/spec/lib/remote_development/agent_config/updater_spec.rb @@ -78,7 +78,8 @@ .to be_ok_result(RemoteDevelopment::Messages::AgentConfigUpdateSuccessful.new( { remote_development_agent_config: config_instance } )) - expect(config_instance.workspaces).to all(have_attributes(force_include_all_resources: true)) + expect(config_instance.workspaces.without_terminated) + .to all(have_attributes(force_include_all_resources: true)) end context 'when enabled is not present in the config passed' do @@ -111,7 +112,8 @@ .to be_ok_result(RemoteDevelopment::Messages::AgentConfigUpdateSuccessful.new( { remote_development_agent_config: config_instance } )) - expect(config_instance.workspaces).to all(have_attributes(force_include_all_resources: true)) + expect(config_instance.workspaces.without_terminated) + .to all(have_attributes(force_include_all_resources: true)) end end @@ -132,7 +134,8 @@ .to be_ok_result(RemoteDevelopment::Messages::AgentConfigUpdateSuccessful.new( { remote_development_agent_config: config_instance } )) - expect(config_instance.workspaces).to all(have_attributes(force_include_all_resources: true)) + expect(config_instance.workspaces.without_terminated) + .to all(have_attributes(force_include_all_resources: true)) end end @@ -164,7 +167,8 @@ .to be_ok_result(RemoteDevelopment::Messages::AgentConfigUpdateSuccessful.new( { remote_development_agent_config: config_instance } )) - expect(config_instance.workspaces).to all(have_attributes(force_include_all_resources: true)) + expect(config_instance.workspaces.without_terminated) + .to all(have_attributes(force_include_all_resources: true)) end end end @@ -189,7 +193,8 @@ .to be_ok_result(RemoteDevelopment::Messages::AgentConfigUpdateSuccessful.new( { remote_development_agent_config: config_instance } )) - expect(config_instance.workspaces).to all(have_attributes(force_include_all_resources: true)) + expect(config_instance.workspaces.without_terminated) + .to all(have_attributes(force_include_all_resources: true)) end end @@ -210,7 +215,8 @@ .to be_ok_result(RemoteDevelopment::Messages::AgentConfigUpdateSuccessful.new( { remote_development_agent_config: config_instance } )) - expect(config_instance.workspaces).to all(have_attributes(force_include_all_resources: true)) + expect(config_instance.workspaces.without_terminated) + .to all(have_attributes(force_include_all_resources: true)) end end end