diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-29 09:08:28 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-29 09:08:28 +0300 |
commit | bceef0b492c1f4bc15c21c70cbe7aef34385a3da (patch) | |
tree | 96bdf77524803477dd3959de21a5548c6f554d4d /spec/services | |
parent | ced01fb79233c18bc05748804ede24591c04cf49 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/git/branch_hooks_service_spec.rb | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/spec/services/git/branch_hooks_service_spec.rb b/spec/services/git/branch_hooks_service_spec.rb index e991b5bd842..f567624068a 100644 --- a/spec/services/git/branch_hooks_service_spec.rb +++ b/spec/services/git/branch_hooks_service_spec.rb @@ -571,105 +571,4 @@ RSpec.describe Git::BranchHooksService, :clean_gitlab_redis_shared_state, featur end end end - - describe 'Metrics dashboard sync' do - shared_examples 'trigger dashboard sync' do - it 'imports metrics to database' do - expect(Metrics::Dashboard::SyncDashboardsWorker).to receive(:perform_async) - - service.execute - end - end - - shared_examples 'no dashboard sync' do - it 'does not sync metrics to database' do - expect(Metrics::Dashboard::SyncDashboardsWorker).not_to receive(:perform_async) - - service.execute - end - end - - def change_repository(**changes) - actions = changes.flat_map do |(action, paths)| - Array(paths).flat_map do |file_path| - { action: action, file_path: file_path, content: SecureRandom.hex } - end - end - - project.repository.commit_files( - user, message: 'message', branch_name: branch, actions: actions - ) - end - - let(:charts) { '.gitlab/dashboards/charts.yml' } - let(:readme) { 'README.md' } - let(:commit_id) { change_repository(**commit_changes) } - - context 'with default branch' do - context 'when adding files' do - let(:new_file) { 'somenewfile.md' } - - context 'also related' do - let(:commit_changes) { { create: [charts, new_file] } } - - include_examples 'trigger dashboard sync' - end - - context 'only unrelated' do - let(:commit_changes) { { create: new_file } } - - include_examples 'no dashboard sync' - end - end - - context 'when deleting files' do - before do - change_repository(create: charts) - end - - context 'also related' do - let(:commit_changes) { { delete: [charts, readme] } } - - include_examples 'trigger dashboard sync' - end - - context 'only unrelated' do - let(:commit_changes) { { delete: readme } } - - include_examples 'no dashboard sync' - end - end - - context 'when updating files' do - before do - change_repository(create: charts) - end - - context 'also related' do - let(:commit_changes) { { update: [charts, readme] } } - - include_examples 'trigger dashboard sync' - end - - context 'only unrelated' do - let(:commit_changes) { { update: readme } } - - include_examples 'no dashboard sync' - end - end - - context 'without changes' do - let(:commit_changes) { {} } - - include_examples 'no dashboard sync' - end - end - - context 'with other branch' do - let(:branch) { 'fix' } - let(:commit_changes) { { create: charts } } - - include_examples 'no dashboard sync' - end - end end |