mirror of
https://github.com/inspec/inspec
synced 2025-02-17 06:28:40 +00:00
Failing test cases for #4977
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
parent
d9e5b65e3d
commit
824018efa3
3 changed files with 47 additions and 4 deletions
|
@ -8,3 +8,21 @@ control "test_control_02" do
|
|||
it { should cmp "value_from_cli_02"}
|
||||
end
|
||||
end
|
||||
|
||||
control "test_control_numeric_implicit" do
|
||||
describe input("test_input_03", value: "value_from_dsl") do
|
||||
it { should eq 11 } # Note eq not cmp
|
||||
end
|
||||
end
|
||||
|
||||
control "test_control_numeric_type" do
|
||||
describe input("test_input_04", value: "value_from_dsl") do
|
||||
it { should eq 11 } # Note eq not cmp
|
||||
end
|
||||
end
|
||||
|
||||
control "test_control_numeric_float" do
|
||||
describe input("test_input_05", value: "value_from_dsl") do
|
||||
it { should eq -11.0 } # Note eq not cmp
|
||||
end
|
||||
end
|
||||
|
|
6
test/fixtures/profiles/inputs/cli/inspec.yml
vendored
6
test/fixtures/profiles/inputs/cli/inspec.yml
vendored
|
@ -3,4 +3,8 @@ license: Apache-2.0
|
|||
summary: Profile to exercise setting inputs using the --input CLI option
|
||||
version: 0.1.0
|
||||
supports:
|
||||
platform: os
|
||||
platform: os
|
||||
|
||||
inputs:
|
||||
- name: test_input_04
|
||||
type: numeric
|
||||
|
|
|
@ -158,19 +158,40 @@ describe "inputs" do
|
|||
|
||||
describe "when the --input is used once with two values" do
|
||||
let(:input_opt) { "--input test_input_01=value_from_cli_01 test_input_02=value_from_cli_02" }
|
||||
it("correctly reads the input") { assert_json_controls_passing(result) }
|
||||
let(:control_opt) { "--controls test_control_01 test_control_02" }
|
||||
it("correctly reads both inputs") { assert_json_controls_passing(result) }
|
||||
end
|
||||
|
||||
describe "when the --input is used once with two values and a comma" do
|
||||
let(:input_opt) { "--input test_input_01=value_from_cli_01, test_input_02=value_from_cli_02" }
|
||||
it("correctly reads the input") { assert_json_controls_passing(result) }
|
||||
let(:control_opt) { "--controls test_control_01 test_control_02" }
|
||||
it("correctly reads both inputs ignoring the comma") { assert_json_controls_passing(result) }
|
||||
end
|
||||
|
||||
# See https://github.com/inspec/inspec/issues/4977
|
||||
describe "when the --input is used with a numeric value" do
|
||||
describe "when the --input is used with an integer value" do
|
||||
let(:input_opt) { "--input test_input_03=11" }
|
||||
let(:control_opt) { "--controls test_control_numeric_implicit" }
|
||||
it("correctly reads the input as numeric") { assert_json_controls_passing(result) }
|
||||
end
|
||||
describe "when the --input is used with a integer value and is declared as a numeric type in metadata" do
|
||||
let(:input_opt) { "--input test_input_04=11" }
|
||||
let(:control_opt) { "--controls test_control_numeric_type" }
|
||||
it("correctly reads the input as numeric") { assert_json_controls_passing(result) }
|
||||
end
|
||||
describe "when the --input is used with a float value" do
|
||||
let(:input_opt) { "--input test_input_05=-11.0" }
|
||||
let(:control_opt) { "--controls test_control_numeric_float" }
|
||||
it("correctly reads the input as numeric") { assert_json_controls_passing(result) }
|
||||
end
|
||||
end
|
||||
|
||||
describe "when the --input is used twice with one value each" do
|
||||
let(:input_opt) { "--input test_input_01=value_from_cli_01 --input test_input_02=value_from_cli_02" }
|
||||
let(:control_opt) { "--controls test_control_02" }
|
||||
# Expected, though unfortunate, behavior is to only notice the second input
|
||||
it("correctly reads the input") { assert_json_controls_passing(result) }
|
||||
it("correctly reads the second input") { assert_json_controls_passing(result) }
|
||||
end
|
||||
|
||||
describe "when the --input is used with no equal sign" do
|
||||
|
|
Loading…
Add table
Reference in a new issue