Merge pull request #166 from alexharv074/fix_rspec_deprecation_warnings

Fix up rspec deprecation warnings.
This commit is contained in:
TP Honey
2016-04-13 07:42:54 +01:00
5 changed files with 73 additions and 73 deletions

View File

@@ -4,181 +4,181 @@ describe 'java', :type => :class do
context 'select openjdk for Centos 5.8' do context 'select openjdk for Centos 5.8' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.8'} } let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.8'} }
it { should contain_package('java').with_name('java-1.6.0-openjdk-devel') } it { is_expected.to contain_package('java').with_name('java-1.6.0-openjdk-devel') }
end end
context 'select openjdk for Centos 6.3' do context 'select openjdk for Centos 6.3' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '6.3'} } let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '6.3'} }
it { should contain_package('java').with_name('java-1.7.0-openjdk-devel') } it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk-devel') }
end end
context 'select openjdk for Centos 7.1.1503' do context 'select openjdk for Centos 7.1.1503' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '7.1.1503'} } let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '7.1.1503'} }
it { should contain_package('java').with_name('java-1.8.0-openjdk-devel') } it { is_expected.to contain_package('java').with_name('java-1.8.0-openjdk-devel') }
end end
context 'select openjdk for Centos 6.2' do context 'select openjdk for Centos 6.2' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '6.2'} } let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '6.2'} }
it { should contain_package('java').with_name('java-1.6.0-openjdk-devel') } it { is_expected.to contain_package('java').with_name('java-1.6.0-openjdk-devel') }
it { should_not contain_exec('update-java-alternatives') } it { is_expected.to_not contain_exec('update-java-alternatives') }
end end
context 'select Oracle JRE with alternatives for Centos 6.3' do context 'select Oracle JRE with alternatives for Centos 6.3' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '6.3'} } let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '6.3'} }
let(:params) { { 'package' => 'jre', 'java_alternative' => '/usr/bin/java', 'java_alternative_path' => '/usr/java/jre1.7.0_67/bin/java'} } let(:params) { { 'package' => 'jre', 'java_alternative' => '/usr/bin/java', 'java_alternative_path' => '/usr/java/jre1.7.0_67/bin/java'} }
it { should contain_package('java').with_name('jre') } it { is_expected.to contain_package('java').with_name('jre') }
it { should contain_exec('create-java-alternatives').with_command('alternatives --install /usr/bin/java java /usr/java/jre1.7.0_67/bin/java 20000') } it { is_expected.to contain_exec('create-java-alternatives').with_command('alternatives --install /usr/bin/java java /usr/java/jre1.7.0_67/bin/java 20000') }
it { should contain_exec('update-java-alternatives').with_command('alternatives --set java /usr/java/jre1.7.0_67/bin/java') } it { is_expected.to contain_exec('update-java-alternatives').with_command('alternatives --set java /usr/java/jre1.7.0_67/bin/java') }
end end
context 'select openjdk for Fedora 20' do context 'select openjdk for Fedora 20' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '20'} } let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '20'} }
it { should contain_package('java').with_name('java-1.7.0-openjdk-devel') } it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk-devel') }
end end
context 'select openjdk for Fedora 21' do context 'select openjdk for Fedora 21' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '21'} } let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '21'} }
it { should contain_package('java').with_name('java-1.8.0-openjdk-devel') } it { is_expected.to contain_package('java').with_name('java-1.8.0-openjdk-devel') }
end end
context 'select passed value for Fedora 20' do context 'select passed value for Fedora 20' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '20'} } let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '20'} }
let(:params) { { 'distribution' => 'jre' } } let(:params) { { 'distribution' => 'jre' } }
it { should contain_package('java').with_name('java-1.7.0-openjdk') } it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk') }
end end
context 'select passed value for Fedora 21' do context 'select passed value for Fedora 21' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '21'} } let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '21'} }
let(:params) { { 'distribution' => 'jre' } } let(:params) { { 'distribution' => 'jre' } }
it { should contain_package('java').with_name('java-1.8.0-openjdk') } it { is_expected.to contain_package('java').with_name('java-1.8.0-openjdk') }
end end
context 'select passed value for Fedora 21 with yum option' do context 'select passed value for Fedora 21 with yum option' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '21'} } let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '21'} }
let(:params) { { 'distribution' => 'jre' } } let(:params) { { 'distribution' => 'jre' } }
let(:params) { { 'package_options' => ['--skip-broken'] } } let(:params) { { 'package_options' => ['--skip-broken'] } }
it { should contain_package('java') } it { is_expected.to contain_package('java') }
end end
context 'select passed value for Centos 5.3' do context 'select passed value for Centos 5.3' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.3'} } let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.3'} }
let(:params) { { 'package' => 'jdk' } } let(:params) { { 'package' => 'jdk' } }
it { should contain_package('java').with_name('jdk') } it { is_expected.to contain_package('java').with_name('jdk') }
it { should_not contain_exec('update-java-alternatives') } it { is_expected.to_not contain_exec('update-java-alternatives') }
end end
context 'select default for Centos 5.3' do context 'select default for Centos 5.3' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.3'} } let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.3'} }
it { should contain_package('java').with_name('java-1.6.0-openjdk-devel') } it { is_expected.to contain_package('java').with_name('java-1.6.0-openjdk-devel') }
it { should_not contain_exec('update-java-alternatives') } it { is_expected.to_not contain_exec('update-java-alternatives') }
end end
context 'select default for Debian Wheezy' do context 'select default for Debian Wheezy' do
let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'wheezy', :operatingsystemrelease => '7.1', :architecture => 'amd64',} } let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'wheezy', :operatingsystemrelease => '7.1', :architecture => 'amd64',} }
it { should contain_package('java').with_name('openjdk-7-jdk') } it { is_expected.to contain_package('java').with_name('openjdk-7-jdk') }
it { should contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-1.7.0-openjdk-amd64 --jre') } it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-1.7.0-openjdk-amd64 --jre') }
end end
context 'select Oracle JRE for Debian Wheezy' do context 'select Oracle JRE for Debian Wheezy' do
let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'wheezy', :operatingsystemrelease => '7.1', :architecture => 'amd64',} } let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'wheezy', :operatingsystemrelease => '7.1', :architecture => 'amd64',} }
let(:params) { { 'distribution' => 'oracle-jre' } } let(:params) { { 'distribution' => 'oracle-jre' } }
it { should contain_package('java').with_name('oracle-j2re1.7') } it { is_expected.to contain_package('java').with_name('oracle-j2re1.7') }
it { should contain_exec('update-java-alternatives').with_command('update-java-alternatives --set j2re1.7-oracle --jre') } it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set j2re1.7-oracle --jre') }
end end
context 'select OpenJDK JRE for Debian Wheezy' do context 'select OpenJDK JRE for Debian Wheezy' do
let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'wheezy', :operatingsystemrelease => '7.1', :architecture => 'amd64',} } let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'wheezy', :operatingsystemrelease => '7.1', :architecture => 'amd64',} }
let(:params) { { 'distribution' => 'jre' } } let(:params) { { 'distribution' => 'jre' } }
it { should contain_package('java').with_name('openjdk-7-jre-headless') } it { is_expected.to contain_package('java').with_name('openjdk-7-jre-headless') }
it { should contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-1.7.0-openjdk-amd64 --jre-headless') } it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-1.7.0-openjdk-amd64 --jre-headless') }
end end
context 'select default for Debian Squeeze' do context 'select default for Debian Squeeze' do
let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'squeeze', :operatingsystemrelease => '6.0.5', :architecture => 'amd64',} } let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'squeeze', :operatingsystemrelease => '6.0.5', :architecture => 'amd64',} }
it { should contain_package('java').with_name('openjdk-6-jdk') } it { is_expected.to contain_package('java').with_name('openjdk-6-jdk') }
it { should contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-6-openjdk-amd64 --jre') } it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-6-openjdk-amd64 --jre') }
end end
context 'select Oracle JRE for Debian Squeeze' do context 'select Oracle JRE for Debian Squeeze' do
let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'squeeze', :operatingsystemrelease => '6.0.5', :architecture => 'amd64',} } let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'squeeze', :operatingsystemrelease => '6.0.5', :architecture => 'amd64',} }
let(:params) { { 'distribution' => 'sun-jre', } } let(:params) { { 'distribution' => 'sun-jre', } }
it { should contain_package('java').with_name('sun-java6-jre') } it { is_expected.to contain_package('java').with_name('sun-java6-jre') }
it { should contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-6-sun --jre') } it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-6-sun --jre') }
end end
context 'select OpenJDK JRE for Debian Squeeze' do context 'select OpenJDK JRE for Debian Squeeze' do
let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'squeeze', :operatingsystemrelease => '6.0.5', :architecture => 'amd64',} } let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'squeeze', :operatingsystemrelease => '6.0.5', :architecture => 'amd64',} }
let(:params) { { 'distribution' => 'jre', } } let(:params) { { 'distribution' => 'jre', } }
it { should contain_package('java').with_name('openjdk-6-jre-headless') } it { is_expected.to contain_package('java').with_name('openjdk-6-jre-headless') }
it { should contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-6-openjdk-amd64 --jre-headless') } it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-6-openjdk-amd64 --jre-headless') }
end end
context 'select random alternative for Debian Wheezy' do context 'select random alternative for Debian Wheezy' do
let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'wheezy', :operatingsystemrelease => '7.1', :architecture => 'amd64',} } let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'wheezy', :operatingsystemrelease => '7.1', :architecture => 'amd64',} }
let(:params) { { 'java_alternative' => 'bananafish' } } let(:params) { { 'java_alternative' => 'bananafish' } }
it { should contain_package('java').with_name('openjdk-7-jdk') } it { is_expected.to contain_package('java').with_name('openjdk-7-jdk') }
it { should contain_exec('update-java-alternatives').with_command('update-java-alternatives --set bananafish --jre') } it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set bananafish --jre') }
end end
context 'select jdk for Ubuntu Vivid (15.04)' do context 'select jdk for Ubuntu Vivid (15.04)' do
let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Ubuntu', :lsbdistcodename => 'vivid', :operatingsystemrelease => '15.04', :architecture => 'amd64',} } let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Ubuntu', :lsbdistcodename => 'vivid', :operatingsystemrelease => '15.04', :architecture => 'amd64',} }
let(:params) { { 'distribution' => 'jdk' } } let(:params) { { 'distribution' => 'jdk' } }
it { should contain_package('java').with_name('openjdk-8-jdk') } it { is_expected.to contain_package('java').with_name('openjdk-8-jdk') }
end end
context 'select jre for Ubuntu Vivid (15.04)' do context 'select jre for Ubuntu Vivid (15.04)' do
let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Ubuntu', :lsbdistcodename => 'vivid', :operatingsystemrelease => '15.04', :architecture => 'amd64',} } let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Ubuntu', :lsbdistcodename => 'vivid', :operatingsystemrelease => '15.04', :architecture => 'amd64',} }
let(:params) { { 'distribution' => 'jre' } } let(:params) { { 'distribution' => 'jre' } }
it { should contain_package('java').with_name('openjdk-8-jre-headless') } it { is_expected.to contain_package('java').with_name('openjdk-8-jre-headless') }
end end
context 'select openjdk for Amazon Linux' do context 'select openjdk for Amazon Linux' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Amazon', :operatingsystemrelease => '3.4.43-43.43.amzn1.x86_64'} } let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Amazon', :operatingsystemrelease => '3.4.43-43.43.amzn1.x86_64'} }
it { should contain_package('java').with_name('java-1.7.0-openjdk-devel') } it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk-devel') }
end end
context 'select passed value for Amazon Linux' do context 'select passed value for Amazon Linux' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Amazon', :operatingsystemrelease => '5.3.4.43-43.43.amzn1.x86_64'} } let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Amazon', :operatingsystemrelease => '5.3.4.43-43.43.amzn1.x86_64'} }
let(:params) { { 'distribution' => 'jre' } } let(:params) { { 'distribution' => 'jre' } }
it { should contain_package('java').with_name('java-1.7.0-openjdk') } it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk') }
end end
context 'select openjdk for Oracle Linux' do context 'select openjdk for Oracle Linux' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'OracleLinux', :operatingsystemrelease => '6.4'} } let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'OracleLinux', :operatingsystemrelease => '6.4'} }
it { should contain_package('java').with_name('java-1.7.0-openjdk-devel') } it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk-devel') }
end end
context 'select openjdk for Oracle Linux 6.2' do context 'select openjdk for Oracle Linux 6.2' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'OracleLinux', :operatingsystemrelease => '6.2'} } let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'OracleLinux', :operatingsystemrelease => '6.2'} }
it { should contain_package('java').with_name('java-1.6.0-openjdk-devel') } it { is_expected.to contain_package('java').with_name('java-1.6.0-openjdk-devel') }
end end
context 'select passed value for Oracle Linux' do context 'select passed value for Oracle Linux' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'OracleLinux', :operatingsystemrelease => '6.3'} } let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'OracleLinux', :operatingsystemrelease => '6.3'} }
let(:params) { { 'distribution' => 'jre' } } let(:params) { { 'distribution' => 'jre' } }
it { should contain_package('java').with_name('java-1.7.0-openjdk') } it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk') }
end end
context 'select passed value for Scientific Linux' do context 'select passed value for Scientific Linux' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Scientific', :operatingsystemrelease => '6.4'} } let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Scientific', :operatingsystemrelease => '6.4'} }
let(:params) { { 'distribution' => 'jre' } } let(:params) { { 'distribution' => 'jre' } }
it { should contain_package('java').with_name('java-1.7.0-openjdk') } it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk') }
end end
context 'select default for OpenSUSE 12.3' do context 'select default for OpenSUSE 12.3' do
let(:facts) { {:osfamily => 'Suse', :operatingsystem => 'OpenSUSE', :operatingsystemrelease => '12.3'}} let(:facts) { {:osfamily => 'Suse', :operatingsystem => 'OpenSUSE', :operatingsystemrelease => '12.3'}}
it { should contain_package('java').with_name('java-1_7_0-openjdk-devel')} it { is_expected.to contain_package('java').with_name('java-1_7_0-openjdk-devel')}
end end
context 'select jdk for OpenBSD' do context 'select jdk for OpenBSD' do
let(:facts) { {:osfamily => 'OpenBSD'} } let(:facts) { {:osfamily => 'OpenBSD'} }
it { should contain_package('java').with_name('jdk') } it { is_expected.to contain_package('java').with_name('jdk') }
end end
context 'select jre for OpenBSD' do context 'select jre for OpenBSD' do
let(:facts) { {:osfamily => 'OpenBSD'} } let(:facts) { {:osfamily => 'OpenBSD'} }
let(:params) { { 'distribution' => 'jre' } } let(:params) { { 'distribution' => 'jre' } }
it { should contain_package('java').with_name('jre') } it { is_expected.to contain_package('java').with_name('jre') }
end end
describe 'incompatible OSs' do describe 'incompatible OSs' do
@@ -215,7 +215,7 @@ describe 'java', :type => :class do
}, },
].each do |facts| ].each do |facts|
let(:facts) { facts } let(:facts) { facts }
it "should fail on #{facts[:operatingsystem]} #{facts[:operatingsystemrelease]}" do it "is_expected.to fail on #{facts[:operatingsystem]} #{facts[:operatingsystemrelease]}" do
expect { catalogue }.to raise_error Puppet::Error, /unsupported platform/ expect { catalogue }.to raise_error Puppet::Error, /unsupported platform/
end end
end end

