Skip to content

Commit

Permalink
[PE-37978]: Add 'amazon' to repo_filename method with tests
Browse files Browse the repository at this point in the history
  • Loading branch information
span786 committed Mar 22, 2024
1 parent da86e2f commit b8b92d6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/beaker/host/unix/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def repo_filename(package_name, build_version)
repo_filename = format("pl-%s-%s-", package_name, build_version)

case variant
when /fedora|el|redhat|centos|cisco_nexus|cisco_ios_xr|opensuse|sles/
when /amazon|fedora|el|redhat|centos|cisco_nexus|cisco_ios_xr|opensuse|sles/
variant = 'el' if %w[centos redhat].include?(variant)

variant = 'redhatfips' if self['packaging_platform']&.include?('redhatfips')
Expand Down
8 changes: 8 additions & 0 deletions spec/beaker/host/unix/file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ def to_s
expect(filename).to be === correct
end

it 'builds the filename correctly for amazon-based platforms' do
@platform = 'amazon-2023-x86_64'
allow( instance ).to receive( :is_pe? ).and_return(true)

Check failure on line 138 in spec/beaker/host/unix/file_spec.rb

View workflow job for this annotation

GitHub Actions / rubocop

Layout/SpaceInsideParens: Space inside parentheses detected. (https://rubystyle.guide#spaces-braces)

Check failure on line 138 in spec/beaker/host/unix/file_spec.rb

View workflow job for this annotation

GitHub Actions / rubocop

Layout/SpaceInsideParens: Space inside parentheses detected. (https://rubystyle.guide#spaces-braces)

Check failure on line 138 in spec/beaker/host/unix/file_spec.rb

View workflow job for this annotation

GitHub Actions / rubocop

Layout/SpaceInsideParens: Space inside parentheses detected. (https://rubystyle.guide#spaces-braces)

Check failure on line 138 in spec/beaker/host/unix/file_spec.rb

View workflow job for this annotation

GitHub Actions / rubocop

Layout/SpaceInsideParens: Space inside parentheses detected. (https://rubystyle.guide#spaces-braces)
filename = instance.repo_filename( 'pkg_name', 'pkg_version' )

Check failure on line 139 in spec/beaker/host/unix/file_spec.rb

View workflow job for this annotation

GitHub Actions / rubocop

Layout/SpaceInsideParens: Space inside parentheses detected. (https://rubystyle.guide#spaces-braces)

Check failure on line 139 in spec/beaker/host/unix/file_spec.rb

View workflow job for this annotation

GitHub Actions / rubocop

Layout/SpaceInsideParens: Space inside parentheses detected. (https://rubystyle.guide#spaces-braces)
correct = 'pl-pkg_name-pkg_version-amazon-2023-x86_64.repo'
expect( filename ).to be === correct

Check failure on line 141 in spec/beaker/host/unix/file_spec.rb

View workflow job for this annotation

GitHub Actions / rubocop

Layout/SpaceInsideParens: Space inside parentheses detected. (https://rubystyle.guide#spaces-braces)

Check failure on line 141 in spec/beaker/host/unix/file_spec.rb

View workflow job for this annotation

GitHub Actions / rubocop

Layout/SpaceInsideParens: Space inside parentheses detected. (https://rubystyle.guide#spaces-braces)
end

it 'builds the filename correctly for debian-based platforms' do
@platform = 'debian-8-x86_64'
filename = instance.repo_filename('pkg_name', 'pkg_version10')
Expand Down

0 comments on commit b8b92d6

Please sign in to comment.