Commit a392313f authored by Stan Hu's avatar Stan Hu

Merge branch 'environment_terminal_methods' into 'master'

Use Environment#deployment_platform method instead

See merge request gitlab-org/gitlab-ee!12294
parents e09d4494 026b0107
......@@ -155,11 +155,11 @@ class Environment < ApplicationRecord
end
def has_terminals?
project.deployment_platform.present? && available? && last_deployment.present?
deployment_platform.present? && available? && last_deployment.present?
end
def terminals
project.deployment_platform.terminals(self) if has_terminals?
deployment_platform.terminals(self) if has_terminals?
end
def has_metrics?
......
......@@ -36,16 +36,6 @@ module EE
project.protected_environment_accessible_to?(name, user)
end
override :has_terminals?
def has_terminals?
deployment_platform.present? && available? && last_deployment.present?
end
override :terminals
def terminals
deployment_platform.terminals(self) if has_terminals?
end
def rollout_status
deployment_platform.rollout_status(self) if has_terminals?
end
......
......@@ -592,9 +592,7 @@ describe Environment do
shared_examples 'same behavior between KubernetesService and Platform::Kubernetes' do
it 'returns the terminals from the deployment service' do
deployment_platform_target = Gitlab.ee? ? environment : project
expect(deployment_platform_target.deployment_platform)
expect(environment.deployment_platform)
.to receive(:terminals).with(environment)
.and_return(:fake_terminals)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment