summaryrefslogtreecommitdiff
path: root/spec/models/environment_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-07-20 12:26:25 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-07-20 12:26:25 +0000
commita09983ae35713f5a2bbb100981116d31ce99826e (patch)
tree2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/models/environment_spec.rb
parent18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff)
downloadgitlab-ce-a09983ae35713f5a2bbb100981116d31ce99826e.tar.gz
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/models/environment_spec.rb')
-rw-r--r--spec/models/environment_spec.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/spec/models/environment_spec.rb b/spec/models/environment_spec.rb
index b93da518b68..c449a3c3c47 100644
--- a/spec/models/environment_spec.rb
+++ b/spec/models/environment_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-describe Environment, :use_clean_rails_memory_store_caching do
+RSpec.describe Environment, :use_clean_rails_memory_store_caching do
include ReactiveCachingHelpers
using RSpec::Parameterized::TableSyntax
include RepoHelpers
@@ -18,6 +18,7 @@ describe Environment, :use_clean_rails_memory_store_caching do
it { is_expected.to belong_to(:project).required }
it { is_expected.to have_many(:deployments) }
it { is_expected.to have_many(:metrics_dashboard_annotations) }
+ it { is_expected.to have_many(:alert_management_alerts) }
it { is_expected.to delegate_method(:stop_action).to(:last_deployment) }
it { is_expected.to delegate_method(:manual_actions).to(:last_deployment) }
@@ -847,6 +848,20 @@ describe Environment, :use_clean_rails_memory_store_caching do
subject { environment.calculate_reactive_cache }
+ it 'overrides default reactive_cache_hard_limit to 10 Mb' do
+ expect(described_class.reactive_cache_hard_limit).to eq(10.megabyte)
+ end
+
+ it 'overrides reactive_cache_limit_enabled? with a FF' do
+ environment_with_enabled_ff = FactoryBot.build(:environment)
+ environment_with_disabled_ff = FactoryBot.build(:environment)
+
+ stub_feature_flags(reactive_caching_limit_environment: environment_with_enabled_ff.project)
+
+ expect(environment_with_enabled_ff.send(:reactive_cache_limit_enabled?)).to be_truthy
+ expect(environment_with_disabled_ff.send(:reactive_cache_limit_enabled?)).to be_falsey
+ end
+
it 'returns cache data from the deployment platform' do
expect(environment.deployment_platform).to receive(:calculate_reactive_cache_for)
.with(environment).and_return(pods: %w(pod1 pod2))