diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-09 15:07:50 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-09 15:07:50 +0000 |
commit | e38a99eb0725697297386dd0bb1045b1fd55493a (patch) | |
tree | e6298122cbb5418f59c140f4f9e303abdc0739b5 /spec/models/clusters | |
parent | 7c41737ae53e3a237f356480ae04ec3ba182447b (diff) | |
download | gitlab-ce-e38a99eb0725697297386dd0bb1045b1fd55493a.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/clusters')
-rw-r--r-- | spec/models/clusters/applications/cert_manager_spec.rb | 5 | ||||
-rw-r--r-- | spec/models/clusters/applications/crossplane_spec.rb | 5 | ||||
-rw-r--r-- | spec/models/clusters/applications/helm_spec.rb | 4 | ||||
-rw-r--r-- | spec/models/clusters/applications/ingress_spec.rb | 5 | ||||
-rw-r--r-- | spec/models/clusters/applications/jupyter_spec.rb | 4 | ||||
-rw-r--r-- | spec/models/clusters/applications/knative_spec.rb | 4 | ||||
-rw-r--r-- | spec/models/clusters/applications/prometheus_spec.rb | 7 | ||||
-rw-r--r-- | spec/models/clusters/applications/runner_spec.rb | 4 | ||||
-rw-r--r-- | spec/models/clusters/cluster_spec.rb | 4 | ||||
-rw-r--r-- | spec/models/clusters/integrations/prometheus_spec.rb | 10 | ||||
-rw-r--r-- | spec/models/clusters/platforms/kubernetes_spec.rb | 6 | ||||
-rw-r--r-- | spec/models/clusters/providers/aws_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/clusters/providers/gcp_spec.rb | 3 |
13 files changed, 61 insertions, 2 deletions
diff --git a/spec/models/clusters/applications/cert_manager_spec.rb b/spec/models/clusters/applications/cert_manager_spec.rb index 05ab8c4108e..427a99efadd 100644 --- a/spec/models/clusters/applications/cert_manager_spec.rb +++ b/spec/models/clusters/applications/cert_manager_spec.rb @@ -10,6 +10,11 @@ RSpec.describe Clusters::Applications::CertManager do include_examples 'cluster application version specs', :clusters_applications_cert_manager include_examples 'cluster application initial status specs' + describe 'default values' do + it { expect(cert_manager.version).to eq(described_class::VERSION) } + it { expect(cert_manager.email).to eq("admin@example.com") } + end + describe '#can_uninstall?' do subject { cert_manager.can_uninstall? } diff --git a/spec/models/clusters/applications/crossplane_spec.rb b/spec/models/clusters/applications/crossplane_spec.rb index 7082576028b..d1abaa52c7f 100644 --- a/spec/models/clusters/applications/crossplane_spec.rb +++ b/spec/models/clusters/applications/crossplane_spec.rb @@ -14,6 +14,11 @@ RSpec.describe Clusters::Applications::Crossplane do it { is_expected.to validate_presence_of(:stack) } end + describe 'default values' do + it { expect(subject.version).to eq(described_class::VERSION) } + it { expect(subject.stack).to be_empty } + end + describe '#can_uninstall?' do subject { crossplane.can_uninstall? } diff --git a/spec/models/clusters/applications/helm_spec.rb b/spec/models/clusters/applications/helm_spec.rb index 5212e321a55..1b8be92475a 100644 --- a/spec/models/clusters/applications/helm_spec.rb +++ b/spec/models/clusters/applications/helm_spec.rb @@ -5,6 +5,10 @@ require 'spec_helper' RSpec.describe Clusters::Applications::Helm do include_examples 'cluster application core specs', :clusters_applications_helm + describe 'default values' do + it { expect(subject.version).to eq(Gitlab::Kubernetes::Helm::V2::BaseCommand::HELM_VERSION) } + end + describe '.available' do subject { described_class.available } diff --git a/spec/models/clusters/applications/ingress_spec.rb b/spec/models/clusters/applications/ingress_spec.rb index e16d97c42d9..e5caa11452e 100644 --- a/spec/models/clusters/applications/ingress_spec.rb +++ b/spec/models/clusters/applications/ingress_spec.rb @@ -18,6 +18,11 @@ RSpec.describe Clusters::Applications::Ingress do allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_async) end + describe 'default values' do + it { expect(subject.ingress_type).to eq("nginx") } + it { expect(subject.version).to eq(described_class::VERSION) } + end + describe '#can_uninstall?' do subject { ingress.can_uninstall? } diff --git a/spec/models/clusters/applications/jupyter_spec.rb b/spec/models/clusters/applications/jupyter_spec.rb index e7de2d24334..9336d2352f8 100644 --- a/spec/models/clusters/applications/jupyter_spec.rb +++ b/spec/models/clusters/applications/jupyter_spec.rb @@ -10,6 +10,10 @@ RSpec.describe Clusters::Applications::Jupyter do it { is_expected.to belong_to(:oauth_application) } + describe 'default values' do + it { expect(subject.version).to eq(described_class::VERSION) } + end + describe '#can_uninstall?' do let(:ingress) { create(:clusters_applications_ingress, :installed, external_hostname: 'localhost.localdomain') } let(:jupyter) { create(:clusters_applications_jupyter, cluster: ingress.cluster) } diff --git a/spec/models/clusters/applications/knative_spec.rb b/spec/models/clusters/applications/knative_spec.rb index d0e470bfa42..3914450339a 100644 --- a/spec/models/clusters/applications/knative_spec.rb +++ b/spec/models/clusters/applications/knative_spec.rb @@ -21,6 +21,10 @@ RSpec.describe Clusters::Applications::Knative do it { is_expected.to have_one(:serverless_domain_cluster).class_name('::Serverless::DomainCluster').with_foreign_key('clusters_applications_knative_id').inverse_of(:knative) } end + describe 'default values' do + it { expect(subject.version).to eq(described_class::VERSION) } + end + describe 'when cloud run is enabled' do let(:cluster) { create(:cluster, :provided_by_gcp, :cloud_run_enabled) } let(:knative_cloud_run) { create(:clusters_applications_knative, cluster: cluster) } diff --git a/spec/models/clusters/applications/prometheus_spec.rb b/spec/models/clusters/applications/prometheus_spec.rb index b60c5ec114d..15c3162270e 100644 --- a/spec/models/clusters/applications/prometheus_spec.rb +++ b/spec/models/clusters/applications/prometheus_spec.rb @@ -12,6 +12,13 @@ RSpec.describe Clusters::Applications::Prometheus do include_examples 'cluster application helm specs', :clusters_applications_prometheus include_examples 'cluster application initial status specs' + describe 'default values' do + subject(:prometheus) { build(:clusters_applications_prometheus) } + + it { expect(prometheus.alert_manager_token).to be_an_instance_of(String) } + it { expect(prometheus.version).to eq(described_class::VERSION) } + end + describe 'after_destroy' do let(:cluster) { create(:cluster, :with_installed_helm) } let(:application) { create(:clusters_applications_prometheus, :installed, cluster: cluster) } diff --git a/spec/models/clusters/applications/runner_spec.rb b/spec/models/clusters/applications/runner_spec.rb index 8f02161843b..04b5ae9641d 100644 --- a/spec/models/clusters/applications/runner_spec.rb +++ b/spec/models/clusters/applications/runner_spec.rb @@ -13,6 +13,10 @@ RSpec.describe Clusters::Applications::Runner do it { is_expected.to belong_to(:runner) } + describe 'default values' do + it { expect(subject.version).to eq(described_class::VERSION) } + end + describe '#can_uninstall?' do let(:gitlab_runner) { create(:clusters_applications_runner, runner: ci_runner) } diff --git a/spec/models/clusters/cluster_spec.rb b/spec/models/clusters/cluster_spec.rb index 73cd7bb9075..be64d72e031 100644 --- a/spec/models/clusters/cluster_spec.rb +++ b/spec/models/clusters/cluster_spec.rb @@ -49,6 +49,10 @@ RSpec.describe Clusters::Cluster, :use_clean_rails_memory_store_caching do it { is_expected.to respond_to :project } it { is_expected.to be_namespace_per_environment } + describe 'default values' do + it { expect(subject.helm_major_version).to eq(3) } + end + it_behaves_like 'it has loose foreign keys' do let(:factory_name) { :cluster } end diff --git a/spec/models/clusters/integrations/prometheus_spec.rb b/spec/models/clusters/integrations/prometheus_spec.rb index 90e99aefdce..d6d1105cdb1 100644 --- a/spec/models/clusters/integrations/prometheus_spec.rb +++ b/spec/models/clusters/integrations/prometheus_spec.rb @@ -15,6 +15,16 @@ RSpec.describe Clusters::Integrations::Prometheus do it { is_expected.not_to allow_value(nil).for(:enabled) } end + describe 'default values' do + subject(:integration) { build(:clusters_integrations_prometheus) } + + before do + allow(SecureRandom).to receive(:hex).and_return('randomtoken') + end + + it { expect(integration.alert_manager_token).to eq('randomtoken') } + end + describe 'after_destroy' do subject(:integration) { create(:clusters_integrations_prometheus, cluster: cluster, enabled: true) } diff --git a/spec/models/clusters/platforms/kubernetes_spec.rb b/spec/models/clusters/platforms/kubernetes_spec.rb index 35ed6f4e2c6..99dbb654b7f 100644 --- a/spec/models/clusters/platforms/kubernetes_spec.rb +++ b/spec/models/clusters/platforms/kubernetes_spec.rb @@ -21,6 +21,12 @@ RSpec.describe Clusters::Platforms::Kubernetes do it_behaves_like 'having unique enum values' + describe 'default values' do + let(:kubernetes) { create(:cluster_platform_kubernetes) } + + it { expect(kubernetes.authorization_type).to eq("rbac") } + end + describe 'before_validation' do let(:kubernetes) { create(:cluster_platform_kubernetes, :configured, namespace: namespace) } diff --git a/spec/models/clusters/providers/aws_spec.rb b/spec/models/clusters/providers/aws_spec.rb index 3b4a48cc5be..2afed663edf 100644 --- a/spec/models/clusters/providers/aws_spec.rb +++ b/spec/models/clusters/providers/aws_spec.rb @@ -13,7 +13,7 @@ RSpec.describe Clusters::Providers::Aws do include_examples 'provider status', :cluster_provider_aws - describe 'default_value_for' do + describe 'default values' do let(:provider) { build(:cluster_provider_aws) } it "sets default values" do diff --git a/spec/models/clusters/providers/gcp_spec.rb b/spec/models/clusters/providers/gcp_spec.rb index ad9ada04875..a1f00069937 100644 --- a/spec/models/clusters/providers/gcp_spec.rb +++ b/spec/models/clusters/providers/gcp_spec.rb @@ -8,13 +8,14 @@ RSpec.describe Clusters::Providers::Gcp do include_examples 'provider status', :cluster_provider_gcp - describe 'default_value_for' do + describe 'default values' do let(:gcp) { build(:cluster_provider_gcp) } it "has default value" do expect(gcp.zone).to eq('us-central1-a') expect(gcp.num_nodes).to eq(3) expect(gcp.machine_type).to eq('n1-standard-2') + expect(gcp.cloud_run).to eq(false) end end |