diff --git a/lib/inspec/cli.rb b/lib/inspec/cli.rb index e2d446efd..6fa5eae3d 100644 --- a/lib/inspec/cli.rb +++ b/lib/inspec/cli.rb @@ -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) diff --git a/test/functional/telemetry_test.rb b/test/functional/telemetry_test.rb new file mode 100644 index 000000000..3ca9f6985 --- /dev/null +++ b/test/functional/telemetry_test.rb @@ -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