Skip to content

Commit 5f09453

Browse files
authored
Improve testing for acceptance and add back Ubuntu 20.04 (#186)
* Improve testing for acceptance * Attempt to fix UTF-8 errors for execs by using /dev/null redirect
1 parent 5dcd458 commit 5f09453

13 files changed

Lines changed: 166 additions & 90 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ jobs:
4242
- name: Run tests
4343
run: bundle exec rake parallel_spec
4444
acceptance:
45+
# Run on 22.04 until newer doesn't cause ioctl errors for el10 tests
4546
runs-on: ubuntu-22.04
4647
strategy:
4748
fail-fast: false
@@ -56,10 +57,29 @@ jobs:
5657
- "debian-12"
5758
puppet:
5859
- "puppet8"
60+
repo_release:
61+
- "staging/4.0"
62+
- "staging/4.1"
63+
- "4.0"
64+
- "4.1"
65+
include:
66+
- set: "ubuntu-2004"
67+
puppet: "puppet8"
68+
repo_release: "staging/4.0"
69+
- set: "ubuntu-2004"
70+
puppet: "puppet8"
71+
repo_release: "4.0"
72+
exclude:
73+
- set: "el10"
74+
puppet: "puppet8"
75+
repo_release: "staging/4.0"
76+
- set: "el10"
77+
puppet: "puppet8"
78+
repo_release: "4.0"
5979
env:
6080
BUNDLE_WITHOUT: development:release
6181
BEAKER_debug: true
62-
name: ${{ matrix.puppet }} ${{ matrix.set }}
82+
name: ${{ matrix.puppet }} ${{ matrix.set }} (repo=${{ matrix.repo_release }})
6383
steps:
6484
- name: Enable IPv6 on docker
6585
run: |
@@ -86,3 +106,4 @@ jobs:
86106
env:
87107
BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet }}
88108
BEAKER_set: ${{ matrix.set }}
109+
BEAKER_repo_release: ${{ matrix.repo_release }}

.sync.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Rakefile:
66
run_on_schedule:
77
- '0 6 * * 1'
88
workflow_dispatch: true
9+
acceptance_name: '${{ matrix.puppet }} ${{ matrix.set }} (repo=${{ matrix.repo_release }})'
910
acceptance_matrix:
1011
set:
1112
- el8
@@ -17,6 +18,25 @@ Rakefile:
1718
- debian-12
1819
puppet:
1920
- puppet8
21+
repo_release:
22+
- staging/4.0
23+
- staging/4.1
24+
- '4.0'
25+
- '4.1'
26+
acceptance_includes:
27+
- set: ubuntu-2004
28+
puppet: puppet8
29+
repo_release: staging/4.0
30+
- set: ubuntu-2004
31+
puppet: puppet8
32+
repo_release: '4.0'
33+
acceptance_excludes:
34+
- set: el10
35+
puppet: puppet8
36+
repo_release: staging/4.0
37+
- set: el10
38+
puppet: puppet8
39+
repo_release: '4.0'
2040
.gitlab-ci.yml:
2141
delete: true
2242
appveyor.yml:
@@ -44,7 +64,7 @@ spec/acceptance/nodesets/debian-11.yml:
4464
spec/acceptance/nodesets/ubuntu-1804.yml:
4565
delete: true
4666
spec/acceptance/nodesets/ubuntu-2004.yml:
47-
delete: true
67+
unmanaged: true
4868
spec/acceptance/nodesets/ubuntu-2204.yml:
4969
packages:
5070
- cron

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,10 +358,11 @@ openondemand::confs:
358358

359359
This module has been tested on:
360360

361-
* RedHat/CentOS 7 x86_64
362361
* RedHat/Rocky Linux/Alma Linux 8
363362
* RedHat/Rocky Linux/Alma Linux 9
363+
* RedHat/Rocky Linux/Alma Linux 10 (OnDemand 4.1 only)
364364
* Amazon Linux 2023
365-
* Ubuntu 20.04
365+
* Ubuntu 20.04 (OnDemand 4.0 only)
366366
* Ubuntu 22.04
367+
* Ubuntu 24.04
367368
* Debian 12

