Skip to content

Commit

Permalink
run external ks tests on GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeni committed Dec 19, 2023
1 parent 70b2144 commit 091f3f7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/foreman.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ jobs:
- 'webpack:compile test:integration'
- 'db:seed'
- 'assets:precompile RAILS_ENV=production DATABASE_URL=nulldb://nohost'
- 'test:external'
steps:
- run: sudo apt-get update
- run: sudo apt-get -qq -y install build-essential libcurl4-openssl-dev zlib1g-dev libpq-dev libvirt-dev
Expand Down
13 changes: 9 additions & 4 deletions test/external/kickstart_syntax_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
require "English"

class KickstartSyntaxTest < ActiveSupport::TestCase
# Kickstart snapshots are generated only for EL7
["RHEL7"].each do |version|
Dir.glob('test/unit/foreman/renderer/snapshots/ProvisioningTemplate/provision/*Kickstart*').each do |file|
ksfiles = Dir.glob('test/unit/foreman/renderer/snapshots/ProvisioningTemplate/provision/*Kickstart*')
ksfiles_rhel9 = ksfiles.select { |ks| ks.match?('rhel9') }
ksfiles_rhel7 = ksfiles - ksfiles_rhel9

versions = {'RHEL7' => ksfiles_rhel7, 'RHEL9' => ksfiles_rhel9}

versions.each do |version, files|
files.each do |file|
context version do
test file do
ksvalidator(file, version)
Expand All @@ -19,7 +24,7 @@ def ksvalidator(file, version)
skip unless find_executable 'ksvalidator'
output = `ksvalidator --version #{version} '#{file}' 2>&1`
status = $CHILD_STATUS
assert_empty output
assert_empty output.strip.sub(/Checking kickstart file [^ ]+/, '')
assert status.success?
end
end

0 comments on commit 091f3f7

Please sign in to comment.