From 4cf9e23e9d131018ecbfad5565538d65a354632a Mon Sep 17 00:00:00 2001 From: Clinton Wolfe Date: Wed, 6 Feb 2019 18:10:19 -0500 Subject: [PATCH] Move most test fixture profiles under attributes/ Signed-off-by: Clinton Wolfe --- test/functional/attributes_test.rb | 16 ++++++++-------- .../attributes/{ => basic}/controls/flat.rb | 0 .../attributes/{ => basic}/controls/nested.rb | 0 .../{attributes => basic/files}/flat.yaml | 0 .../{attributes => basic/files}/nested.yaml | 0 .../profiles/attributes/{ => basic}/inspec.yml | 0 .../global}/controls/attribute_from_yml.rb | 0 .../global}/controls/attribute_inheritance.rb | 0 .../global}/controls/attribute_overrides.rb | 0 .../global}/controls/attribute_read_scoping.rb | 0 .../global}/files/attr.yml | 0 .../global}/inspec.lock | 0 .../global}/inspec.yml | 0 .../README.md | 0 .../controls/profile1.rb | 0 .../inspec.yml | 0 .../README.md | 0 .../controls/profile1.rb | 0 .../inspec.yml | 0 .../metadata-empty}/inspec.yml | 0 .../metadata-invalid}/inspec.yml | 0 .../required}/inspec.yml | 0 22 files changed, 8 insertions(+), 8 deletions(-) rename test/unit/mock/profiles/attributes/{ => basic}/controls/flat.rb (100%) rename test/unit/mock/profiles/attributes/{ => basic}/controls/nested.rb (100%) rename test/unit/mock/profiles/attributes/{attributes => basic/files}/flat.yaml (100%) rename test/unit/mock/profiles/attributes/{attributes => basic/files}/nested.yaml (100%) rename test/unit/mock/profiles/attributes/{ => basic}/inspec.yml (100%) rename test/unit/mock/profiles/{global_attributes => attributes/global}/controls/attribute_from_yml.rb (100%) rename test/unit/mock/profiles/{global_attributes => attributes/global}/controls/attribute_inheritance.rb (100%) rename test/unit/mock/profiles/{global_attributes => attributes/global}/controls/attribute_overrides.rb (100%) rename test/unit/mock/profiles/{global_attributes => attributes/global}/controls/attribute_read_scoping.rb (100%) rename test/unit/mock/profiles/{global_attributes => attributes/global}/files/attr.yml (100%) rename test/unit/mock/profiles/{global_attributes => attributes/global}/inspec.lock (100%) rename test/unit/mock/profiles/{global_attributes => attributes/global}/inspec.yml (100%) rename test/unit/mock/profiles/{global_attributes => attributes/global}/vendor/e39eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/README.md (100%) rename test/unit/mock/profiles/{global_attributes => attributes/global}/vendor/e39eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/controls/profile1.rb (100%) rename test/unit/mock/profiles/{global_attributes => attributes/global}/vendor/e39eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/inspec.yml (100%) rename test/unit/mock/profiles/{global_attributes => attributes/global}/vendor/f24eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/README.md (100%) rename test/unit/mock/profiles/{global_attributes => attributes/global}/vendor/f24eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/controls/profile1.rb (100%) rename test/unit/mock/profiles/{global_attributes => attributes/global}/vendor/f24eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/inspec.yml (100%) rename test/unit/mock/profiles/{profile-with-empty-attributes => attributes/metadata-empty}/inspec.yml (100%) rename test/unit/mock/profiles/{invalid_attributes => attributes/metadata-invalid}/inspec.yml (100%) rename test/unit/mock/profiles/{required_attributes => attributes/required}/inspec.yml (100%) diff --git a/test/functional/attributes_test.rb b/test/functional/attributes_test.rb index bbf83fc8d..145fd259f 100644 --- a/test/functional/attributes_test.rb +++ b/test/functional/attributes_test.rb @@ -4,16 +4,16 @@ require 'functional/helper' describe 'attributes' do include FunctionalHelper - + let(:attribute_profiles_path) { File.join(profile_path, 'attributes') } [ 'flat', 'nested', ].each do |attr_file| it "runs OK on #{attr_file} attributes" do cmd = 'exec ' - cmd += File.join(profile_path, 'attributes') + cmd += File.join(attribute_profiles_path, 'basic') cmd += ' --no-create-lockfile' - cmd += ' --attrs ' + File.join(profile_path, 'attributes', 'attributes', "#{attr_file}.yaml") + cmd += ' --attrs ' + File.join(attribute_profiles_path, 'basic', 'files', "#{attr_file}.yaml") cmd += ' --controls ' + attr_file out = inspec(cmd) out.stderr.must_equal '' @@ -24,9 +24,9 @@ describe 'attributes' do describe 'run profile with yaml attributes' do it "runs using yml attributes" do cmd = 'exec ' - cmd += File.join(profile_path, 'global_attributes') + cmd += File.join(attribute_profiles_path, 'global') cmd += ' --no-create-lockfile' - cmd += ' --attrs ' + File.join(profile_path, 'global_attributes', 'files', "attr.yml") + cmd += ' --attrs ' + File.join(attribute_profiles_path, 'global', 'files', "attr.yml") out = inspec(cmd) out.stderr.must_equal '' out.stdout.must_include '21 successful' @@ -35,7 +35,7 @@ describe 'attributes' do it "does not error when attributes are empty" do cmd = 'exec ' - cmd += File.join(profile_path, 'profile-with-empty-attributes') + cmd += File.join(attribute_profiles_path, 'metadata-empty') cmd += ' --no-create-lockfile' out = inspec(cmd) out.stdout.must_include 'WARN: Attributes must be defined as an Array. Skipping current definition.' @@ -44,7 +44,7 @@ describe 'attributes' do it "errors with invalid attribute types" do cmd = 'exec ' - cmd += File.join(profile_path, 'invalid_attributes') + cmd += File.join(attribute_profiles_path, 'metadata-invalid') cmd += ' --no-create-lockfile' out = inspec(cmd) out.stderr.must_equal "Type 'Color' is not a valid attribute type.\n" @@ -54,7 +54,7 @@ describe 'attributes' do it "errors with required attribute not defined" do cmd = 'exec ' - cmd += File.join(profile_path, 'required_attributes') + cmd += File.join(attribute_profiles_path, 'required') cmd += ' --no-create-lockfile' out = inspec(cmd) out.stderr.must_equal "Attribute 'username' is required and does not have a value.\n" diff --git a/test/unit/mock/profiles/attributes/controls/flat.rb b/test/unit/mock/profiles/attributes/basic/controls/flat.rb similarity index 100% rename from test/unit/mock/profiles/attributes/controls/flat.rb rename to test/unit/mock/profiles/attributes/basic/controls/flat.rb diff --git a/test/unit/mock/profiles/attributes/controls/nested.rb b/test/unit/mock/profiles/attributes/basic/controls/nested.rb similarity index 100% rename from test/unit/mock/profiles/attributes/controls/nested.rb rename to test/unit/mock/profiles/attributes/basic/controls/nested.rb diff --git a/test/unit/mock/profiles/attributes/attributes/flat.yaml b/test/unit/mock/profiles/attributes/basic/files/flat.yaml similarity index 100% rename from test/unit/mock/profiles/attributes/attributes/flat.yaml rename to test/unit/mock/profiles/attributes/basic/files/flat.yaml diff --git a/test/unit/mock/profiles/attributes/attributes/nested.yaml b/test/unit/mock/profiles/attributes/basic/files/nested.yaml similarity index 100% rename from test/unit/mock/profiles/attributes/attributes/nested.yaml rename to test/unit/mock/profiles/attributes/basic/files/nested.yaml diff --git a/test/unit/mock/profiles/attributes/inspec.yml b/test/unit/mock/profiles/attributes/basic/inspec.yml similarity index 100% rename from test/unit/mock/profiles/attributes/inspec.yml rename to test/unit/mock/profiles/attributes/basic/inspec.yml diff --git a/test/unit/mock/profiles/global_attributes/controls/attribute_from_yml.rb b/test/unit/mock/profiles/attributes/global/controls/attribute_from_yml.rb similarity index 100% rename from test/unit/mock/profiles/global_attributes/controls/attribute_from_yml.rb rename to test/unit/mock/profiles/attributes/global/controls/attribute_from_yml.rb diff --git a/test/unit/mock/profiles/global_attributes/controls/attribute_inheritance.rb b/test/unit/mock/profiles/attributes/global/controls/attribute_inheritance.rb similarity index 100% rename from test/unit/mock/profiles/global_attributes/controls/attribute_inheritance.rb rename to test/unit/mock/profiles/attributes/global/controls/attribute_inheritance.rb diff --git a/test/unit/mock/profiles/global_attributes/controls/attribute_overrides.rb b/test/unit/mock/profiles/attributes/global/controls/attribute_overrides.rb similarity index 100% rename from test/unit/mock/profiles/global_attributes/controls/attribute_overrides.rb rename to test/unit/mock/profiles/attributes/global/controls/attribute_overrides.rb diff --git a/test/unit/mock/profiles/global_attributes/controls/attribute_read_scoping.rb b/test/unit/mock/profiles/attributes/global/controls/attribute_read_scoping.rb similarity index 100% rename from test/unit/mock/profiles/global_attributes/controls/attribute_read_scoping.rb rename to test/unit/mock/profiles/attributes/global/controls/attribute_read_scoping.rb diff --git a/test/unit/mock/profiles/global_attributes/files/attr.yml b/test/unit/mock/profiles/attributes/global/files/attr.yml similarity index 100% rename from test/unit/mock/profiles/global_attributes/files/attr.yml rename to test/unit/mock/profiles/attributes/global/files/attr.yml diff --git a/test/unit/mock/profiles/global_attributes/inspec.lock b/test/unit/mock/profiles/attributes/global/inspec.lock similarity index 100% rename from test/unit/mock/profiles/global_attributes/inspec.lock rename to test/unit/mock/profiles/attributes/global/inspec.lock diff --git a/test/unit/mock/profiles/global_attributes/inspec.yml b/test/unit/mock/profiles/attributes/global/inspec.yml similarity index 100% rename from test/unit/mock/profiles/global_attributes/inspec.yml rename to test/unit/mock/profiles/attributes/global/inspec.yml diff --git a/test/unit/mock/profiles/global_attributes/vendor/e39eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/README.md b/test/unit/mock/profiles/attributes/global/vendor/e39eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/README.md similarity index 100% rename from test/unit/mock/profiles/global_attributes/vendor/e39eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/README.md rename to test/unit/mock/profiles/attributes/global/vendor/e39eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/README.md diff --git a/test/unit/mock/profiles/global_attributes/vendor/e39eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/controls/profile1.rb b/test/unit/mock/profiles/attributes/global/vendor/e39eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/controls/profile1.rb similarity index 100% rename from test/unit/mock/profiles/global_attributes/vendor/e39eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/controls/profile1.rb rename to test/unit/mock/profiles/attributes/global/vendor/e39eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/controls/profile1.rb diff --git a/test/unit/mock/profiles/global_attributes/vendor/e39eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/inspec.yml b/test/unit/mock/profiles/attributes/global/vendor/e39eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/inspec.yml similarity index 100% rename from test/unit/mock/profiles/global_attributes/vendor/e39eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/inspec.yml rename to test/unit/mock/profiles/attributes/global/vendor/e39eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/inspec.yml diff --git a/test/unit/mock/profiles/global_attributes/vendor/f24eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/README.md b/test/unit/mock/profiles/attributes/global/vendor/f24eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/README.md similarity index 100% rename from test/unit/mock/profiles/global_attributes/vendor/f24eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/README.md rename to test/unit/mock/profiles/attributes/global/vendor/f24eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/README.md diff --git a/test/unit/mock/profiles/global_attributes/vendor/f24eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/controls/profile1.rb b/test/unit/mock/profiles/attributes/global/vendor/f24eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/controls/profile1.rb similarity index 100% rename from test/unit/mock/profiles/global_attributes/vendor/f24eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/controls/profile1.rb rename to test/unit/mock/profiles/attributes/global/vendor/f24eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/controls/profile1.rb diff --git a/test/unit/mock/profiles/global_attributes/vendor/f24eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/inspec.yml b/test/unit/mock/profiles/attributes/global/vendor/f24eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/inspec.yml similarity index 100% rename from test/unit/mock/profiles/global_attributes/vendor/f24eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/inspec.yml rename to test/unit/mock/profiles/attributes/global/vendor/f24eb85366b272bae98e5eecdfac9f84c50a9ae9dd625fba2ce847268a6c3477/inspec.yml diff --git a/test/unit/mock/profiles/profile-with-empty-attributes/inspec.yml b/test/unit/mock/profiles/attributes/metadata-empty/inspec.yml similarity index 100% rename from test/unit/mock/profiles/profile-with-empty-attributes/inspec.yml rename to test/unit/mock/profiles/attributes/metadata-empty/inspec.yml diff --git a/test/unit/mock/profiles/invalid_attributes/inspec.yml b/test/unit/mock/profiles/attributes/metadata-invalid/inspec.yml similarity index 100% rename from test/unit/mock/profiles/invalid_attributes/inspec.yml rename to test/unit/mock/profiles/attributes/metadata-invalid/inspec.yml diff --git a/test/unit/mock/profiles/required_attributes/inspec.yml b/test/unit/mock/profiles/attributes/required/inspec.yml similarity index 100% rename from test/unit/mock/profiles/required_attributes/inspec.yml rename to test/unit/mock/profiles/attributes/required/inspec.yml