From 091f3f7a4adef18ae062a8609fa5b1a9868057f9 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Tue, 19 Dec 2023 10:50:41 +0100 Subject: [PATCH] run external ks tests on GHA --- .github/workflows/foreman.yml | 1 + test/external/kickstart_syntax_test.rb | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/foreman.yml b/.github/workflows/foreman.yml index 6aefe04a63dc..6b68b8c0d3f4 100644 --- a/.github/workflows/foreman.yml +++ b/.github/workflows/foreman.yml @@ -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 diff --git a/test/external/kickstart_syntax_test.rb b/test/external/kickstart_syntax_test.rb index 4ad7932eb8d8..200d1bf0ef80 100644 --- a/test/external/kickstart_syntax_test.rb +++ b/test/external/kickstart_syntax_test.rb @@ -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) @@ -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