diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-21 03:07:56 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-21 03:07:56 +0300 |
commit | 6fbaac1974d2e9a0e5296a9da2d99f356a684f91 (patch) | |
tree | 965884691ca08bf2c2a00e49a359c30515aaa813 /spec/lib | |
parent | c972699d3975e61785389602bfc8078d3bc40091 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/data_builder/build_spec.rb | 19 | ||||
-rw-r--r-- | spec/lib/gitlab/git/keep_around_spec.rb | 15 |
2 files changed, 15 insertions, 19 deletions
diff --git a/spec/lib/gitlab/data_builder/build_spec.rb b/spec/lib/gitlab/data_builder/build_spec.rb index 92fef93bddb..7cd0af0dcec 100644 --- a/spec/lib/gitlab/data_builder/build_spec.rb +++ b/spec/lib/gitlab/data_builder/build_spec.rb @@ -66,25 +66,6 @@ RSpec.describe Gitlab::DataBuilder::Build, feature_category: :integrations do expect(control.count).to eq(14) end - context 'when job_webhook_retries_count feature flag is disabled' do - before do - stub_feature_flags(job_webhook_retries_count: false) - end - - it { expect(data).not_to have_key(:retries_count) } - - it 'does not exceed number of expected queries' do - ci_build # Make sure the Ci::Build model is created before recording. - - control = ActiveRecord::QueryRecorder.new(skip_cached: false) do - b = Ci::Build.find(ci_build.id) - described_class.build(b) # Don't use ci_build variable here since it has all associations loaded into memory - end - - expect(control.count).to eq(13) - end - end - context 'commit author_url' do context 'when no commit present' do let(:build) { build(:ci_build) } diff --git a/spec/lib/gitlab/git/keep_around_spec.rb b/spec/lib/gitlab/git/keep_around_spec.rb index d6359d55646..65bed3f2ae6 100644 --- a/spec/lib/gitlab/git/keep_around_spec.rb +++ b/spec/lib/gitlab/git/keep_around_spec.rb @@ -7,6 +7,7 @@ RSpec.describe Gitlab::Git::KeepAround do let(:repository) { create(:project, :repository).repository } let(:service) { described_class.new(repository) } + let(:keep_around_ref_name) { "refs/#{::Repository::REF_KEEP_AROUND}/#{sample_commit.id}" } it "does not fail if we attempt to reference bad commit" do expect(service.kept_around?('abc1234')).to be_falsey @@ -16,6 +17,7 @@ RSpec.describe Gitlab::Git::KeepAround do service.execute([sample_commit.id]) expect(service.kept_around?(sample_commit.id)).to be_truthy + expect(repository.list_refs([keep_around_ref_name])).not_to be_empty end it "does not fail if writting the ref fails" do @@ -45,4 +47,17 @@ RSpec.describe Gitlab::Git::KeepAround do expect(service.kept_around?(another_sample_commit.id)).to be_truthy end end + + context 'when disable_keep_around_refs feature flag is enabled' do + before do + stub_feature_flags(disable_keep_around_refs: true) + end + + it 'does not create keep-around refs' do + service.execute([sample_commit.id]) + + expect(service.kept_around?(sample_commit.id)).to be_truthy + expect(repository.list_refs([keep_around_ref_name])).to be_empty + end + end end |