diff --git a/manifests/params.pp b/manifests/params.pp index 708d3e6f..6061b0e5 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -58,6 +58,9 @@ default => $facts['os']['architecture'] } case $facts['os']['release']['major'] { + '13', '26.04': { + $openjdk = 21 + } '12', '24.04': { $openjdk = 17 } diff --git a/metadata.json b/metadata.json index 81a4315e..9e9cbd77 100644 --- a/metadata.json +++ b/metadata.json @@ -45,7 +45,8 @@ "operatingsystemrelease": [ "10", "11", - "12" + "12", + "13" ] }, { @@ -54,7 +55,8 @@ "18.04", "20.04", "22.04", - "24.04" + "24.04", + "26.04" ] }, { diff --git a/spec/classes/java_spec.rb b/spec/classes/java_spec.rb index 90efa9f5..d7ec2d92 100644 --- a/spec/classes/java_spec.rb +++ b/spec/classes/java_spec.rb @@ -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