manifests/init.pp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,14 +404,21 @@
404404
$osfamily = $facts.dig('os', 'family')
405405
$osname = $facts.dig('os', 'name')
406406
$osmajor = $facts.dig('os', 'release', 'major')
407+
$repo_version = split($repo_release, '/')[-1]
407408

408-
$supported = ['RedHat-8','RedHat-9','RedHat-10','RedHat-2023','Debian-22.04','Debian-24.04','Debian-12']
409+
$supported = ['RedHat-8','RedHat-9','RedHat-10','RedHat-2023','Debian-20.04','Debian-22.04','Debian-24.04','Debian-12']
409410
$os = "${osfamily}-${osmajor}"
410411
if ! ($os in $supported) {
411412
fail("Unsupported OS: module ${module_name}. osfamily=${osfamily} osmajor=${osmajor} detected")
412413
}
413414

414-
$repo_version = split($repo_release, '/')[-1]
415+
if $facts['os']['family'] == 'RedHat' and String($openondemand::osmajor) == '10' and $repo_version == '4.0' {
416+
fail('EL10 is not supported for OnDemand 4.0')
417+
}
418+
if $facts['os']['name'] == 'Ubuntu' and String($openondemand::osmajor) == '20.04' and $repo_version == '4.1' {
419+
fail('Ubuntu 20.04 is not supported for OnDemand 4.1')
420+
}
421+
415422
if $repo_version == '4.0' {
416423
$nodejs = '20'
417424
$ruby = '3.3'

manifests/service.pp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
assert_private()
55

66
exec { 'nginx_stage-app_clean':
7-
command => '/opt/ood/nginx_stage/sbin/nginx_stage app_clean',
7+
command => '/opt/ood/nginx_stage/sbin/nginx_stage app_clean &>/dev/null',
88
refreshonly => true,
99
subscribe => [
1010
File['/etc/ood/config/nginx_stage.yml'],
@@ -13,7 +13,7 @@
1313
],
1414
}
1515
-> exec { 'nginx_stage-app_reset-pun':
16-
command => '/opt/ood/nginx_stage/sbin/nginx_stage app_reset --sub-uri=/pun',
16+
command => '/opt/ood/nginx_stage/sbin/nginx_stage app_reset --sub-uri=/pun &>/dev/null',
1717
refreshonly => true,
1818
subscribe => [
1919
File['/etc/ood/config/nginx_stage.yml'],
@@ -22,7 +22,7 @@
2222
],
2323
}
2424
-> exec { 'nginx_stage-nginx_clean':
25-
command => '/opt/ood/nginx_stage/sbin/nginx_stage nginx_clean',
25+
command => '/opt/ood/nginx_stage/sbin/nginx_stage nginx_clean &>/dev/null',
2626
refreshonly => true,
2727
subscribe => [
2828
File['/etc/ood/config/nginx_stage.yml'],

metadata.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
{
8080
"operatingsystem": "Ubuntu",
8181
"operatingsystemrelease": [
82+
"20.04",
8283
"22.04",
8384
"24.04"
8485
]
@@ -102,6 +103,6 @@
102103
"gateway"
103104
],
104105
"pdk-version": "3.4.0",
105-
"template-url": "https://github.com/treydock/pdk-templates.git#el10",
106-
"template-ref": "remotes/origin/el10-0-g7f231cc"
106+
"template-url": "https://github.com/treydock/pdk-templates.git#master",
107+
"template-ref": "heads/master-0-g875588c"
107108
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
HOSTS:
2+
ubuntu2004:
3+
roles:
4+
- agent
5+
platform: ubuntu-20.04-amd64
6+
hypervisor : docker
7+
image: ubuntu:20.04
8+
docker_preserve_image: true
9+
docker_cmd: '["/sbin/init"]'
10+
docker_image_commands:
11+
- "rm -f /etc/dpkg/dpkg.cfg.d/excludes"
12+
- 'apt-get install -y wget net-tools iproute2 locales apt-transport-https ca-certificates cron'
13+
- 'locale-gen en_US.UTF-8'
14+
docker_env:
15+
- LANG=en_US.UTF-8
16+
- LANGUAGE=en_US.UTF-8
17+
- LC_ALL=en_US.UTF-8
18+
docker_container_name: 'openondemand-ubuntu2004'
19+
default_module_install_opts:
20+
ignore-dependencies:
21+
force:
22+
CONFIG:
23+
log_level: debug
24+
type: foss
25+
ssh:
26+
password: root
27+
auth_methods: ["password"]
28+

spec/acceptance/openondemand_spec.rb

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,19 @@
33
require 'spec_helper_acceptance'
44

55
describe 'openondemand class:' do
6-
supported_releases.each_pair do |release, versions|
7-
versions.each do |version|
8-
context "when repo_release => 'staging/#{release}' ondemand_package_ensure => '#{version}'" do
9-
it 'runs successfully' do
10-
pp = <<-PP
11-
class { 'openondemand':
12-
repo_release => 'staging/#{release}',
13-
ondemand_package_ensure => '#{version}',
14-
generator_insecure => true,
15-
}
16-
PP
17-
18-
apply_manifest(pp, catch_failures: true)
19-
apply_manifest(pp, catch_changes: true)
20-
end
6+
versions(RSpec.configuration.repo_release).each do |version|
7+
context "when repo_release => '#{RSpec.configuration.repo_release}' ondemand_package_ensure => '#{version}'" do
8+
it 'runs successfully' do
9+
pp = <<-PP
10+
class { 'openondemand':
11+
repo_release => '#{RSpec.configuration.repo_release}',
12+
ondemand_package_ensure => '#{version}',
13+
generator_insecure => true,
14+
}
15+
PP
16+
17+
apply_manifest(pp, catch_failures: true)
18+
apply_manifest(pp, catch_changes: true)
2119
end
2220
end
2321
end

spec/classes/init_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88
let(:facts) do
99
facts
1010
end
11+
let(:default_params) do
12+
if facts[:os]['name'] == 'Ubuntu' && facts[:os]['release']['major'] == '20.04'
13+
{ repo_release: '4.0' }
14+
else
15+
{}
16+
end
17+
end
18+
let(:param_override) { {} }
19+
let(:params) { default_params.merge(param_override) }
1120

1221
it { is_expected.to compile.with_all_deps }
1322

spec/shared_examples/config.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
end
77

88
context 'with nginx_stage options defined' do
9-
let(:params) do
9+
let(:param_override) do
1010
{
1111
nginx_stage_passenger_options: {
1212
'passenger_foobar' => 'baz',
@@ -23,7 +23,7 @@
2323
end
2424

2525
context 'with configurations defined' do
26-
let(:params) do
26+
let(:param_override) do
2727
{
2828
'pinned_apps' => [
2929
'usr/*',
@@ -50,12 +50,12 @@
5050
it 'has valid config' do
5151
content = catalogue.resource('file', '/etc/ood/config/ondemand.d/ondemand.yml').send(:parameters)[:content]
5252
data = YAML.safe_load(content)
53-
expect(data).to eq(params)
53+
expect(data).to eq(param_override)
5454
end
5555
end
5656

5757
context 'with hook.env' do
58-
let(:params) { { pun_pre_hook_root_cmd: '/dne/hook.sh' } }
58+
let(:param_override) { { pun_pre_hook_root_cmd: '/dne/hook.sh' } }
5959

6060
it 'has default hook contents' do
6161
is_expected.to contain_file('/etc/ood/config/hook.env').with(
@@ -69,7 +69,7 @@
6969
end
7070

7171
context 'with hook config defined' do
72-
let(:params) do
72+
let(:param_override) do
7373
{
7474
pun_pre_hook_root_cmd: '/dne/hook.sh',
7575
oidc_client_id: 'ondemand',
@@ -102,7 +102,7 @@
102102
end
103103

104104
context 'with nginx_stage_configs options defined' do
105-
let(:params) do
105+
let(:param_override) do
106106
{
107107
nginx_stage_configs: {
108108
'foo' => 'bar',

0 commit comments

Comments
 (0)