diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-31 21:17:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-31 21:17:06 +0300 |
commit | 4747b1ebc408204ff9ac4e6b9afa1d97fcf8c91a (patch) | |
tree | 1a7cf972d18990f46fadee34dae9676b7016f7c9 /spec/models/clusters | |
parent | ccab6fb4df8bc12220334618e56d911c4d0e447c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/clusters')
-rw-r--r-- | spec/models/clusters/applications/ingress_spec.rb | 120 | ||||
-rw-r--r-- | spec/models/clusters/cluster_spec.rb | 36 |
2 files changed, 1 insertions, 155 deletions
diff --git a/spec/models/clusters/applications/ingress_spec.rb b/spec/models/clusters/applications/ingress_spec.rb deleted file mode 100644 index 99be2ed8ee8..00000000000 --- a/spec/models/clusters/applications/ingress_spec.rb +++ /dev/null @@ -1,120 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Clusters::Applications::Ingress do - let(:ingress) { create(:clusters_applications_ingress) } - - before do - allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_in) - allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_async) - end - - it_behaves_like 'having unique enum values' - - include_examples 'cluster application core specs', :clusters_applications_ingress - include_examples 'cluster application status specs', :clusters_applications_ingress - include_examples 'cluster application version specs', :clusters_applications_ingress - include_examples 'cluster application helm specs', :clusters_applications_ingress - include_examples 'cluster application initial status specs' - - describe 'default values' do - it { expect(subject.ingress_type).to eq("nginx") } - it { expect(subject.version).to eq(described_class::VERSION) } - end - - describe '#make_installed!' do - before do - application.make_installed! - end - - let(:application) { create(:clusters_applications_ingress, :installing) } - - it 'schedules a ClusterWaitForIngressIpAddressWorker' do - expect(ClusterWaitForIngressIpAddressWorker).to have_received(:perform_in) - .with(Clusters::Applications::Ingress::FETCH_IP_ADDRESS_DELAY, 'ingress', application.id) - end - end - - describe '#schedule_status_update' do - let(:application) { create(:clusters_applications_ingress, :installed) } - - before do - application.schedule_status_update - end - - it 'schedules a ClusterWaitForIngressIpAddressWorker' do - expect(ClusterWaitForIngressIpAddressWorker).to have_received(:perform_async) - .with('ingress', application.id) - end - - context 'when the application is not installed' do - let(:application) { create(:clusters_applications_ingress, :installing) } - - it 'does not schedule a ClusterWaitForIngressIpAddressWorker' do - expect(ClusterWaitForIngressIpAddressWorker).not_to have_received(:perform_async) - end - end - - context 'when there is already an external_ip' do - let(:application) { create(:clusters_applications_ingress, :installed, external_ip: '111.222.222.111') } - - it 'does not schedule a ClusterWaitForIngressIpAddressWorker' do - expect(ClusterWaitForIngressIpAddressWorker).not_to have_received(:perform_in) - end - end - - context 'when there is already an external_hostname' do - let(:application) { create(:clusters_applications_ingress, :installed, external_hostname: 'localhost.localdomain') } - - it 'does not schedule a ClusterWaitForIngressIpAddressWorker' do - expect(ClusterWaitForIngressIpAddressWorker).not_to have_received(:perform_in) - end - end - end - - describe '#install_command' do - subject { ingress.install_command } - - it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::V3::InstallCommand) } - - it 'is initialized with ingress arguments' do - expect(subject.name).to eq('ingress') - expect(subject.chart).to eq('ingress/nginx-ingress') - expect(subject.version).to eq('1.40.2') - expect(subject).to be_rbac - expect(subject.files).to eq(ingress.files) - end - - context 'on a non rbac enabled cluster' do - before do - ingress.cluster.platform_kubernetes.abac! - end - - it { is_expected.not_to be_rbac } - end - - context 'application failed to install previously' do - let(:ingress) { create(:clusters_applications_ingress, :errored, version: 'nginx') } - - it 'is initialized with the locked version' do - expect(subject.version).to eq('1.40.2') - end - end - end - - describe '#files' do - let(:application) { ingress } - let(:values) { subject[:'values.yaml'] } - - subject { application.files } - - it 'includes ingress valid keys in values' do - expect(values).to include('image') - expect(values).to include('repository') - expect(values).to include('stats') - expect(values).to include('podAnnotations') - expect(values).to include('clusterIP') - end - end -end diff --git a/spec/models/clusters/cluster_spec.rb b/spec/models/clusters/cluster_spec.rb index 578b09740a5..f1d4a91f289 100644 --- a/spec/models/clusters/cluster_spec.rb +++ b/spec/models/clusters/cluster_spec.rb @@ -24,7 +24,6 @@ feature_category: :kubernetes_management do it { is_expected.to have_one(:platform_kubernetes) } it { is_expected.to have_one(:integration_prometheus) } it { is_expected.to have_one(:application_helm) } - it { is_expected.to have_one(:application_ingress) } it { is_expected.to have_many(:kubernetes_namespaces) } it { is_expected.to have_one(:cluster_project) } it { is_expected.to have_many(:deployment_clusters) } @@ -34,8 +33,6 @@ feature_category: :kubernetes_management do it { is_expected.to delegate_method(:status).to(:provider) } it { is_expected.to delegate_method(:status_reason).to(:provider) } - it { is_expected.to delegate_method(:external_ip).to(:application_ingress).with_prefix } - it { is_expected.to delegate_method(:external_hostname).to(:application_ingress).with_prefix } it { is_expected.to respond_to :project } it { is_expected.to be_namespace_per_environment } @@ -711,10 +708,9 @@ feature_category: :kubernetes_management do context 'when applications are created' do let!(:helm) { create(:clusters_applications_helm, cluster: cluster) } - let!(:ingress) { create(:clusters_applications_ingress, cluster: cluster) } it 'returns a list of created applications' do - is_expected.to contain_exactly(helm, ingress) + is_expected.to contain_exactly(helm) end end end @@ -1502,34 +1498,4 @@ feature_category: :kubernetes_management do end end end - - describe '#application_ingress_available?' do - subject(:application_ingress_available?) { cluster.application_ingress_available? } - - before do - allow(cluster).to receive(:application_ingress).and_return(application_ingress) - end - - context 'without application_ingress' do - let(:application_ingress) {} - - it { is_expected.to eq(false) } - end - - context 'with application_ingress' do - let(:application_ingress) { instance_double(Clusters::Applications::Ingress, available?: available?) } - - context 'with available? set to true' do - let(:available?) { true } - - it { is_expected.to eq(true) } - end - - context 'with available? set to false' do - let(:available?) { false } - - it { is_expected.to eq(false) } - end - end - end end |