diff options
Diffstat (limited to 'spec/support/shared_examples/lib')
4 files changed, 56 insertions, 3 deletions
diff --git a/spec/support/shared_examples/lib/gitlab/ci/ci_trace_shared_examples.rb b/spec/support/shared_examples/lib/gitlab/ci/ci_trace_shared_examples.rb index e886ec65b02..284c129221b 100644 --- a/spec/support/shared_examples/lib/gitlab/ci/ci_trace_shared_examples.rb +++ b/spec/support/shared_examples/lib/gitlab/ci/ci_trace_shared_examples.rb @@ -834,8 +834,8 @@ RSpec.shared_examples 'trace with enabled live trace feature' do end end - describe '#live_trace_exist?' do - subject { trace.live_trace_exist? } + describe '#live?' do + subject { trace.live? } context 'when trace does not exist' do it { is_expected.to be_falsy } diff --git a/spec/support/shared_examples/lib/gitlab/database/reestablished_connection_stack_shared_examples.rb b/spec/support/shared_examples/lib/gitlab/database/reestablished_connection_stack_shared_examples.rb index 67d739b79ab..d14216ec5ff 100644 --- a/spec/support/shared_examples/lib/gitlab/database/reestablished_connection_stack_shared_examples.rb +++ b/spec/support/shared_examples/lib/gitlab/database/reestablished_connection_stack_shared_examples.rb @@ -22,7 +22,7 @@ RSpec.shared_context 'reconfigures connection stack' do |db_config_name| end end - def validate_connections! + def validate_connections_stack! model_connections = Gitlab::Database.database_base_models.to_h do |db_config_name, model_class| [model_class, Gitlab::Database.db_config_name(model_class.connection)] end diff --git a/spec/support/shared_examples/lib/gitlab/event_store_shared_examples.rb b/spec/support/shared_examples/lib/gitlab/event_store_shared_examples.rb index 4fc15cacab4..db2f2f2d0f0 100644 --- a/spec/support/shared_examples/lib/gitlab/event_store_shared_examples.rb +++ b/spec/support/shared_examples/lib/gitlab/event_store_shared_examples.rb @@ -11,6 +11,8 @@ RSpec.shared_examples 'subscribes to event' do ::Gitlab::EventStore.publish(event) end + + it_behaves_like 'an idempotent worker' end def consume_event(subscriber:, event:) diff --git a/spec/support/shared_examples/lib/gitlab/redis/multi_store_feature_flags_shared_examples.rb b/spec/support/shared_examples/lib/gitlab/redis/multi_store_feature_flags_shared_examples.rb new file mode 100644 index 00000000000..a5e4df1c272 --- /dev/null +++ b/spec/support/shared_examples/lib/gitlab/redis/multi_store_feature_flags_shared_examples.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +RSpec.shared_examples 'multi store feature flags' do |use_primary_and_secondary_stores, use_primary_store_as_default| + context "with feature flag :#{use_primary_and_secondary_stores} is enabled" do + before do + stub_feature_flags(use_primary_and_secondary_stores => true) + end + + it 'multi store is enabled' do + subject.with do |redis_instance| + expect(redis_instance.use_primary_and_secondary_stores?).to be true + end + end + end + + context "with feature flag :#{use_primary_and_secondary_stores} is disabled" do + before do + stub_feature_flags(use_primary_and_secondary_stores => false) + end + + it 'multi store is disabled' do + subject.with do |redis_instance| + expect(redis_instance.use_primary_and_secondary_stores?).to be false + end + end + end + + context "with feature flag :#{use_primary_store_as_default} is enabled" do + before do + stub_feature_flags(use_primary_store_as_default => true) + end + + it 'primary store is enabled' do + subject.with do |redis_instance| + expect(redis_instance.use_primary_store_as_default?).to be true + end + end + end + + context "with feature flag :#{use_primary_store_as_default} is disabled" do + before do + stub_feature_flags(use_primary_store_as_default => false) + end + + it 'primary store is disabled' do + subject.with do |redis_instance| + expect(redis_instance.use_primary_store_as_default?).to be false + end + end + end +end |