From 36b1bef1568b94174910002cf13e223009cb6454 Mon Sep 17 00:00:00 2001 From: Clinton Wolfe Date: Tue, 11 Feb 2020 10:19:04 -0500 Subject: [PATCH] Rework as an audit-cookbook-only profile Signed-off-by: Clinton Wolfe --- README.md | 6 +++--- controls/during-audit.rb | 16 ++++++++++++++++ controls/run-controls.rb | 7 ------- inspec.yml | 4 ++-- 4 files changed, 21 insertions(+), 12 deletions(-) create mode 100644 controls/during-audit.rb delete mode 100644 controls/run-controls.rb diff --git a/README.md b/README.md index 24fc614..cb9f091 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# run-context InSpec Text Profile +# Audit Cookbook run-context InSpec Test Profile -This is a test inspec profile used to exercise the ability of InSpec to determine how it is being run -under Test Kitchen and Audit Cookbook. +This is a test inspec profile used to exercise the ability of InSpec to detect when it is being run +under Audit Cookbook. It is not a typical profile and is not intended for normal public consumption, nor is it a good example. diff --git a/controls/during-audit.rb b/controls/during-audit.rb new file mode 100644 index 0000000..a7cb03c --- /dev/null +++ b/controls/during-audit.rb @@ -0,0 +1,16 @@ + + +stack = caller_locations(4) +control "json-stack" do + describe stack.to_json do + it { should be_kind_of String } + end +end + +require "inspec/utils/telemetry/run_context" + +control "run-context" do + describe Inspec::Telemetry::RunContextProbe.guess_run_context do + it { should cmp "audit-cookbook" } + end +end diff --git a/controls/run-controls.rb b/controls/run-controls.rb deleted file mode 100644 index 842bee9..0000000 --- a/controls/run-controls.rb +++ /dev/null @@ -1,7 +0,0 @@ - -stack = caller_locations(4) -control "json-stack" do - describe JSON.dump(stack) do - its('length') { should be 0 } # intentionally fail, just dump - end -end diff --git a/inspec.yml b/inspec.yml index 3d76792..94b4664 100644 --- a/inspec.yml +++ b/inspec.yml @@ -1,10 +1,10 @@ -name: inspec-test-profile-run-context +name: inspec-test-profile-run-context-audit title: InSpec Profile maintainer: InSpec Engineering copyright: Chef Software, Inc. copyright_email: inspec@chef.io license: Apache-2.0 -summary: An InSpec Compliance Profile to test inspec run context detection under test-kitchen +summary: An InSpec Compliance Profile to test inspec run context detection under audit-cookbook version: 0.1.0 supports: platform: os