FM-6634 rubocop fixes
This commit is contained in:
@@ -1,35 +1,35 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'java', type: :class do
|
||||
context 'select openjdk for Centos 5.8' do
|
||||
context 'when select openjdk for Centos 5.8' do
|
||||
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'Centos', operatingsystemrelease: '5.8', architecture: 'x86_64' } }
|
||||
|
||||
it { is_expected.to contain_package('java').with_name('java-1.6.0-openjdk-devel') }
|
||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.6.0/') }
|
||||
end
|
||||
|
||||
context 'select openjdk for Centos 6.3' do
|
||||
context 'when select openjdk for Centos 6.3' do
|
||||
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'Centos', operatingsystemrelease: '6.3', architecture: 'x86_64' } }
|
||||
|
||||
it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk-devel') }
|
||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.7.0/') }
|
||||
end
|
||||
|
||||
context 'select openjdk for Centos 7.1.1503' do
|
||||
context 'when select openjdk for Centos 7.1.1503' do
|
||||
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'Centos', operatingsystemrelease: '7.1.1503', architecture: 'x86_64' } }
|
||||
|
||||
it { is_expected.to contain_package('java').with_name('java-1.8.0-openjdk-devel') }
|
||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.8.0/') }
|
||||
end
|
||||
|
||||
context 'select openjdk for Centos 6.2' do
|
||||
context 'when select openjdk for Centos 6.2' do
|
||||
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'Centos', operatingsystemrelease: '6.2', architecture: 'x86_64' } }
|
||||
|
||||
it { is_expected.to contain_package('java').with_name('java-1.6.0-openjdk-devel') }
|
||||
it { is_expected.not_to contain_exec('update-java-alternatives') }
|
||||
end
|
||||
|
||||
context 'select Oracle JRE with alternatives for Centos 6.3' do
|
||||
context 'when select Oracle JRE with alternatives for Centos 6.3' do
|
||||
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'Centos', operatingsystemrelease: '6.3', architecture: 'x86_64' } }
|
||||
let(:params) { { 'package' => 'jre', 'java_alternative' => '/usr/bin/java', 'java_alternative_path' => '/usr/java/jre1.7.0_67/bin/java' } }
|
||||
|
||||
@@ -38,21 +38,21 @@ describe 'java', type: :class do
|
||||
it { is_expected.to contain_exec('update-java-alternatives').with_command('alternatives --set java /usr/java/jre1.7.0_67/bin/java') }
|
||||
end
|
||||
|
||||
context 'select openjdk for Fedora 20' do
|
||||
context 'when select openjdk for Fedora 20' do
|
||||
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'Fedora', operatingsystemrelease: '20', architecture: 'x86_64' } }
|
||||
|
||||
it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk-devel') }
|
||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-x86_64/') }
|
||||
end
|
||||
|
||||
context 'select openjdk for Fedora 21' do
|
||||
context 'when select openjdk for Fedora 21' do
|
||||
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'Fedora', operatingsystemrelease: '21', architecture: 'x86_64' } }
|
||||
|
||||
it { is_expected.to contain_package('java').with_name('java-1.8.0-openjdk-devel') }
|
||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-x86_64/') }
|
||||
end
|
||||
|
||||
context 'select passed value for Fedora 20' do
|
||||
context 'when select passed value for Fedora 20' do
|
||||
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'Fedora', operatingsystemrelease: '20', architecture: 'x86_64' } }
|
||||
let(:params) { { 'distribution' => 'jre', 'java_home' => '/usr/local/lib/jre/' } }
|
||||
|
||||
@@ -60,7 +60,7 @@ describe 'java', type: :class do
|
||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/local/lib/jre/') }
|
||||
end
|
||||
|
||||
context 'select passed value for Fedora 21' do
|
||||
context 'when select passed value for Fedora 21' do
|
||||
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'Fedora', operatingsystemrelease: '21', architecture: 'x86_64' } }
|
||||
let(:params) { { 'distribution' => 'jre', 'java_home' => '/usr/local/lib/jre/' } }
|
||||
|
||||
@@ -68,14 +68,14 @@ describe 'java', type: :class do
|
||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/local/lib/jre/') }
|
||||
end
|
||||
|
||||
context 'select passed value for Fedora 21 with yum option' do
|
||||
context 'when select passed value for Fedora 21 with yum option' do
|
||||
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'Fedora', operatingsystemrelease: '21', architecture: 'x86_64' } }
|
||||
let(:params) { { 'distribution' => 'jre', 'package_options' => ['--skip-broken'] } }
|
||||
|
||||
it { is_expected.to contain_package('java') }
|
||||
end
|
||||
|
||||
context 'select passed value for Centos 5.3' do
|
||||
context 'when select passed value for Centos 5.3' do
|
||||
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'Centos', operatingsystemrelease: '5.3', architecture: 'x86_64' } }
|
||||
let(:params) { { 'package' => 'jdk', 'java_home' => '/usr/local/lib/jre' } }
|
||||
|
||||
@@ -83,14 +83,14 @@ describe 'java', type: :class do
|
||||
it { is_expected.not_to contain_exec('update-java-alternatives') }
|
||||
end
|
||||
|
||||
context 'select default for Centos 5.3' do
|
||||
context 'when select default for Centos 5.3' do
|
||||
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'Centos', operatingsystemrelease: '5.3', architecture: 'x86_64' } }
|
||||
|
||||
it { is_expected.to contain_package('java').with_name('java-1.6.0-openjdk-devel') }
|
||||
it { is_expected.not_to contain_exec('update-java-alternatives') }
|
||||
end
|
||||
|
||||
context 'select default for Debian Wheezy' do
|
||||
context 'when select default for Debian Wheezy' do
|
||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Debian', lsbdistcodename: 'wheezy', operatingsystemrelease: '7.1', architecture: 'amd64' } }
|
||||
|
||||
it { is_expected.to contain_package('java').with_name('openjdk-7-jdk') }
|
||||
@@ -98,7 +98,7 @@ describe 'java', type: :class do
|
||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64/') }
|
||||
end
|
||||
|
||||
context 'select Oracle JRE for Debian Wheezy' do
|
||||
context 'when select Oracle JRE for Debian Wheezy' do
|
||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Debian', lsbdistcodename: 'wheezy', operatingsystemrelease: '7.1', architecture: 'amd64' } }
|
||||
let(:params) { { 'distribution' => 'oracle-jre' } }
|
||||
|
||||
@@ -107,7 +107,7 @@ describe 'java', type: :class do
|
||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/j2re1.7-oracle/') }
|
||||
end
|
||||
|
||||
context 'select Oracle Java 8 JRE >=u100 for Debian Wheezy' do
|
||||
context 'when select Oracle Java 8 JRE >=u100 for Debian Wheezy' do
|
||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Debian', lsbdistcodename: 'wheezy', operatingsystemrelease: '7.1', architecture: 'amd64' } }
|
||||
let(:params) { { 'distribution' => 'oracle-java8-jre' } }
|
||||
|
||||
@@ -115,7 +115,7 @@ describe 'java', type: :class do
|
||||
it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set jre-8-oracle-x64 --jre') }
|
||||
end
|
||||
|
||||
context 'select Oracle Java 8 JDK >=u100 for Debian Wheezy' do
|
||||
context 'when select Oracle Java 8 JDK >=u100 for Debian Wheezy' do
|
||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Debian', lsbdistcodename: 'wheezy', operatingsystemrelease: '7.1', architecture: 'amd64' } }
|
||||
let(:params) { { 'distribution' => 'oracle-java8-jdk' } }
|
||||
|
||||
@@ -123,7 +123,7 @@ describe 'java', type: :class do
|
||||
it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set jdk-8-oracle-x64 --jre') }
|
||||
end
|
||||
|
||||
context 'select OpenJDK JRE for Debian Wheezy' do
|
||||
context 'when select OpenJDK JRE for Debian Wheezy' do
|
||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Debian', lsbdistcodename: 'wheezy', operatingsystemrelease: '7.1', architecture: 'amd64' } }
|
||||
let(:params) { { 'distribution' => 'jre' } }
|
||||
|
||||
@@ -132,14 +132,14 @@ describe 'java', type: :class do
|
||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64/') }
|
||||
end
|
||||
|
||||
context 'select default for Debian Squeeze' do
|
||||
context 'when select default for Debian Squeeze' do
|
||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Debian', lsbdistcodename: 'squeeze', operatingsystemrelease: '6.0.5', architecture: 'amd64' } }
|
||||
|
||||
it { is_expected.to contain_package('java').with_name('openjdk-6-jdk') }
|
||||
it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-6-openjdk-amd64 --jre') }
|
||||
end
|
||||
|
||||
context 'select Oracle JRE for Debian Squeeze' do
|
||||
context 'when select Oracle JRE for Debian Squeeze' do
|
||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Debian', lsbdistcodename: 'squeeze', operatingsystemrelease: '6.0.5', architecture: 'amd64' } }
|
||||
let(:params) { { 'distribution' => 'sun-jre' } }
|
||||
|
||||
@@ -148,7 +148,7 @@ describe 'java', type: :class do
|
||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-6-sun/jre/') }
|
||||
end
|
||||
|
||||
context 'select OpenJDK JRE for Debian Squeeze' do
|
||||
context 'when select OpenJDK JRE for Debian Squeeze' do
|
||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Debian', lsbdistcodename: 'squeeze', operatingsystemrelease: '6.0.5', architecture: 'amd64' } }
|
||||
let(:params) { { 'distribution' => 'jre' } }
|
||||
|
||||
@@ -157,7 +157,7 @@ describe 'java', type: :class do
|
||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-6-openjdk/jre/') }
|
||||
end
|
||||
|
||||
context 'select random alternative for Debian Wheezy' do
|
||||
context 'when select random alternative for Debian Wheezy' do
|
||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Debian', lsbdistcodename: 'wheezy', operatingsystemrelease: '7.1', architecture: 'amd64' } }
|
||||
let(:params) { { 'java_alternative' => 'bananafish' } }
|
||||
|
||||
@@ -165,7 +165,7 @@ describe 'java', type: :class do
|
||||
it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set bananafish --jre') }
|
||||
end
|
||||
|
||||
context 'select jdk for Ubuntu Vivid (15.04)' do
|
||||
context 'when select jdk for Ubuntu Vivid (15.04)' do
|
||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Ubuntu', lsbdistcodename: 'vivid', operatingsystemrelease: '15.04', architecture: 'amd64' } }
|
||||
let(:params) { { 'distribution' => 'jdk' } }
|
||||
|
||||
@@ -173,7 +173,7 @@ describe 'java', type: :class do
|
||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64/') }
|
||||
end
|
||||
|
||||
context 'select jre for Ubuntu Vivid (15.04)' do
|
||||
context 'when select jre for Ubuntu Vivid (15.04)' do
|
||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Ubuntu', lsbdistcodename: 'vivid', operatingsystemrelease: '15.04', architecture: 'amd64' } }
|
||||
let(:params) { { 'distribution' => 'jre' } }
|
||||
|
||||
@@ -181,40 +181,40 @@ describe 'java', type: :class do
|
||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64/') }
|
||||
end
|
||||
|
||||
context 'select openjdk for Amazon Linux' do
|
||||
context 'when select openjdk for Amazon Linux' do
|
||||
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'Amazon', operatingsystemrelease: '3.4.43-43.43.amzn1.x86_64', architecture: 'x86_64' } }
|
||||
|
||||
it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk-devel') }
|
||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-x86_64/') }
|
||||
end
|
||||
|
||||
context 'select passed value for Amazon Linux' do
|
||||
context 'when select passed value for Amazon Linux' do
|
||||
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'Amazon', operatingsystemrelease: '5.3.4.43-43.43.amzn1.x86_64', architecture: 'x86_64' } }
|
||||
let(:params) { { 'distribution' => 'jre' } }
|
||||
|
||||
it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk') }
|
||||
end
|
||||
|
||||
context 'select openjdk for Oracle Linux' do
|
||||
context 'when select openjdk for Oracle Linux' do
|
||||
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'OracleLinux', operatingsystemrelease: '6.4', architecture: 'x86_64' } }
|
||||
|
||||
it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk-devel') }
|
||||
end
|
||||
|
||||
context 'select openjdk for Oracle Linux 6.2' do
|
||||
context 'when select openjdk for Oracle Linux 6.2' do
|
||||
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'OracleLinux', operatingsystemrelease: '6.2', architecture: 'x86_64' } }
|
||||
|
||||
it { is_expected.to contain_package('java').with_name('java-1.6.0-openjdk-devel') }
|
||||
end
|
||||
|
||||
context 'select passed value for Oracle Linux' do
|
||||
context 'when select passed value for Oracle Linux' do
|
||||
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'OracleLinux', operatingsystemrelease: '6.3', architecture: 'x86_64' } }
|
||||
let(:params) { { 'distribution' => 'jre' } }
|
||||
|
||||
it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk') }
|
||||
end
|
||||
|
||||
context 'select passed value for Scientific Linux' do
|
||||
context 'when select passed value for Scientific Linux' do
|
||||
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'Scientific', operatingsystemrelease: '6.4', architecture: 'x86_64' } }
|
||||
let(:params) { { 'distribution' => 'jre' } }
|
||||
|
||||
@@ -222,7 +222,7 @@ describe 'java', type: :class do
|
||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.7.0/') }
|
||||
end
|
||||
|
||||
context 'select passed value for Scientific Linux CERN (SLC)' do
|
||||
context 'when select passed value for Scientific Linux CERN (SLC)' do
|
||||
let(:facts) { { osfamily: 'RedHat', operatingsystem: 'SLC', operatingsystemrelease: '6.4', architecture: 'x86_64' } }
|
||||
let(:params) { { 'distribution' => 'jre' } }
|
||||
|
||||
@@ -230,49 +230,49 @@ describe 'java', type: :class do
|
||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.7.0/') }
|
||||
end
|
||||
|
||||
context 'select default for OpenSUSE 12.3' do
|
||||
context 'when select default for OpenSUSE 12.3' do
|
||||
let(:facts) { { osfamily: 'Suse', operatingsystem: 'OpenSUSE', operatingsystemrelease: '12.3', architecture: 'x86_64' } }
|
||||
|
||||
it { is_expected.to contain_package('java').with_name('java-1_7_0-openjdk-devel') }
|
||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib64/jvm/java-1.7.0-openjdk-1.7.0/') }
|
||||
end
|
||||
|
||||
context 'select default for SLES 11.3' do
|
||||
context 'when select default for SLES 11.3' do
|
||||
let(:facts) { { osfamily: 'Suse', operatingsystem: 'SLES', operatingsystemrelease: '11.3', architecture: 'x86_64' } }
|
||||
|
||||
it { is_expected.to contain_package('java').with_name('java-1_6_0-ibm-devel') }
|
||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib64/jvm/java-1.6.0-ibm-1.6.0/') }
|
||||
end
|
||||
|
||||
context 'select default for SLES 11.4' do
|
||||
context 'when select default for SLES 11.4' do
|
||||
let(:facts) { { osfamily: 'Suse', operatingsystem: 'SLES', operatingsystemrelease: '11.4', architecture: 'x86_64' } }
|
||||
|
||||
it { is_expected.to contain_package('java').with_name('java-1_7_1-ibm-devel') }
|
||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib64/jvm/java-1.7.0-ibm-1.7.0/') }
|
||||
end
|
||||
|
||||
context 'select default for SLES 12.0' do
|
||||
context 'when select default for SLES 12.0' do
|
||||
let(:facts) { { osfamily: 'Suse', operatingsystem: 'SLES', operatingsystemrelease: '12.0', operatingsystemmajrelease: '12', architecture: 'x86_64' } }
|
||||
|
||||
it { is_expected.to contain_package('java').with_name('java-1_7_0-openjdk-devel') }
|
||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib64/jvm/java-1.7.0-openjdk-1.7.0/') }
|
||||
end
|
||||
|
||||
context 'select default for SLES 12.1' do
|
||||
context 'when select default for SLES 12.1' do
|
||||
let(:facts) { { osfamily: 'Suse', operatingsystem: 'SLES', operatingsystemrelease: '12.1', operatingsystemmajrelease: '12', architecture: 'x86_64' } }
|
||||
|
||||
it { is_expected.to contain_package('java').with_name('java-1_8_0-openjdk-devel') }
|
||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/') }
|
||||
end
|
||||
|
||||
context 'select jdk for OpenBSD' do
|
||||
context 'when select jdk for OpenBSD' do
|
||||
let(:facts) { { osfamily: 'OpenBSD', architecture: 'x86_64' } }
|
||||
|
||||
it { is_expected.to contain_package('java').with_name('jdk') }
|
||||
it { is_expected.not_to contain_file_line('java-home-environment') }
|
||||
end
|
||||
|
||||
context 'select jre for OpenBSD' do
|
||||
context 'when select jre for OpenBSD' do
|
||||
let(:facts) { { osfamily: 'OpenBSD', architecture: 'x86_64' } }
|
||||
let(:params) { { 'distribution' => 'jre' } }
|
||||
|
||||
@@ -282,7 +282,7 @@ describe 'java', type: :class do
|
||||
describe 'custom java package' do
|
||||
let(:facts) { { osfamily: 'Debian', operatingsystem: 'Debian', lsbdistcodename: 'jessie', operatingsystemrelease: '8.6', architecture: 'amd64' } }
|
||||
|
||||
context 'all params provided' do
|
||||
context 'when all params provided' do
|
||||
let(:params) do
|
||||
{
|
||||
'distribution' => 'custom',
|
||||
@@ -297,7 +297,7 @@ describe 'java', type: :class do
|
||||
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/opt/custom_jdk') }
|
||||
it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-custom_jdk --jre') }
|
||||
end
|
||||
context 'missing parameters' do
|
||||
context 'with missing parameters' do
|
||||
let(:params) do
|
||||
{
|
||||
'distribution' => 'custom',
|
||||
|
||||
Reference in New Issue
Block a user