diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /spec/models/clusters/applications/fluentd_spec.rb | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) | |
download | gitlab-ce-9f46488805e86b1bc341ea1620b866016c2ce5ed.tar.gz |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'spec/models/clusters/applications/fluentd_spec.rb')
-rw-r--r-- | spec/models/clusters/applications/fluentd_spec.rb | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/spec/models/clusters/applications/fluentd_spec.rb b/spec/models/clusters/applications/fluentd_spec.rb index 7e9680b0ab4..4e9548990ed 100644 --- a/spec/models/clusters/applications/fluentd_spec.rb +++ b/spec/models/clusters/applications/fluentd_spec.rb @@ -3,7 +3,9 @@ require 'spec_helper' describe Clusters::Applications::Fluentd do - let(:fluentd) { create(:clusters_applications_fluentd) } + let(:waf_log_enabled) { true } + let(:cilium_log_enabled) { true } + let(:fluentd) { create(:clusters_applications_fluentd, waf_log_enabled: waf_log_enabled, cilium_log_enabled: cilium_log_enabled) } include_examples 'cluster application core specs', :clusters_applications_fluentd include_examples 'cluster application status specs', :clusters_applications_fluentd @@ -47,4 +49,36 @@ describe Clusters::Applications::Fluentd do expect(values).to include('output.conf', 'general.conf') end end + + describe '#values' do + let(:modsecurity_log_path) { "/var/log/containers/*#{Clusters::Applications::Ingress::MODSECURITY_LOG_CONTAINER_NAME}*.log" } + let(:cilium_log_path) { "/var/log/containers/*#{described_class::CILIUM_CONTAINER_NAME}*.log" } + + subject { fluentd.values } + + context 'with both logs variables set to false' do + let(:waf_log_enabled) { false } + let(:cilium_log_enabled) { false } + + it "raises ActiveRecord::RecordInvalid" do + expect {subject}.to raise_error(ActiveRecord::RecordInvalid) + end + end + + context 'with both logs variables set to true' do + it { is_expected.to include("#{modsecurity_log_path},#{cilium_log_path}") } + end + + context 'with waf_log_enabled set to true' do + let(:cilium_log_enabled) { false } + + it { is_expected.to include(modsecurity_log_path) } + end + + context 'with cilium_log_enabled set to true' do + let(:waf_log_enabled) { false } + + it { is_expected.to include(cilium_log_path) } + end + end end |