mirror of
https://github.com/inspec/inspec
synced 2025-02-16 22:18:38 +00:00
More parallelization for functionals.
Signed-off-by: Ryan Davis <zenspider@chef.io>
This commit is contained in:
parent
d3f81f1194
commit
fc1ad67ffc
12 changed files with 35 additions and 10 deletions
|
@ -4,6 +4,8 @@ class PluginManagerCliInstall < Minitest::Test
|
|||
include CorePluginFunctionalHelper # gives us instance methods, like `let` aliases inside test methods
|
||||
extend CorePluginFunctionalHelper # gives us class methods, like `let` aliases out here outside test methods
|
||||
|
||||
parallelize_me!
|
||||
|
||||
include PluginManagerHelpers
|
||||
ruby_abi_version = (Gem.ruby_version.segments[0, 2] << 0).join(".")
|
||||
# Test multiple hueristics of the path-mode install.
|
||||
|
|
|
@ -4,6 +4,8 @@ class PluginManagerCliSearch < Minitest::Test
|
|||
include CorePluginFunctionalHelper
|
||||
include PluginManagerHelpers
|
||||
|
||||
parallelize_me!
|
||||
|
||||
# TODO: Thor can't hide options, but we wish it could.
|
||||
# def test_search_include_fixture_hidden_option
|
||||
# result = run_inspec_process_with_this_plugin('plugin help search')
|
||||
|
|
|
@ -7,6 +7,8 @@ describe "inputs" do
|
|||
include FunctionalHelper
|
||||
let(:inputs_profiles_path) { File.join(profile_path, "inputs") }
|
||||
|
||||
parallelize_me!
|
||||
|
||||
# This tests being able to load complex structures from
|
||||
# cli option-specified files.
|
||||
%w{
|
||||
|
|
|
@ -7,6 +7,8 @@ describe "inspec archive" do
|
|||
include FunctionalHelper
|
||||
let(:auto_dst) { File.expand_path(File.join(repo_path, "profile-1.0.0.tar.gz")) }
|
||||
|
||||
parallelize_me!
|
||||
|
||||
it "archive is successful" do
|
||||
prepare_examples("profile") do |dir|
|
||||
out = inspec("archive " + dir + " --overwrite")
|
||||
|
|
|
@ -4,6 +4,8 @@ require "tmpdir"
|
|||
describe "inspec check" do
|
||||
include FunctionalHelper
|
||||
|
||||
parallelize_me!
|
||||
|
||||
describe "inspec check with json formatter" do
|
||||
it "can check a profile and produce valid JSON" do
|
||||
out = inspec("check " + example_profile + " --format json")
|
||||
|
|
|
@ -4,6 +4,8 @@ require "json-schema"
|
|||
describe "inspec exec with json formatter" do
|
||||
include FunctionalHelper
|
||||
|
||||
parallelize_me!
|
||||
|
||||
it "can execute a simple file and validate the json schema" do
|
||||
out = inspec("exec " + example_control + " --reporter json --no-create-lockfile")
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@ require "json-schema"
|
|||
describe "inspec exec" do
|
||||
include FunctionalHelper
|
||||
|
||||
parallelize_me!
|
||||
|
||||
it "can execute a profile with the mini json formatter and validate its schema" do
|
||||
out = inspec("exec " + example_profile + " --reporter json-min --no-create-lockfile")
|
||||
data = JSON.parse(out.stdout)
|
||||
|
|
|
@ -4,9 +4,12 @@ require "rexml/document"
|
|||
describe "inspec exec with junit formatter" do
|
||||
include FunctionalHelper
|
||||
|
||||
parallelize_me!
|
||||
|
||||
it "can execute a simple file with the junit formatter" do
|
||||
out = inspec("exec " + example_control + " --reporter junit --no-create-lockfile")
|
||||
|
||||
# TODO: rexml is about as slow as you can go. Use nokogiri
|
||||
doc = REXML::Document.new(out.stdout)
|
||||
doc.has_elements?.must_equal true
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@ require "mixlib/shellout"
|
|||
describe "inspec json" do
|
||||
include FunctionalHelper
|
||||
|
||||
parallelize_me!
|
||||
|
||||
it "read the profile json" do
|
||||
out = inspec("json " + example_profile)
|
||||
out.stderr.must_equal ""
|
||||
|
|
|
@ -4,6 +4,8 @@ require "tmpdir"
|
|||
describe "example inheritance profile" do
|
||||
include FunctionalHelper
|
||||
|
||||
parallelize_me!
|
||||
|
||||
it "can vendor profile dependencies" do
|
||||
prepare_examples("inheritance") do |dir|
|
||||
out = inspec("vendor " + dir + " --overwrite")
|
||||
|
|
|
@ -1,12 +1,20 @@
|
|||
# Functional tests related to plugin facility
|
||||
require "functional/helper"
|
||||
|
||||
# I wrapped the whole file in a describe to refactor the include and
|
||||
# add parallelization. I didn't want to reindent the whole file until
|
||||
# we know this works well.
|
||||
|
||||
# rubocop:disable Layout/IndentationConsistency
|
||||
|
||||
describe "plugins" do
|
||||
include FunctionalHelper
|
||||
parallelize_me!
|
||||
|
||||
#=========================================================================================#
|
||||
# Loader Errors
|
||||
#=========================================================================================#
|
||||
describe "plugin loader" do
|
||||
include FunctionalHelper
|
||||
|
||||
it "handles an unloadable plugin correctly" do
|
||||
outcome = inspec_with_env("version", INSPEC_CONFIG_DIR: File.join(config_dir_path, "plugin_error_on_load"))
|
||||
|
||||
|
@ -32,8 +40,6 @@ end
|
|||
# Disabling Plugins
|
||||
#=========================================================================================#
|
||||
describe "when disabling plugins" do
|
||||
include FunctionalHelper
|
||||
|
||||
describe "when disabling the core plugins" do
|
||||
it "should not be able to use core-provided commands" do
|
||||
run_result = run_inspec_process("--disable-core-plugins habitat")
|
||||
|
@ -61,8 +67,6 @@ end
|
|||
# CliCommand plugin type
|
||||
#=========================================================================================#
|
||||
describe "cli command plugins" do
|
||||
include FunctionalHelper
|
||||
|
||||
it "is able to respond to a plugin-based cli subcommand" do
|
||||
outcome = inspec_with_env("meaningoflife answer", INSPEC_CONFIG_DIR: File.join(config_dir_path, "meaning_by_path"))
|
||||
|
||||
|
@ -102,7 +106,6 @@ end
|
|||
# Input plugin type
|
||||
#=========================================================================================#
|
||||
describe "input plugins" do
|
||||
include FunctionalHelper
|
||||
let(:env) { { INSPEC_CONFIG_DIR: "#{config_dir_path}/input_plugin" } }
|
||||
let(:profile) { "#{profile_path}/inputs/plugin" }
|
||||
def run_input_plugin_test_with_controls(controls)
|
||||
|
@ -152,8 +155,6 @@ end
|
|||
# Plugin Disable Messaging
|
||||
#=========================================================================================#
|
||||
describe "disable plugin usage message integration" do
|
||||
include FunctionalHelper
|
||||
|
||||
it "mentions the --disable-{user,core}-plugins options" do
|
||||
outcome = inspec("help")
|
||||
["--disable-user-plugins", "--disable-core-plugins"].each do |option|
|
||||
|
@ -291,7 +292,6 @@ end
|
|||
|
||||
describe "train plugin support" do
|
||||
describe "when a train plugin is installed" do
|
||||
include FunctionalHelper
|
||||
it "can run inspec detect against a URL target" do
|
||||
outcome = inspec_with_env("detect -t test-fixture://", INSPEC_CONFIG_DIR: File.join(config_dir_path, "train-test-fixture"))
|
||||
|
||||
|
@ -356,3 +356,5 @@ describe "train plugin support" do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -18,6 +18,8 @@ describe "InSpec UI behavior" do
|
|||
include PluginFunctionalHelper
|
||||
include VisibleSpaces
|
||||
|
||||
parallelize_me!
|
||||
|
||||
let(:plugin_path) { File.join(mock_path, "plugins", "inspec-test-ui", "lib", "inspec-test-ui") }
|
||||
let(:run_result) { run_inspec_with_plugin("#{pre_opts} testui #{feature} #{post_opts}", plugin_path: plugin_path) }
|
||||
let(:pre_opts) { "" }
|
||||
|
|
Loading…
Add table
Reference in a new issue