81 lines
2.4 KiB
Ruby
81 lines
2.4 KiB
Ruby
require 'spec_helper_acceptance'
|
|
|
|
java_class_jre = "class { 'java':\n"\
|
|
" distribution => 'jre',\n"\
|
|
'}'
|
|
|
|
java_class = "class { 'java': }"
|
|
|
|
_sources = "file_line { 'non-free source':\n"\
|
|
" path => '/etc/apt/sources.list',\n"\
|
|
" match => \"deb http://osmirror.delivery.puppetlabs.net/debian/ ${::lsbdistcodename} main\",\n"\
|
|
" line => \"deb http://osmirror.delivery.puppetlabs.net/debian/ ${::lsbdistcodename} main non-free\",\n"\
|
|
'}'
|
|
|
|
_sun_jre = "class { 'java':\n"\
|
|
" distribution => 'sun-jre',\n"\
|
|
'}'
|
|
|
|
_sun_jdk = "class { 'java':\n"\
|
|
" distribution => 'sun-jdk',\n"\
|
|
'}'
|
|
|
|
blank_version = "class { 'java':\n"\
|
|
" version => '',\n"\
|
|
'}'
|
|
|
|
incorrect_distro = "class { 'java':\n"\
|
|
" distribution => 'xyz',\n"\
|
|
'}'
|
|
|
|
blank_distro = "class { 'java':\n"\
|
|
" distribution => '',\n"\
|
|
'}'
|
|
|
|
incorrect_package = "class { 'java':\n"\
|
|
" package => 'xyz',\n"\
|
|
'}'
|
|
|
|
bogus_alternative = "class { 'java':\n"\
|
|
" java_alternative => 'whatever',\n"\
|
|
" java_alternative_path => '/whatever',\n"\
|
|
'}'
|
|
|
|
context 'installing java jre', unless: UNSUPPORTED_PLATFORMS.include?(os[:family]) do
|
|
it 'installs jre' do
|
|
idempotent_apply(java_class_jre)
|
|
end
|
|
end
|
|
|
|
context 'installing java jdk', unless: UNSUPPORTED_PLATFORMS.include?(os[:family]) do
|
|
it 'installs jdk' do
|
|
idempotent_apply(java_class)
|
|
end
|
|
end
|
|
|
|
context 'with failure cases' do
|
|
it 'fails to install java with a blank version' do
|
|
apply_manifest(blank_version, expect_failures: true)
|
|
end
|
|
|
|
it 'fails to install java with an incorrect distribution' do
|
|
apply_manifest(incorrect_distro, expect_failures: true)
|
|
end
|
|
|
|
it 'fails to install java with a blank distribution' do
|
|
apply_manifest(blank_distro, expect_failures: true)
|
|
end
|
|
|
|
it 'fails to install java with an incorrect package' do
|
|
apply_manifest(incorrect_package, expect_failures: true)
|
|
end
|
|
|
|
it 'fails on debian or RHEL when passed fake java_alternative and path' do
|
|
if os[:family] == 'debian' || os[:family] == 'redhat'
|
|
apply_manifest(bogus_alternative, expect_failures: true)
|
|
else
|
|
apply_manifest(bogus_alternative, catch_failures: true)
|
|
end
|
|
end
|
|
end
|