From 95029203cd46c3af948bd93be9463bbd0be2c16f Mon Sep 17 00:00:00 2001 From: Christoph Hartmann Date: Fri, 19 Aug 2016 09:40:54 +0200 Subject: [PATCH] unique controls for dependency tests --- .../dependencies/inheritance/controls/example.rb | 11 ++++++----- .../dependencies/profile_a/controls/example.rb | 2 +- .../dependencies/profile_b/controls/example.rb | 2 +- .../dependencies/profile_c/controls/example.rb | 9 +++++++++ 4 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 test/unit/mock/profiles/dependencies/profile_c/controls/example.rb diff --git a/test/unit/mock/profiles/dependencies/inheritance/controls/example.rb b/test/unit/mock/profiles/dependencies/inheritance/controls/example.rb index c5b9e9526..b33fd1bdb 100644 --- a/test/unit/mock/profiles/dependencies/inheritance/controls/example.rb +++ b/test/unit/mock/profiles/dependencies/inheritance/controls/example.rb @@ -3,11 +3,12 @@ include_controls 'profile_a' include_controls 'profile_b' include_controls 'os-hardening' do - skip_control 'package-01' - skip_control 'package-02' - skip_control 'package-03' - skip_control 'package-04' - skip_control 'package-05' + skip_control 'os-01' + + 1.upto(5) do |i| + skip_control "package-%02d" % i + end + 1.upto(33) do |i| skip_control "sysctl-%02d" % i end diff --git a/test/unit/mock/profiles/dependencies/profile_a/controls/example.rb b/test/unit/mock/profiles/dependencies/profile_a/controls/example.rb index cedb258eb..1aeb05cb7 100644 --- a/test/unit/mock/profiles/dependencies/profile_a/controls/example.rb +++ b/test/unit/mock/profiles/dependencies/profile_a/controls/example.rb @@ -11,7 +11,7 @@ describe file('/tmp') do end # you add controls here -control 'tmp-1.0' do # A unique ID for this control +control 'profilea-1' do # A unique ID for this control impact 0.7 # The criticality, if this control fails. title 'Create /tmp directory' # A human-readable title desc 'An optional description...' diff --git a/test/unit/mock/profiles/dependencies/profile_b/controls/example.rb b/test/unit/mock/profiles/dependencies/profile_b/controls/example.rb index a62054c11..97e833de2 100644 --- a/test/unit/mock/profiles/dependencies/profile_b/controls/example.rb +++ b/test/unit/mock/profiles/dependencies/profile_b/controls/example.rb @@ -10,7 +10,7 @@ describe file('/tmp') do end # you add controls here -control 'tmp-1.0' do # A unique ID for this control +control 'profileb-1' do # A unique ID for this control impact 0.7 # The criticality, if this control fails. title 'Create /tmp directory' # A human-readable title desc 'An optional description...' diff --git a/test/unit/mock/profiles/dependencies/profile_c/controls/example.rb b/test/unit/mock/profiles/dependencies/profile_c/controls/example.rb new file mode 100644 index 000000000..5054f5787 --- /dev/null +++ b/test/unit/mock/profiles/dependencies/profile_c/controls/example.rb @@ -0,0 +1,9 @@ +# you add controls here +control 'profilec-1' do # A unique ID for this control + impact 0.7 # The criticality, if this control fails. + title 'Create /tmp directory' # A human-readable title + desc 'An optional description...' + describe file('/tmp') do # The actual test + it { should be_directory } + end +end