summaryrefslogtreecommitdiff
path: root/spec/models/clusters
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-18 14:14:39 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-18 14:14:39 +0000
commit1eb82b65c554f21d83447f895a6208905fabe112 (patch)
treeab12f01b3dc46f11c02afea1e470a78f06ca70c2 /spec/models/clusters
parent4ab54c2233e91f60a80e5b6fa2181e6899fdcc3e (diff)
downloadgitlab-ce-stable-branch-foss-test.tar.gz
Add latest changes from gitlab-org/gitlab@12-3-auto-deploy-20190916stable-branch-foss-test
Diffstat (limited to 'spec/models/clusters')
-rw-r--r--spec/models/clusters/applications/ingress_spec.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/models/clusters/applications/ingress_spec.rb b/spec/models/clusters/applications/ingress_spec.rb
index f984f6ba0ce..d9461ee8581 100644
--- a/spec/models/clusters/applications/ingress_spec.rb
+++ b/spec/models/clusters/applications/ingress_spec.rb
@@ -131,4 +131,41 @@ describe Clusters::Applications::Ingress do
expect(values).to include('podAnnotations')
end
end
+
+ describe '#values' do
+ let(:project) { build(:project) }
+ let(:cluster) { build(:cluster, projects: [project]) }
+
+ context 'when ingress_modsecurity is enabled' do
+ before do
+ stub_feature_flags(ingress_modsecurity: true)
+
+ allow(subject).to receive(:cluster).and_return(cluster)
+ end
+
+ it 'includes modsecurity module enablement' do
+ expect(subject.values).to include("enable-modsecurity: 'true'")
+ end
+
+ it 'includes modsecurity core ruleset enablement' do
+ expect(subject.values).to include("enable-owasp-modsecurity-crs: 'true'")
+ end
+ end
+
+ context 'when ingress_modsecurity is disabled' do
+ before do
+ stub_feature_flags(ingress_modsecurity: false)
+
+ allow(subject).to receive(:cluster).and_return(cluster)
+ end
+
+ it 'excludes modsecurity module enablement' do
+ expect(subject.values).not_to include('enable-modsecurity')
+ end
+
+ it 'excludes modsecurity core ruleset enablement' do
+ expect(subject.values).not_to include('enable-owasp-modsecurity-crs')
+ end
+ end
+ end
end