mirror of
https://github.com/inspec/inspec
synced 2024-12-18 00:53:22 +00:00
d5be4c2927
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
16 lines
597 B
Ruby
16 lines
597 B
Ruby
|
|
# run-context-during-audit should have left a file with a JSON
|
|
# representation of the stack as experienced by the audit cookbook.
|
|
|
|
raw_data = JSON.parse(file("/tmp/audit_stack.json").content)
|
|
# These aren't really stack frames, so we do some duck typing
|
|
Frame = Struct.new(:absolute_path, :label)
|
|
reconstructed_stack = raw_data.map{ |f| Frame.new(f["absolute_path"], f["label"]) }
|
|
|
|
require "inspec/utils/telemetry/run_context_probe"
|
|
|
|
control "run-context" do
|
|
describe Inspec::Telemetry::RunContextProbe.guess_run_context(reconstructed_stack) do
|
|
it { should eq "audit-cookbook" }
|
|
end
|
|
end
|