View File

@@ -7,43 +7,43 @@ describe 'java::oracle', :type => :define do
context 'Oracle Java SE 6 JDK' do context 'Oracle Java SE 6 JDK' do
let(:params) { {:ensure => 'present', :version => '6', :java_se => 'jdk'} } let(:params) { {:ensure => 'present', :version => '6', :java_se => 'jdk'} }
let :title do 'jdk6' end let :title do 'jdk6' end
it { should contain_archive('/tmp/jdk-6u45-linux-x64-rpm.bin')} it { is_expected.to contain_archive('/tmp/jdk-6u45-linux-x64-rpm.bin')}
it { should contain_exec('Install Oracle java_se jdk 6').with_command('sh /tmp/jdk-6u45-linux-x64-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jdk*.rpm') } it { is_expected.to contain_exec('Install Oracle java_se jdk 6').with_command('sh /tmp/jdk-6u45-linux-x64-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jdk*.rpm') }
end end
context 'Oracle Java SE 7 JDK' do context 'Oracle Java SE 7 JDK' do
let(:params) { {:ensure => 'present', :version => '7', :java_se => 'jdk'} } let(:params) { {:ensure => 'present', :version => '7', :java_se => 'jdk'} }
let :title do 'jdk7' end let :title do 'jdk7' end
it { should contain_archive('/tmp/jdk-7u80-linux-x64.rpm')} it { is_expected.to contain_archive('/tmp/jdk-7u80-linux-x64.rpm')}
it { should contain_exec('Install Oracle java_se jdk 7').with_command('rpm --force -iv /tmp/jdk-7u80-linux-x64.rpm') } it { is_expected.to contain_exec('Install Oracle java_se jdk 7').with_command('rpm --force -iv /tmp/jdk-7u80-linux-x64.rpm') }
end end
context 'Oracle Java SE 8 JDK' do context 'Oracle Java SE 8 JDK' do
let(:params) { {:ensure => 'present', :version => '8', :java_se => 'jdk'} } let(:params) { {:ensure => 'present', :version => '8', :java_se => 'jdk'} }
let :title do 'jdk8' end let :title do 'jdk8' end
it { should contain_archive('/tmp/jdk-8u51-linux-x64.rpm')} it { is_expected.to contain_archive('/tmp/jdk-8u51-linux-x64.rpm')}
it { should contain_exec('Install Oracle java_se jdk 8').with_command('rpm --force -iv /tmp/jdk-8u51-linux-x64.rpm') } it { is_expected.to contain_exec('Install Oracle java_se jdk 8').with_command('rpm --force -iv /tmp/jdk-8u51-linux-x64.rpm') }
end end
context 'Oracle Java SE 6 JRE' do context 'Oracle Java SE 6 JRE' do
let(:params) { {:ensure => 'present', :version => '6', :java_se => 'jre'} } let(:params) { {:ensure => 'present', :version => '6', :java_se => 'jre'} }
let :title do 'jre6' end let :title do 'jre6' end
it { should contain_archive('/tmp/jre-6u45-linux-x64-rpm.bin')} it { is_expected.to contain_archive('/tmp/jre-6u45-linux-x64-rpm.bin')}
it { should contain_exec('Install Oracle java_se jre 6').with_command('sh /tmp/jre-6u45-linux-x64-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jre*.rpm') } it { is_expected.to contain_exec('Install Oracle java_se jre 6').with_command('sh /tmp/jre-6u45-linux-x64-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jre*.rpm') }
end end
context 'Oracle Java SE 7 JRE' do context 'Oracle Java SE 7 JRE' do
let(:params) { {:ensure => 'present', :version => '7', :java_se => 'jre'} } let(:params) { {:ensure => 'present', :version => '7', :java_se => 'jre'} }
let :title do 'jre7' end let :title do 'jre7' end
it { should contain_archive('/tmp/jre-7u80-linux-x64.rpm')} it { is_expected.to contain_archive('/tmp/jre-7u80-linux-x64.rpm')}
it { should contain_exec('Install Oracle java_se jre 7').with_command('rpm --force -iv /tmp/jre-7u80-linux-x64.rpm') } it { is_expected.to contain_exec('Install Oracle java_se jre 7').with_command('rpm --force -iv /tmp/jre-7u80-linux-x64.rpm') }
end end
context 'select Oracle Java SE 8 JRE' do context 'select Oracle Java SE 8 JRE' do
let(:params) { {:ensure => 'present', :version => '8', :java_se => 'jre'} } let(:params) { {:ensure => 'present', :version => '8', :java_se => 'jre'} }
let :title do 'jre8' end let :title do 'jre8' end
it { should contain_archive('/tmp/jre-8u51-linux-x64.rpm')} it { is_expected.to contain_archive('/tmp/jre-8u51-linux-x64.rpm')}
it { should contain_exec('Install Oracle java_se jre 8').with_command('rpm --force -iv /tmp/jre-8u51-linux-x64.rpm') } it { is_expected.to contain_exec('Install Oracle java_se jre 8').with_command('rpm --force -iv /tmp/jre-8u51-linux-x64.rpm') }
end end
end end
@@ -54,43 +54,43 @@ describe 'java::oracle', :type => :define do
context 'select Oracle Java SE 6 JDK on RedHat family, 32-bit' do context 'select Oracle Java SE 6 JDK on RedHat family, 32-bit' do
let(:params) { {:ensure => 'present', :version => '6', :java_se => 'jdk'} } let(:params) { {:ensure => 'present', :version => '6', :java_se => 'jdk'} }
let :title do 'jdk6' end let :title do 'jdk6' end
it { should contain_archive('/tmp/jdk-6u45-linux-i586-rpm.bin')} it { is_expected.to contain_archive('/tmp/jdk-6u45-linux-i586-rpm.bin')}
it { should contain_exec('Install Oracle java_se jdk 6').with_command('sh /tmp/jdk-6u45-linux-i586-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jdk*.rpm') } it { is_expected.to contain_exec('Install Oracle java_se jdk 6').with_command('sh /tmp/jdk-6u45-linux-i586-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jdk*.rpm') }
end end
context 'select Oracle Java SE 7 JDK on RedHat family, 32-bit' do context 'select Oracle Java SE 7 JDK on RedHat family, 32-bit' do
let(:params) { {:ensure => 'present', :version => '7', :java_se => 'jdk'} } let(:params) { {:ensure => 'present', :version => '7', :java_se => 'jdk'} }
let :title do 'jdk7' end let :title do 'jdk7' end
it { should contain_archive('/tmp/jdk-7u80-linux-i586.rpm')} it { is_expected.to contain_archive('/tmp/jdk-7u80-linux-i586.rpm')}
it { should contain_exec('Install Oracle java_se jdk 7').with_command('rpm --force -iv /tmp/jdk-7u80-linux-i586.rpm') } it { is_expected.to contain_exec('Install Oracle java_se jdk 7').with_command('rpm --force -iv /tmp/jdk-7u80-linux-i586.rpm') }
end end
context 'select Oracle Java SE 8 JDK on RedHat family, 32-bit' do context 'select Oracle Java SE 8 JDK on RedHat family, 32-bit' do
let(:params) { {:ensure => 'present', :version => '8', :java_se => 'jdk'} } let(:params) { {:ensure => 'present', :version => '8', :java_se => 'jdk'} }
let :title do 'jdk8' end let :title do 'jdk8' end
it { should contain_archive('/tmp/jdk-8u51-linux-i586.rpm')} it { is_expected.to contain_archive('/tmp/jdk-8u51-linux-i586.rpm')}
it { should contain_exec('Install Oracle java_se jdk 8').with_command('rpm --force -iv /tmp/jdk-8u51-linux-i586.rpm') } it { is_expected.to contain_exec('Install Oracle java_se jdk 8').with_command('rpm --force -iv /tmp/jdk-8u51-linux-i586.rpm') }
end end
context 'select Oracle Java SE 6 JRE on RedHat family, 32-bit' do context 'select Oracle Java SE 6 JRE on RedHat family, 32-bit' do
let(:params) { {:ensure => 'present', :version => '6', :java_se => 'jre'} } let(:params) { {:ensure => 'present', :version => '6', :java_se => 'jre'} }
let :title do 'jdk6' end let :title do 'jdk6' end
it { should contain_archive('/tmp/jre-6u45-linux-i586-rpm.bin')} it { is_expected.to contain_archive('/tmp/jre-6u45-linux-i586-rpm.bin')}
it { should contain_exec('Install Oracle java_se jre 6').with_command('sh /tmp/jre-6u45-linux-i586-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jre*.rpm') } it { is_expected.to contain_exec('Install Oracle java_se jre 6').with_command('sh /tmp/jre-6u45-linux-i586-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jre*.rpm') }
end end
context 'select Oracle Java SE 7 JRE on RedHat family, 32-bit' do context 'select Oracle Java SE 7 JRE on RedHat family, 32-bit' do
let(:params) { {:ensure => 'present', :version => '7', :java_se => 'jre'} } let(:params) { {:ensure => 'present', :version => '7', :java_se => 'jre'} }
let :title do 'jdk7' end let :title do 'jdk7' end
it { should contain_archive('/tmp/jre-7u80-linux-i586.rpm')} it { is_expected.to contain_archive('/tmp/jre-7u80-linux-i586.rpm')}
it { should contain_exec('Install Oracle java_se jre 7').with_command('rpm --force -iv /tmp/jre-7u80-linux-i586.rpm') } it { is_expected.to contain_exec('Install Oracle java_se jre 7').with_command('rpm --force -iv /tmp/jre-7u80-linux-i586.rpm') }
end end
context 'select Oracle Java SE 8 JRE on RedHat family, 32-bit' do context 'select Oracle Java SE 8 JRE on RedHat family, 32-bit' do
let(:params) { {:ensure => 'present', :version => '8', :java_se => 'jre'} } let(:params) { {:ensure => 'present', :version => '8', :java_se => 'jre'} }
let :title do 'jdk8' end let :title do 'jdk8' end
it { should contain_archive('/tmp/jre-8u51-linux-i586.rpm')} it { is_expected.to contain_archive('/tmp/jre-8u51-linux-i586.rpm')}
it { should contain_exec('Install Oracle java_se jre 8').with_command('rpm --force -iv /tmp/jre-8u51-linux-i586.rpm') } it { is_expected.to contain_exec('Install Oracle java_se jre 8').with_command('rpm --force -iv /tmp/jre-8u51-linux-i586.rpm') }
end end
end end
@@ -134,7 +134,7 @@ describe 'java::oracle', :type => :define do
].each do |facts| ].each do |facts|
let(:facts) { facts } let(:facts) { facts }
let :title do 'jdk' end let :title do 'jdk' end
it "should fail on #{facts[:operatingsystem]} #{facts[:operatingsystemrelease]}" do it "is_expected.to fail on #{facts[:operatingsystem]} #{facts[:operatingsystemrelease]}" do
expect { catalogue }.to raise_error Puppet::Error, /unsupported platform/ expect { catalogue }.to raise_error Puppet::Error, /unsupported platform/
end end
end end

