mirror of
https://github.com/inspec/inspec
synced 2024-11-25 22:20:27 +00:00
Add a functional test to check Thor run context detection
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
parent
45e3421595
commit
439c93b115
2 changed files with 20 additions and 5 deletions
|
@ -375,6 +375,12 @@ class Inspec::InspecCLI < Inspec::BaseCLI
|
|||
puts "Valid schemas are #{Inspec::Schema::OutputSchema.names.join(", ")}"
|
||||
end
|
||||
|
||||
desc "run_context", "used to test run-context detection", hide: true
|
||||
def run_context
|
||||
require "inspec/utils/telemetry/run_context_probe"
|
||||
puts Inspec::Telemetry::RunContextProbe.guess_run_context
|
||||
end
|
||||
|
||||
desc "version", "prints the version of this tool"
|
||||
option :format, type: :string
|
||||
def version
|
||||
|
@ -387,11 +393,6 @@ class Inspec::InspecCLI < Inspec::BaseCLI
|
|||
end
|
||||
map %w{-v --version} => :version
|
||||
|
||||
desc "nothing", "does nothing"
|
||||
def nothing
|
||||
puts "you did nothing"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def run_command(opts)
|
||||
|
|
14
test/functional/telemetry_test.rb
Normal file
14
test/functional/telemetry_test.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
require "functional/helper"
|
||||
|
||||
describe "telemetry" do
|
||||
include FunctionalHelper
|
||||
parallelize_me!
|
||||
|
||||
describe "detecting CLI runtime context" do
|
||||
let(:run_result) { run_inspec_process("run_context") }
|
||||
it "should detect cli context" do
|
||||
_(run_result.stderr).must_equal ""
|
||||
_(run_result.stdout).must_include "cli"
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue