Merge pull request #6138 from inspec/nm/parallel-test-fix

Fix Inspec parallel test build issues
This commit is contained in:
Nikita Mathur 2022-06-14 16:06:19 +05:30 committed by GitHub
commit 2fd0ccfa4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,13 +20,14 @@ class ParallelCli < Minitest::Test
def test_parallel_dry_run def test_parallel_dry_run
out = run_inspec_process("parallel exec #{complete_profile} -o #{options_file_1} --dry-run --sudo") out = run_inspec_process("parallel exec #{complete_profile} -o #{options_file_1} --dry-run --sudo")
stdout = out.stdout 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, "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 cli:myfile.out --sudo true" 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_equal stdout.split("\n").count, 6
assert_exit_code 0, out assert_exit_code 0, out
end end
def test_parallel_run_without_forking def test_parallel_run_without_forking
skip_windows!
out = run_inspec_process("parallel exec #{complete_profile} -o #{options_file_3}") out = run_inspec_process("parallel exec #{complete_profile} -o #{options_file_3}")
assert_empty out.stderr assert_empty out.stderr
assert_exit_code 0, out assert_exit_code 0, out
@ -47,6 +48,7 @@ class ParallelCli < Minitest::Test
end end
def test_parallel_with_default_opts def test_parallel_with_default_opts
skip_windows!
out = run_inspec_process("parallel exec #{complete_profile} -o #{options_file_3} --reporter json") out = run_inspec_process("parallel exec #{complete_profile} -o #{options_file_3} --reporter json")
assert_empty out.stderr assert_empty out.stderr
assert_exit_code 0, out assert_exit_code 0, out
@ -63,8 +65,8 @@ class ParallelCli < Minitest::Test
skip_windows! skip_windows!
out = run_inspec_process("parallel exec #{complete_profile} -o #{options_shell_file_1} --dry-run") out = run_inspec_process("parallel exec #{complete_profile} -o #{options_shell_file_1} --dry-run")
stdout = out.stdout stdout = out.stdout
assert_includes stdout, "complete-profile --reporter json:myfile.json --create-lockfile false" assert_includes stdout, "complete-profile --reporter child-status json:myfile.json --create-lockfile false"
assert_includes stdout, "control-tags --reporter cli:myfile.out --create-lockfile false" assert_includes stdout, "control-tags --reporter child-status cli:myfile.out --create-lockfile false"
assert_empty out.stderr assert_empty out.stderr
assert_exit_code 0, out assert_exit_code 0, out
end end
@ -72,9 +74,9 @@ class ParallelCli < Minitest::Test
def test_parallel_dry_run_with_default_opts 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") out = run_inspec_process("parallel exec #{complete_profile} -o #{options_file_1} -t docker://8b5ec1a0344b --dry-run")
stdout = out.stdout stdout = out.stdout
assert_includes stdout, "basic_profile -t docker://8b5ec1a0344b --reporter json:myfile.json" assert_includes stdout, "basic_profile -t docker://8b5ec1a0344b --reporter child-status json:myfile.json"
assert_includes stdout, "complete-profile -t docker://1870886821c3 --reporter cli:myfile.out" assert_includes stdout, "complete-profile -t docker://1870886821c3 --reporter child-status cli:myfile.out"
assert_includes stdout, "complete-profile --reporter cli:myfile.out --target docker://8b5ec1a0344b" assert_includes stdout, "complete-profile --reporter child-status cli:myfile.out --target docker://8b5ec1a0344b"
assert_equal stdout.split("\n").count, 6 assert_equal stdout.split("\n").count, 6
assert_exit_code 0, out assert_exit_code 0, out
end end
@ -82,8 +84,8 @@ class ParallelCli < Minitest::Test
def test_parallel_dry_run_with_verbose_option def test_parallel_dry_run_with_verbose_option
out = run_inspec_process("parallel exec #{complete_profile} -o #{options_file_1} --dry-run --verbose") out = run_inspec_process("parallel exec #{complete_profile} -o #{options_file_1} --dry-run --verbose")
stdout = out.stdout 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, "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 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, "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_equal stdout.split("\n").count, 6
assert_exit_code 0, out assert_exit_code 0, out
end end