View File

@@ -14,7 +14,7 @@ describe Facter::Util::Fact do
EOS EOS
Facter::Util::Resolution.expects(:which).with("readlink").returns(true) Facter::Util::Resolution.expects(:which).with("readlink").returns(true)
Facter::Util::Resolution.expects(:exec).with("readlink -e /usr/bin/java").returns(java_path_output) Facter::Util::Resolution.expects(:exec).with("readlink -e /usr/bin/java").returns(java_path_output)
Facter.value(:java_default_home).should == "/usr/lib/jvm/java-7-openjdk-amd64" expect(Facter.value(:java_default_home)).to eql "/usr/lib/jvm/java-7-openjdk-amd64"
end end
end end
@@ -22,7 +22,7 @@ describe Facter::Util::Fact do
it do it do
Facter::Util::Resolution.stubs(:exec) Facter::Util::Resolution.stubs(:exec)
Facter::Util::Resolution.expects(:which).with("readlink").at_least(1).returns(false) Facter::Util::Resolution.expects(:which).with("readlink").at_least(1).returns(false)
Facter.value(:java_default_home).should be_nil expect(Facter.value(:java_default_home)).to be_nil
end end
end end
end end

View File

@@ -13,7 +13,7 @@ describe Facter::Util::Fact do
context 'returns libjvm path' do context 'returns libjvm path' do
context 'on Linux' do context 'on Linux' do
it do it do
Facter.value(:java_libjvm_path).should == "/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server" expect(Facter.value(:java_libjvm_path)).to eql "/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server"
end end
end end
end end

