From 4489398b4799e4440c99c9b49999fe894aaa8c9a Mon Sep 17 00:00:00 2001 From: david22swan Date: Wed, 28 Aug 2024 12:11:07 +0100 Subject: [PATCH 1/2] (CAT-2026) Update how `pdk test unit --list` detects an error A recent change has caused the information returned to be in a slightly different format. Message returned may be different, and include additional details. --- lib/pdk/tests/unit.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pdk/tests/unit.rb b/lib/pdk/tests/unit.rb index 450b5e3b8..9610f07f2 100644 --- a/lib/pdk/tests/unit.rb +++ b/lib/pdk/tests/unit.rb @@ -246,10 +246,10 @@ def self.list(options = {}) raise PDK::CLI::FatalError, format('Failed to find valid JSON in output from rspec: %{output}', output: output[:stdout]) unless rspec_json if rspec_json['examples'].empty? - rspec_message = rspec_json['messages'][0] - return [] if rspec_message == 'No examples found.' + return [] if rspec_json['messages'][0] == 'No examples found.' + return [] if rspec_json['messages'].include?("\nAll examples were filtered out") - raise PDK::CLI::FatalError, format('Unable to enumerate examples. rspec reported: %{message}', message: rspec_message) + raise PDK::CLI::FatalError, format('Unable to enumerate examples. rspec reported: %{message}', message: rspec_json['messages']) else examples = [] rspec_json['examples'].each do |example| From e1c735018109b1fce18bd825f9bb5f0b8e1efd44 Mon Sep 17 00:00:00 2001 From: david22swan Date: Thu, 29 Aug 2024 16:37:00 +0100 Subject: [PATCH 2/2] Temp --- spec/acceptance/test_unit_spec.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/spec/acceptance/test_unit_spec.rb b/spec/acceptance/test_unit_spec.rb index 5312ec922..c74f1a0bc 100644 --- a/spec/acceptance/test_unit_spec.rb +++ b/spec/acceptance/test_unit_spec.rb @@ -47,11 +47,9 @@ require 'spec_helper' RSpec.describe 'passing test' do - on_supported_os(:facterversion => '2.4.6').each do |os, facts| - context "On OS \#{os}" do - it 'should pass' do - expect(true).to eq(true) - end + context 'On OS' do + it 'should pass' do + expect(true).to eq(true) end end end