Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMayra Cabrera <mcabrera@gitlab.com>2019-02-05 22:11:33 +0300
committerMayra Cabrera <mcabrera@gitlab.com>2019-02-07 06:51:48 +0300
commitd9af3752fcfa6e97bcec82515b0cbc1ab88285de (patch)
tree61e1e650e5e7671f5d38b7acc1940c20e3c677e4 /spec/models
parent087af654bbae1e4a843029b33e1aab546f4d7d61 (diff)
Addresses UX and BE comments:
- Changes help text on clusters form to make it more explicit. - Removes unnecessary warnings on auto devops form - Simplifies cluster methods logic
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/clusters/cluster_spec.rb78
1 files changed, 62 insertions, 16 deletions
diff --git a/spec/models/clusters/cluster_spec.rb b/spec/models/clusters/cluster_spec.rb
index abef586d258..92ce2b0999a 100644
--- a/spec/models/clusters/cluster_spec.rb
+++ b/spec/models/clusters/cluster_spec.rb
@@ -516,29 +516,75 @@ describe Clusters::Cluster do
end
end
- describe '#has_domain?' do
- subject { cluster.has_domain? }
-
- context 'with domain set at instance level' do
- let(:cluster) { create(:cluster, :provided_by_gcp) }
-
- before do
- stub_application_setting(auto_devops_domain: 'global_domain.com')
- end
+ describe '#kube_ingress_domain' do
+ let(:cluster) { create(:cluster, :provided_by_gcp) }
- it { is_expected.to be_truthy }
- end
+ subject { cluster.kube_ingress_domain }
context 'with domain set in cluster' do
let(:cluster) { create(:cluster, :provided_by_gcp, :with_domain) }
- it { is_expected.to be_truthy }
+ it { is_expected.to eq(cluster.domain) }
end
- context 'when domain is not set at instance level nor in cluster' do
- let(:cluster) { create(:cluster, :provided_by_gcp) }
+ context 'with no domain on cluster' do
+ context 'with a project cluster' do
+ let(:cluster) { create(:cluster, :project, :provided_by_gcp) }
+ let(:project) { cluster.project }
+
+ context 'with domain set at instance level' do
+ before do
+ stub_application_setting(auto_devops_domain: 'global_domain.com')
+
+ it { is_expected.to eq('global_domain.com') }
+ end
+ end
+
+ context 'with domain set on ProjectAutoDevops' do
+ before do
+ auto_devops = project.build_auto_devops(domain: 'legacy-ado-domain.com')
+ auto_devops.save
+ end
+
+ it { is_expected.to eq('legacy-ado-domain.com') }
+ end
- it { is_expected.to be_falsy }
+ context 'with domain set as environment variable on project' do
+ before do
+ variable = project.variables.build(key: 'AUTO_DEVOPS_DOMAIN', value: 'project-ado-domain.com')
+ variable.save
+ end
+
+ it { is_expected.to eq('project-ado-domain.com') }
+ end
+
+ context 'with domain set as environment variable on the group project' do
+ let(:group) { create(:group) }
+
+ before do
+ project.update(parent_id: group.id)
+ variable = group.variables.build(key: 'AUTO_DEVOPS_DOMAIN', value: 'group-ado-domain.com')
+ variable.save
+ end
+
+ it { is_expected.to eq('group-ado-domain.com') }
+ end
+ end
+
+ context 'with a group cluster' do
+ let(:cluster) { create(:cluster, :group, :provided_by_gcp) }
+
+ context 'with domain set as environment variable for the group' do
+ let(:group) { cluster.group }
+
+ before do
+ variable = group.variables.build(key: 'AUTO_DEVOPS_DOMAIN', value: 'group-ado-domain.com')
+ variable.save
+ end
+
+ it { is_expected.to eq('group-ado-domain.com') }
+ end
+ end
end
end
@@ -566,7 +612,7 @@ describe Clusters::Cluster do
end
context 'with no domain' do
- let(:cluster) { create(:cluster) }
+ let(:cluster) { create(:cluster, :provided_by_gcp, :project) }
it 'should return an empty array' do
expect(subject.to_hash).to be_empty