View File

@@ -36,7 +36,7 @@ Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
EOS EOS
Facter::Util::Resolution.expects(:exec).with("/usr/libexec/java_home --failfast 2>&1").returns("/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home") Facter::Util::Resolution.expects(:exec).with("/usr/libexec/java_home --failfast 2>&1").returns("/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home")
Facter::Util::Resolution.expects(:exec).with("java -Xmx8m -version 2>&1").returns(java_version_output) Facter::Util::Resolution.expects(:exec).with("java -Xmx8m -version 2>&1").returns(java_version_output)
Facter.value(:java_version).should == "1.7.0_71" expect(Facter.value(:java_version)).to eql "1.7.0_71"
end end
end end
context 'on other systems' do context 'on other systems' do
@@ -74,7 +74,7 @@ Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
let(:facts) { {:operatingsystem => 'Darwin'} } let(:facts) { {:operatingsystem => 'Darwin'} }
it do it do
Facter::Util::Resolution.expects(:exec).at_least(1).with("/usr/libexec/java_home --failfast 2>&1").returns('Unable to find any JVMs matching version "(null)".') Facter::Util::Resolution.expects(:exec).at_least(1).with("/usr/libexec/java_home --failfast 2>&1").returns('Unable to find any JVMs matching version "(null)".')
Facter.value(:java_version).should be_nil expect(Facter.value(:java_version)).to be_nil
end end
end end
context 'on other systems' do context 'on other systems' do