summaryrefslogtreecommitdiff
path: root/spec/models/clusters/applications
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-27 15:09:24 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-27 15:09:24 +0000
commitf8d15ca65390475e356b06dedc51e10ccd179f86 (patch)
treeef916d4e8e11c9e00d809e5cdcf63814e86d6e89 /spec/models/clusters/applications
parent3ab4feda4dce9c9f0672375ae27c2f7c2ba6f4ad (diff)
downloadgitlab-ce-f8d15ca65390475e356b06dedc51e10ccd179f86.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/clusters/applications')
-rw-r--r--spec/models/clusters/applications/knative_spec.rb57
1 files changed, 57 insertions, 0 deletions
diff --git a/spec/models/clusters/applications/knative_spec.rb b/spec/models/clusters/applications/knative_spec.rb
index 993cc7d0203..7ff7644e703 100644
--- a/spec/models/clusters/applications/knative_spec.rb
+++ b/spec/models/clusters/applications/knative_spec.rb
@@ -14,6 +14,7 @@ describe Clusters::Applications::Knative do
before do
allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_in)
allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_async)
+ allow(ClusterConfigureIstioWorker).to receive(:perform_async)
end
describe 'associations' do
@@ -47,6 +48,32 @@ describe Clusters::Applications::Knative do
end
end
+ describe 'configuring istio ingress gateway' do
+ context 'after installed' do
+ let(:application) { create(:clusters_applications_knative, :installing) }
+
+ before do
+ application.make_installed!
+ end
+
+ it 'schedules a ClusterConfigureIstioWorker' do
+ expect(ClusterConfigureIstioWorker).to have_received(:perform_async).with(application.cluster_id)
+ end
+ end
+
+ context 'after updated' do
+ let(:application) { create(:clusters_applications_knative, :updating) }
+
+ before do
+ application.make_installed!
+ end
+
+ it 'schedules a ClusterConfigureIstioWorker' do
+ expect(ClusterConfigureIstioWorker).to have_received(:perform_async).with(application.cluster_id)
+ end
+ end
+ end
+
describe '#can_uninstall?' do
subject { knative.can_uninstall? }
@@ -196,4 +223,34 @@ describe Clusters::Applications::Knative do
describe 'validations' do
it { is_expected.to validate_presence_of(:hostname) }
end
+
+ describe '#available_domains' do
+ let!(:domain) { create(:pages_domain, :instance_serverless) }
+
+ it 'returns all instance serverless domains' do
+ expect(PagesDomain).to receive(:instance_serverless).and_call_original
+
+ domains = subject.available_domains
+
+ expect(domains.length).to eq(1)
+ expect(domains).to include(domain)
+ end
+ end
+
+ describe '#find_available_domain' do
+ let!(:domain) { create(:pages_domain, :instance_serverless) }
+
+ it 'returns the domain scoped to available domains' do
+ expect(subject).to receive(:available_domains).and_call_original
+ expect(subject.find_available_domain(domain.id)).to eq(domain)
+ end
+ end
+
+ describe '#pages_domain' do
+ let!(:sdc) { create(:serverless_domain_cluster, knative: knative) }
+
+ it 'returns the the associated pages domain' do
+ expect(knative.reload.pages_domain).to eq(sdc.pages_domain)
+ end
+ end
end