summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/gpg_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/gpg_spec.rb')
-rw-r--r--spec/lib/gitlab/gpg_spec.rb28
1 files changed, 19 insertions, 9 deletions
diff --git a/spec/lib/gitlab/gpg_spec.rb b/spec/lib/gitlab/gpg_spec.rb
index 52d6a86f7d0..8600ef223c6 100644
--- a/spec/lib/gitlab/gpg_spec.rb
+++ b/spec/lib/gitlab/gpg_spec.rb
@@ -177,6 +177,25 @@ describe Gitlab::Gpg do
end.not_to raise_error
end
+ it 'tracks an exception when cleaning up the tmp dir fails' do
+ expected_exception = described_class::CleanupError.new('cleanup failed')
+ expected_tmp_dir = nil
+
+ expect(described_class).to receive(:cleanup_tmp_dir).and_raise(expected_exception)
+ allow(Gitlab::ErrorTracking).to receive(:track_and_raise_for_dev_exception)
+
+ described_class.using_tmp_keychain do
+ expected_tmp_dir = described_class.current_home_dir
+ FileUtils.touch(File.join(expected_tmp_dir, 'dummy.file'))
+ end
+
+ expect(Gitlab::ErrorTracking).to have_received(:track_and_raise_for_dev_exception).with(
+ expected_exception,
+ issue_url: 'https://gitlab.com/gitlab-org/gitlab/issues/20918',
+ tmp_dir: expected_tmp_dir, contents: ['dummy.file']
+ )
+ end
+
shared_examples 'multiple deletion attempts of the tmp-dir' do |seconds|
let(:tmp_dir) do
tmp_dir = Dir.mktmpdir
@@ -211,15 +230,6 @@ describe Gitlab::Gpg do
expect(File.exist?(tmp_dir)).to be false
end
-
- it 'does not retry when the feature flag is disabled' do
- stub_feature_flags(gpg_cleanup_retries: false)
-
- expect(FileUtils).to receive(:remove_entry).with(tmp_dir, true).and_call_original
- expect(Retriable).not_to receive(:retriable)
-
- described_class.using_tmp_keychain {}
- end
end
it_behaves_like 'multiple deletion attempts of the tmp-dir', described_class::FG_CLEANUP_RUNTIME_S