Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@
default => $facts['os']['architecture']
}
case $facts['os']['release']['major'] {
'13', '26.04': {
$openjdk = 21
}
'12', '24.04': {
$openjdk = 17
}
Expand Down
6 changes: 4 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
"operatingsystemrelease": [
"10",
"11",
"12"
"12",
"13"
]
},
{
Expand All @@ -54,7 +55,8 @@
"18.04",
"20.04",
"22.04",
"24.04"
"24.04",
"26.04"
]
},
{
Expand Down
68 changes: 62 additions & 6 deletions spec/classes/java_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,77 @@
end
end

context 'on Ubuntu Bionic (18.04)' do
let(:facts) { { os: { family: 'Debian', name: 'Ubuntu', lsb: { distcodename: 'bionic' }, release: { major: '18.04' }, architecture: 'amd64' } } }
context 'on Debian Trixie (13)' do
let(:facts) { { os: { family: 'Debian', name: 'Debian', lsb: { distcodename: 'trixie' }, release: { major: '13' }, architecture: 'amd64' } } }

context 'when selecting jdk' do
let(:params) { { 'distribution' => 'jdk' } }

it { is_expected.to contain_package('java').with_name('openjdk-11-jdk') }
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64/') }
it { is_expected.to contain_package('java').with_name('openjdk-21-jdk') }
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.21.0-openjdk-amd64/') }
end

context 'when selecting jre' do
let(:params) { { 'distribution' => 'jre' } }

it { is_expected.to contain_package('java').with_name('openjdk-11-jre-headless') }
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64/') }
it { is_expected.to contain_package('java').with_name('openjdk-21-jre-headless') }
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.21.0-openjdk-amd64/') }
end
end

['18.04', '20.04', '22.04'].each do |release|
context "on Ubuntu #{release}" do
let(:facts) { { os: { family: 'Debian', name: 'Ubuntu', release: { major: release }, architecture: 'amd64' } } }

context 'when selecting jdk' do
let(:params) { { 'distribution' => 'jdk' } }

it { is_expected.to contain_package('java').with_name('openjdk-11-jdk') }
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64/') }
end

context 'when selecting jre' do
let(:params) { { 'distribution' => 'jre' } }

it { is_expected.to contain_package('java').with_name('openjdk-11-jre-headless') }
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64/') }
end
end
end

context 'on Ubuntu 24.04' do
let(:facts) { { os: { family: 'Debian', name: 'Ubuntu', release: { major: '24.04' }, architecture: 'amd64' } } }

context 'when selecting jdk' do
let(:params) { { 'distribution' => 'jdk' } }

it { is_expected.to contain_package('java').with_name('openjdk-17-jdk') }
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.17.0-openjdk-amd64/') }
end

context 'when selecting jre' do
let(:params) { { 'distribution' => 'jre' } }

it { is_expected.to contain_package('java').with_name('openjdk-17-jre-headless') }
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.17.0-openjdk-amd64/') }
end
end

context 'on Ubuntu 26.04' do
let(:facts) { { os: { family: 'Debian', name: 'Ubuntu', release: { major: '26.04' }, architecture: 'amd64' } } }

context 'when selecting jdk' do
let(:params) { { 'distribution' => 'jdk' } }

it { is_expected.to contain_package('java').with_name('openjdk-21-jdk') }
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.21.0-openjdk-amd64/') }
end

context 'when selecting jre' do
let(:params) { { 'distribution' => 'jre' } }

it { is_expected.to contain_package('java').with_name('openjdk-21-jre-headless') }
it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.21.0-openjdk-amd64/') }
end
end

Expand Down