diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 08:17:02 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 08:17:02 +0000 |
commit | b39512ed755239198a9c294b6a45e65c05900235 (patch) | |
tree | d234a3efade1de67c46b9e5a38ce813627726aa7 /spec/tooling/lib | |
parent | d31474cf3b17ece37939d20082b07f6657cc79a9 (diff) | |
download | gitlab-ce-b39512ed755239198a9c294b6a45e65c05900235.tar.gz |
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'spec/tooling/lib')
-rw-r--r-- | spec/tooling/lib/tooling/find_codeowners_spec.rb | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/spec/tooling/lib/tooling/find_codeowners_spec.rb b/spec/tooling/lib/tooling/find_codeowners_spec.rb index 10c2a076847..5f6f83ab2c7 100644 --- a/spec/tooling/lib/tooling/find_codeowners_spec.rb +++ b/spec/tooling/lib/tooling/find_codeowners_spec.rb @@ -11,6 +11,7 @@ RSpec.describe Tooling::FindCodeowners do allow(subject).to receive(:load_config).and_return( '[Section name]': { '@group': { + entries: %w[whatever entries], allow: { keywords: %w[dir0 file], patterns: ['/%{keyword}/**/*', '/%{keyword}'] @@ -31,8 +32,11 @@ RSpec.describe Tooling::FindCodeowners do end end.to output(<<~CODEOWNERS).to_stdout [Section name] + whatever @group + entries @group /dir0/dir1/ @group /file @group + CODEOWNERS end end @@ -57,21 +61,33 @@ RSpec.describe Tooling::FindCodeowners do patterns: ['%{keyword}'] } } + }, + '[Compliance]': { + '@gitlab-org/manage/compliance': { + entries: %w[ + /ee/app/services/audit_events/build_service.rb + ], + allow: { + patterns: %w[ + /ee/app/services/audit_events/* + ] + } + } } } ) end it 'expands the allow and deny list with keywords and patterns' do - subject.load_definitions.each do |section, group_defintions| - group_defintions.each do |group, definitions| - expect(definitions[:allow]).to be_an(Array) - expect(definitions[:deny]).to be_an(Array) - end + group_defintions = subject.load_definitions[:'[Authentication and Authorization]'] + + group_defintions.each do |group, definitions| + expect(definitions[:allow]).to be_an(Array) + expect(definitions[:deny]).to be_an(Array) end end - it 'expands the auth group' do + it 'expands the patterns for the auth group' do auth = subject.load_definitions.dig( :'[Authentication and Authorization]', :'@gitlab-org/manage/authentication-and-authorization') @@ -95,6 +111,21 @@ RSpec.describe Tooling::FindCodeowners do ] ) end + + it 'retains the array and expands the patterns for the compliance group' do + compliance = subject.load_definitions.dig( + :'[Compliance]', + :'@gitlab-org/manage/compliance') + + expect(compliance).to eq( + entries: %w[ + /ee/app/services/audit_events/build_service.rb + ], + allow: %w[ + /ee/app/services/audit_events/* + ] + ) + end end describe '#load_config' do |