From ec43054411d2e067a6b53ec5cf5600eaa3953d3c Mon Sep 17 00:00:00 2001 From: Nikita Mathur Date: Fri, 1 Jul 2022 14:13:58 +0530 Subject: [PATCH] Platform checks on tests for unix and windows Signed-off-by: Nikita Mathur --- test/functional/inspec_exec_test.rb | 32 +++++++++++++++-------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/test/functional/inspec_exec_test.rb b/test/functional/inspec_exec_test.rb index 4bff77890..9c4be8756 100644 --- a/test/functional/inspec_exec_test.rb +++ b/test/functional/inspec_exec_test.rb @@ -1306,24 +1306,26 @@ EOT end end - describe "when profiles are dependent on different versions of same profile - test in unix" do - let(:profile) { "#{profile_path}/git-fetcher/inheritance/parent-profile" } - let(:run_result) { run_inspec_process("exec #{profile}") } - it "should evaluate all test controls of all versions correctly" do - skip_windows! - _(run_result.stderr).must_be_empty - _(run_result.stdout).must_include "2.7.0" - _(run_result.stdout).must_include "2.6.0" - _(run_result.stdout).must_include "sshd-01" - _(run_result.stdout).must_include "sshd-50" + unless windows? + describe "when profiles are dependent on different versions of same profile - test in unix" do + let(:profile) { "#{profile_path}/git-fetcher/inheritance/parent-profile" } + let(:run_result) { run_inspec_process("exec #{profile}") } + it "should evaluate all test controls of all versions correctly" do + skip_windows! + _(run_result.stderr).must_be_empty + _(run_result.stdout).must_include "2.7.0" + _(run_result.stdout).must_include "2.6.0" + _(run_result.stdout).must_include "sshd-01" + _(run_result.stdout).must_include "sshd-50" + end end end - describe "when profiles are dependent on different versions of same profile - test in windows" do - let(:profile) { "#{profile_path}/git-fetcher/inheritance-windows/parent-profile" } - let(:run_result) { run_inspec_process("exec #{profile}") } - it "should evaluate all test controls of all versions correctly" do - if is_windows? + if windows? + describe "when profiles are dependent on different versions of same profile - test in windows" do + let(:profile) { "#{profile_path}/git-fetcher/inheritance-windows/parent-profile" } + let(:run_result) { run_inspec_process("exec #{profile}") } + it "should evaluate all test controls of all versions correctly" do _(run_result.stdout).must_include "1.1.2" _(run_result.stdout).must_include "1.1.0" end