/
locales_spec.rb
79 lines (71 loc) · 2.51 KB
/
locales_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
require 'spec_helper_acceptance'
require 'beaker/i18n_helper'
describe 'mysql localization', if: fact('osfamily') == 'Debian' do
before :all do
hosts.each do |host|
on(host, "sed -i \"96i FastGettext.locale='ja'\" /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb")
change_locale_on(host, 'ja_JP')
end
end
context 'when triggering puppet string warning' do
let(:pp) do
<<-EOS
class { 'mysql::server':
config_file => '/tmp/mysql.sFlJdV/my.cnf',
includedir => '/tmp/mysql.sFlJdV/include',
manage_config_file => 'true',
override_options => { 'mysqld' => { 'key_buffer_size' => '32M' }},
package_ensure => 'present',
purge_conf_dir => 'true',
remove_default_accounts => 'true',
restart => 'true',
root_group => 'root',
root_password => 'test',
old_root_password => 'kittensnmittens',
service_enabled => 'false'
}
EOS
end
it 'displays Japanese error' do
apply_manifest(pp, catch_error: true) do |r|
expect(r.stderr).to match(%r{`old_root_password`属性は廃止予定であり、今後のリリースで廃止されます。}i)
end
end
end
context 'when triggering ruby simple string warning' do
let(:pp) do
<<-EOS
mysql::db { 'mydb':
user => 'thisisalongusernametestfortoday',
password => 'mypass',
host => 'localhost',
grant => ['SELECT', 'UPDATE'],
}
EOS
end
it 'displays Japanese error' do
apply_manifest(pp, expect_failures: true) do |r|
expect(r.stderr).to match(%r{MySQLユーザ名は最大16文字に制限されています。}i)
end
end
end
context 'when triggering ruby interpolated string warning' do
let(:pp) do
<<-EOS
$password_hash = mysql_password('new_password', 'should not have second parameter')
EOS
end
it 'displays Japanese error' do
pending 'waiting on japanese translation in the po file'
apply_manifest(pp, catch_error: true) do |r|
expect(r.stderr).not_to match(%r{mysql_password(): Wrong number of arguments given (2 for 1)}i)
end
end
end
after :all do
hosts.each do |host|
on(host, 'sed -i "96d" /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb')
change_locale_on(host, 'en_US')
end
end
end