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:
Diffstat (limited to 'spec/models/clusters')
-rw-r--r--spec/models/clusters/applications/fluentd_spec.rb50
-rw-r--r--spec/models/clusters/applications/ingress_spec.rb6
-rw-r--r--spec/models/clusters/cluster_spec.rb3
3 files changed, 58 insertions, 1 deletions
diff --git a/spec/models/clusters/applications/fluentd_spec.rb b/spec/models/clusters/applications/fluentd_spec.rb
new file mode 100644
index 00000000000..7e9680b0ab4
--- /dev/null
+++ b/spec/models/clusters/applications/fluentd_spec.rb
@@ -0,0 +1,50 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Clusters::Applications::Fluentd do
+ let(:fluentd) { create(:clusters_applications_fluentd) }
+
+ include_examples 'cluster application core specs', :clusters_applications_fluentd
+ include_examples 'cluster application status specs', :clusters_applications_fluentd
+ include_examples 'cluster application version specs', :clusters_applications_fluentd
+ include_examples 'cluster application initial status specs'
+
+ describe '#can_uninstall?' do
+ subject { fluentd.can_uninstall? }
+
+ it { is_expected.to be true }
+ end
+
+ describe '#install_command' do
+ subject { fluentd.install_command }
+
+ it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) }
+
+ it 'is initialized with fluentd arguments' do
+ expect(subject.name).to eq('fluentd')
+ expect(subject.chart).to eq('stable/fluentd')
+ expect(subject.version).to eq('2.4.0')
+ expect(subject).to be_rbac
+ end
+
+ context 'application failed to install previously' do
+ let(:fluentd) { create(:clusters_applications_fluentd, :errored, version: '0.0.1') }
+
+ it 'is initialized with the locked version' do
+ expect(subject.version).to eq('2.4.0')
+ end
+ end
+ end
+
+ describe '#files' do
+ let(:application) { fluentd }
+ let(:values) { subject[:'values.yaml'] }
+
+ subject { application.files }
+
+ it 'includes fluentd specific keys in the values.yaml file' do
+ expect(values).to include('output.conf', 'general.conf')
+ end
+ end
+end
diff --git a/spec/models/clusters/applications/ingress_spec.rb b/spec/models/clusters/applications/ingress_spec.rb
index 64d667f40f6..b070729ccac 100644
--- a/spec/models/clusters/applications/ingress_spec.rb
+++ b/spec/models/clusters/applications/ingress_spec.rb
@@ -219,6 +219,12 @@ describe Clusters::Applications::Ingress do
expect(subject.values).to include('extraContainers')
end
+
+ it 'includes livenessProbe for modsecurity sidecar container' do
+ probe_config = YAML.safe_load(subject.values).dig('controller', 'extraContainers', 0, 'livenessProbe')
+
+ expect(probe_config).to eq('exec' => { 'command' => ['ls', '/var/log/modsec/audit.log'] })
+ end
end
context 'when modsecurity_enabled is disabled' do
diff --git a/spec/models/clusters/cluster_spec.rb b/spec/models/clusters/cluster_spec.rb
index 29c75186110..db1d8672d1e 100644
--- a/spec/models/clusters/cluster_spec.rb
+++ b/spec/models/clusters/cluster_spec.rb
@@ -582,9 +582,10 @@ describe Clusters::Cluster, :use_clean_rails_memory_store_caching do
let!(:jupyter) { create(:clusters_applications_jupyter, cluster: cluster) }
let!(:knative) { create(:clusters_applications_knative, cluster: cluster) }
let!(:elastic_stack) { create(:clusters_applications_elastic_stack, cluster: cluster) }
+ let!(:fluentd) { create(:clusters_applications_fluentd, cluster: cluster) }
it 'returns a list of created applications' do
- is_expected.to contain_exactly(helm, ingress, cert_manager, crossplane, prometheus, runner, jupyter, knative, elastic_stack)
+ is_expected.to contain_exactly(helm, ingress, cert_manager, crossplane, prometheus, runner, jupyter, knative, elastic_stack, fluentd)
end
end
end