From d8fd959af5782ca06b76c8f793ac8e6f8e29856b Mon Sep 17 00:00:00 2001 From: Nikita Mathur Date: Tue, 14 Jun 2022 13:46:33 +0530 Subject: [PATCH 1/2] Fix test cases in inspec parallel tests Signed-off-by: Nikita Mathur --- .../test/functional/inspec_parallel_test.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/plugins/inspec-parallel/test/functional/inspec_parallel_test.rb b/lib/plugins/inspec-parallel/test/functional/inspec_parallel_test.rb index 8af91468a..61f200404 100644 --- a/lib/plugins/inspec-parallel/test/functional/inspec_parallel_test.rb +++ b/lib/plugins/inspec-parallel/test/functional/inspec_parallel_test.rb @@ -20,8 +20,8 @@ class ParallelCli < Minitest::Test def test_parallel_dry_run out = run_inspec_process("parallel exec #{complete_profile} -o #{options_file_1} --dry-run --sudo") stdout = out.stdout - assert_includes stdout, "complete-profile -t ssh://vagrant@127.0.0.1:2201 --reporter cli:myfile.out --no-create-lockfile --no-sudo" - assert_includes stdout, "control-tags -t ssh://vagrant@127.0.0.1:2201 --reporter cli:myfile.out --sudo true" + assert_includes stdout, "complete-profile -t ssh://vagrant@127.0.0.1:2201 --reporter child-status cli:myfile.out --no-create-lockfile --no-sudo" + assert_includes stdout, "control-tags -t ssh://vagrant@127.0.0.1:2201 --reporter child-status cli:myfile.out --sudo true" assert_equal stdout.split("\n").count, 6 assert_exit_code 0, out end @@ -63,8 +63,8 @@ class ParallelCli < Minitest::Test skip_windows! out = run_inspec_process("parallel exec #{complete_profile} -o #{options_shell_file_1} --dry-run") stdout = out.stdout - assert_includes stdout, "complete-profile --reporter json:myfile.json --create-lockfile false" - assert_includes stdout, "control-tags --reporter cli:myfile.out --create-lockfile false" + assert_includes stdout, "complete-profile --reporter child-status json:myfile.json --create-lockfile false" + assert_includes stdout, "control-tags --reporter child-status cli:myfile.out --create-lockfile false" assert_empty out.stderr assert_exit_code 0, out end @@ -72,9 +72,9 @@ class ParallelCli < Minitest::Test def test_parallel_dry_run_with_default_opts out = run_inspec_process("parallel exec #{complete_profile} -o #{options_file_1} -t docker://8b5ec1a0344b --dry-run") stdout = out.stdout - assert_includes stdout, "basic_profile -t docker://8b5ec1a0344b --reporter json:myfile.json" - assert_includes stdout, "complete-profile -t docker://1870886821c3 --reporter cli:myfile.out" - assert_includes stdout, "complete-profile --reporter cli:myfile.out --target docker://8b5ec1a0344b" + assert_includes stdout, "basic_profile -t docker://8b5ec1a0344b --reporter child-status json:myfile.json" + assert_includes stdout, "complete-profile -t docker://1870886821c3 --reporter child-status cli:myfile.out" + assert_includes stdout, "complete-profile --reporter child-status cli:myfile.out --target docker://8b5ec1a0344b" assert_equal stdout.split("\n").count, 6 assert_exit_code 0, out end @@ -82,8 +82,8 @@ class ParallelCli < Minitest::Test def test_parallel_dry_run_with_verbose_option out = run_inspec_process("parallel exec #{complete_profile} -o #{options_file_1} --dry-run --verbose") stdout = out.stdout - assert_includes stdout, "complete-profile -t ssh://vagrant@127.0.0.1:2201 --reporter cli:myfile.out --no-create-lockfile --no-sudo --winrm-transport negotiate --insecure false --winrm-shell-type powershell --auto-install-gems false --distinct-exit true --diff true --sort-results-by file --filter-empty-profiles false --reporter-include-source false" - assert_includes stdout, "control-tags -t ssh://vagrant@127.0.0.1:2201 --reporter cli:myfile.out --winrm-transport negotiate --insecure false --winrm-shell-type powershell --auto-install-gems false --distinct-exit true --diff true --sort-results-by file --filter-empty-profiles false --reporter-include-source false" + assert_includes stdout, "complete-profile -t ssh://vagrant@127.0.0.1:2201 --reporter child-status cli:myfile.out --no-create-lockfile --no-sudo --winrm-transport negotiate --insecure false --winrm-shell-type powershell --auto-install-gems false --distinct-exit true --diff true --sort-results-by file --filter-empty-profiles false --reporter-include-source false" + assert_includes stdout, "control-tags -t ssh://vagrant@127.0.0.1:2201 --reporter child-status cli:myfile.out --winrm-transport negotiate --insecure false --winrm-shell-type powershell --auto-install-gems false --distinct-exit true --diff true --sort-results-by file --filter-empty-profiles false --reporter-include-source false" assert_equal stdout.split("\n").count, 6 assert_exit_code 0, out end From 6eb5df2e494be584e1cf10d005ca8d0d911b899d Mon Sep 17 00:00:00 2001 From: Nikita Mathur Date: Tue, 14 Jun 2022 15:17:01 +0530 Subject: [PATCH 2/2] Skip parallel exec tests on windows Signed-off-by: Nikita Mathur --- .../inspec-parallel/test/functional/inspec_parallel_test.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/plugins/inspec-parallel/test/functional/inspec_parallel_test.rb b/lib/plugins/inspec-parallel/test/functional/inspec_parallel_test.rb index 61f200404..77563e6a3 100644 --- a/lib/plugins/inspec-parallel/test/functional/inspec_parallel_test.rb +++ b/lib/plugins/inspec-parallel/test/functional/inspec_parallel_test.rb @@ -27,6 +27,7 @@ class ParallelCli < Minitest::Test end def test_parallel_run_without_forking + skip_windows! out = run_inspec_process("parallel exec #{complete_profile} -o #{options_file_3}") assert_empty out.stderr assert_exit_code 0, out @@ -47,6 +48,7 @@ class ParallelCli < Minitest::Test end def test_parallel_with_default_opts + skip_windows! out = run_inspec_process("parallel exec #{complete_profile} -o #{options_file_3} --reporter json") assert_empty out.stderr assert_exit_code 0, out