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
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
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
@ -63,8 +65,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 +74,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 +84,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