Commit ee18ca2f authored by Thong Kuah's avatar Thong Kuah

Rename method to not clash with #cluster

We will introduce #cluster at a later stage.
Also deprecate this method
parent 25adee56
......@@ -84,7 +84,8 @@ class Deployment < ApplicationRecord
Commit.truncate_sha(sha)
end
def cluster
# Deprecated - will be replaced by a persisted cluster_id
def deployment_platform_cluster
environment.deployment_platform&.cluster
end
......
......@@ -21,7 +21,7 @@ module Gitlab
private
def deployment_cluster
build.deployment&.cluster
build.deployment&.deployment_platform_cluster
end
def kubernetes_namespace
......
......@@ -23,7 +23,7 @@ describe Gitlab::Ci::Build::Prerequisite::KubernetesNamespace do
let(:cluster) { create(:cluster, :group) }
before do
allow(build.deployment).to receive(:cluster).and_return(cluster)
allow(build.deployment).to receive(:deployment_platform_cluster).and_return(cluster)
end
it { is_expected.to be_truthy }
......@@ -55,7 +55,7 @@ describe Gitlab::Ci::Build::Prerequisite::KubernetesNamespace do
context 'and no cluster to deploy to' do
before do
expect(deployment.cluster).to be_nil
expect(deployment.deployment_platform_cluster).to be_nil
end
it { is_expected.to be_falsey }
......@@ -73,7 +73,7 @@ describe Gitlab::Ci::Build::Prerequisite::KubernetesNamespace do
let(:cluster) { create(:cluster, :group) }
before do
allow(build.deployment).to receive(:cluster).and_return(cluster)
allow(build.deployment).to receive(:deployment_platform_cluster).and_return(cluster)
end
it 'creates a kubernetes namespace' do
......@@ -90,7 +90,7 @@ describe Gitlab::Ci::Build::Prerequisite::KubernetesNamespace do
context 'completion is not required' do
before do
expect(deployment.cluster).to be_nil
expect(deployment.deployment_platform_cluster).to be_nil
end
it 'does not create a namespace' do
......
......@@ -380,12 +380,12 @@ describe Deployment do
end
end
describe '#cluster' do
describe '#deployment_platform_cluster' do
let(:deployment) { create(:deployment) }
let(:project) { deployment.project }
let(:environment) { deployment.environment }
subject { deployment.cluster }
subject { deployment.deployment_platform_cluster }
before do
expect(project).to receive(:deployment_platform)
......
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