1 require 'spec_helper_acceptance'
2 require 'beaker/i18n_helper'
4 PUPPETLABS_GPG_KEY_LONG_ID = '7F438280EF8D349F'.freeze
5 PUPPETLABS_LONG_FINGERPRINT = '123456781274D2C8A956789A456789A456789A9A'.freeze
7 id_short_warning_pp = <<-MANIFEST
8 apt_key { 'puppetlabs':
9 id => '#{PUPPETLABS_GPG_KEY_LONG_ID}',
11 source => 'http://apt.puppetlabs.com/herpderp.gpg',
15 id_doesnt_match_fingerprint_pp = <<-MANIFEST
16 apt_key { '#{PUPPETLABS_LONG_FINGERPRINT}':
18 content => '123456781274D2C8A956789A456789A456789A9B',
22 location_not_specified_fail_pp = <<-MANIFEST
23 apt::source { 'puppetlabs':
27 id => '6F6B15509CF8E59E6E469F327F438280EF8D349F',
28 server => 'hkps.pool.sks-keyservers.net',
33 describe 'apt', if: (fact('osfamily') == 'Debian' || fact('osfamily') == 'RedHat') && (Gem::Version.new(puppet_version) >= Gem::Version.new('4.10.5')) do
36 on(host, "sed -i \"96i FastGettext.locale='ja'\" /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb")
37 change_locale_on(host, 'ja_JP.utf-8')
41 describe 'i18n translations' do
42 it 'warns with shortened id' do
43 apply_manifest(id_short_warning_pp, catch_failures: true) do |r|
44 expect(r.stderr).to match(%r{Ŧħḗ īḓ şħǿŭŀḓ ƀḗ ȧ ƒŭŀŀ ƒīƞɠḗřƥřīƞŧ})
47 it 'fails with different id and fingerprint' do
48 apply_manifest(id_doesnt_match_fingerprint_pp, expect_failures: true) do |r|
49 expect(r.stderr).to match(%r{Ŧħḗ īḓ īƞ ẏǿŭř ḿȧƞīƒḗşŧ 123456781274D2C8A956789A456789A456789A9A})
52 it 'fails with no location' do
53 apply_manifest(location_not_specified_fail_pp, expect_failures: true) do |r|
54 expect(r.stderr).to match(%r{ƈȧƞƞǿŧ ƈřḗȧŧḗ ȧ şǿŭřƈḗ ḗƞŧřẏ ẇīŧħǿŭŧ şƥḗƈīƒẏīƞɠ ȧ ŀǿƈȧŧīǿƞ})
61 on(host, 'sed -i "96d" /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb')
62 change_locale_on(host, 'en_US')