From adaf2bc364208e479890850c4b0447138a4d8cfe Mon Sep 17 00:00:00 2001 From: Ryan Davis Date: Mon, 20 May 2019 17:19:38 -0700 Subject: [PATCH 01/11] Removed aws resource requiring from test/helper and inspec/resource. This speeds up parallel unit test runs from a very consistent 2:49 to a very consistent 1:53, or a 33% reduction. Signed-off-by: Ryan Davis --- lib/inspec/resource.rb | 8 ++++---- lib/inspec/resources/file.rb | 2 ++ lib/inspec/resources/{login_def.rb => login_defs.rb} | 2 +- lib/inspec/resources/nginx_conf.rb | 3 ++- lib/inspec/resources/os.rb | 1 - lib/inspec/resources/powershell.rb | 8 ++++++-- .../resources/{rabbitmq_conf.rb => rabbitmq_config.rb} | 4 ++-- lib/inspec/resources/script.rb | 1 + lib/inspec/resources/service.rb | 2 +- lib/inspec/resources/{ssh_conf.rb => ssh_config.rb} | 4 ++-- lib/inspec/resources/vbscript.rb | 2 +- lib/inspec/resources/windows_task.rb | 2 +- lib/inspec/resources/{xinetd.rb => xinetd_conf.rb} | 0 lib/inspec/rule.rb | 2 ++ lib/inspec/shell.rb | 2 +- lib/inspec/utils/simpleconfig.rb | 1 + lib/resources/aws/aws_iam_user.rb | 2 ++ test/helper.rb | 2 -- test/helpers/mock_loader.rb | 4 ++++ test/unit/profiles/library_eval_context_test.rb | 1 - test/unit/profiles/profile_context_test.rb | 2 ++ .../unit/resource_supports/aws/aws_resource_mixin_test.rb | 3 +++ test/unit/resources/aide_conf_test.rb | 1 - test/unit/resources/apache_conf_test.rb | 1 - test/unit/resources/apt_test.rb | 1 - test/unit/resources/audit_policy_test.rb | 1 - test/unit/resources/auditd_conf_test.rb | 1 - test/unit/resources/auditd_test.rb | 1 - test/unit/resources/aws_billing_backend.rb | 2 ++ test/unit/resources/aws_billing_report_test.rb | 6 +++++- test/unit/resources/aws_billing_reports_test.rb | 4 ++++ test/unit/resources/aws_cloudtrail_trail_test.rb | 5 ++++- test/unit/resources/aws_cloudtrail_trails_test.rb | 3 +++ test/unit/resources/aws_cloudwatch_alarm_test.rb | 3 +++ .../resources/aws_cloudwatch_log_metric_filter_test.rb | 3 +++ test/unit/resources/aws_config_delivery_channel_test.rb | 3 +++ test/unit/resources/aws_config_recorder_test.rb | 3 +++ test/unit/resources/aws_ebs_volume_test.rb | 3 +++ test/unit/resources/aws_ebs_volumes_test.rb | 3 +++ test/unit/resources/aws_ec2_instance_test.rb | 3 +++ test/unit/resources/aws_ec2_instances_test.rb | 3 +++ test/unit/resources/aws_ecs_cluster_test.rb | 3 +++ test/unit/resources/aws_eks_cluster_test.rb | 3 +++ test/unit/resources/aws_elb_test.rb | 3 +++ test/unit/resources/aws_elbs_test.rb | 3 +++ test/unit/resources/aws_flow_log_test.rb | 3 +++ test/unit/resources/aws_iam_access_key_test.rb | 5 ++++- test/unit/resources/aws_iam_access_keys_test.rb | 3 +++ test/unit/resources/aws_iam_group_test.rb | 3 +++ test/unit/resources/aws_iam_groups_test.rb | 3 +++ test/unit/resources/aws_iam_password_policy_test.rb | 3 +++ test/unit/resources/aws_iam_policies_test.rb | 3 +++ test/unit/resources/aws_iam_policy_test.rb | 5 ++++- test/unit/resources/aws_iam_role_test.rb | 5 ++++- test/unit/resources/aws_iam_root_user_test.rb | 3 +++ test/unit/resources/aws_iam_user_test.rb | 3 +++ test/unit/resources/aws_iam_users_test.rb | 3 +++ test/unit/resources/aws_kms_key_test.rb | 5 ++++- test/unit/resources/aws_kms_keys_test.rb | 3 +++ test/unit/resources/aws_rds_instance_test.rb | 3 +++ test/unit/resources/aws_route_table_test.rb | 3 +++ test/unit/resources/aws_route_tables_test.rb | 3 +++ test/unit/resources/aws_s3_bucket_object_test.rb | 3 +++ test/unit/resources/aws_s3_bucket_test.rb | 3 +++ test/unit/resources/aws_s3_buckets_test.rb | 3 +++ test/unit/resources/aws_security_group_test.rb | 3 +++ test/unit/resources/aws_security_groups_test.rb | 3 +++ test/unit/resources/aws_sns_subscription_test.rb | 3 +++ test/unit/resources/aws_sns_topic_test.rb | 5 ++++- test/unit/resources/aws_sns_topics_test.rb | 3 +++ test/unit/resources/aws_sqs_queue_test.rb | 5 ++++- test/unit/resources/aws_subnet_test.rb | 3 +++ test/unit/resources/aws_subnets_test.rb | 3 +++ test/unit/resources/aws_vpc_test.rb | 3 +++ test/unit/resources/aws_vpcs_test.rb | 3 +++ test/unit/resources/bash_test.rb | 3 +-- test/unit/resources/bond_test.rb | 1 - test/unit/resources/bridge_test.rb | 1 - test/unit/resources/chocolatey_package_test.rb | 1 - test/unit/resources/command_test.rb | 1 - test/unit/resources/cpan_test.rb | 1 - test/unit/resources/cran_test.rb | 1 - test/unit/resources/crontab_test.rb | 1 - test/unit/resources/csv_test.rb | 1 - test/unit/resources/dh_params_test.rb | 1 - test/unit/resources/docker_container_test.rb | 1 - test/unit/resources/docker_image_test.rb | 1 - test/unit/resources/docker_plugin_test.rb | 1 - test/unit/resources/docker_service_test.rb | 1 - test/unit/resources/docker_test.rb | 1 - test/unit/resources/etc_fstab_test.rb | 1 - test/unit/resources/etc_group_test.rb | 1 - test/unit/resources/etc_hosts_allow_deny_test.rb | 1 - test/unit/resources/etc_hosts_test.rb | 1 - test/unit/resources/file_test.rb | 1 - test/unit/resources/filesystem_test.rb | 1 - test/unit/resources/firewalld_test.rb | 1 - test/unit/resources/gem_test.rb | 1 - test/unit/resources/group_test.rb | 1 - test/unit/resources/groups_test.rb | 1 - test/unit/resources/grub_conf_test.rb | 1 - test/unit/resources/host_test.rb | 1 - test/unit/resources/http_test.rb | 1 - test/unit/resources/iis_app_pool_test.rb | 1 - test/unit/resources/iis_site_test.rb | 1 - test/unit/resources/inetd_conf_test.rb | 1 - test/unit/resources/ini_test.rb | 1 - test/unit/resources/interface_test.rb | 1 - test/unit/resources/iptables_test.rb | 1 - test/unit/resources/json_test.rb | 1 - test/unit/resources/kernel_module_test.rb | 1 - test/unit/resources/kernel_parameter_test.rb | 1 - test/unit/resources/key_rsa_test.rb | 1 - test/unit/resources/ksh_test.rb | 1 - test/unit/resources/limits_conf_test.rb | 1 - test/unit/resources/login_def_test.rb | 1 - test/unit/resources/mount_test.rb | 1 - test/unit/resources/nginx_conf_test.rb | 1 - test/unit/resources/nginx_test.rb | 1 - test/unit/resources/npm_test.rb | 1 - test/unit/resources/ntp_conf_test.rb | 1 - test/unit/resources/oneget_test.rb | 1 - test/unit/resources/os_env_test.rb | 1 - test/unit/resources/os_test.rb | 1 - test/unit/resources/package_test.rb | 1 - test/unit/resources/packages_test.rb | 1 - test/unit/resources/parse_config_test.rb | 1 - test/unit/resources/passwd_test.rb | 1 - test/unit/resources/pip_test.rb | 1 - test/unit/resources/platform_test.rb | 1 - test/unit/resources/port_linuxports_test.rb | 2 +- test/unit/resources/port_test.rb | 1 - test/unit/resources/postgres_hba_conf_test.rb | 1 - test/unit/resources/postgres_ident_conf_test.rb | 1 - test/unit/resources/powershell_test.rb | 3 +-- test/unit/resources/processes_test.rb | 1 - test/unit/resources/rabbitmq_conf_test.rb | 1 - test/unit/resources/registry_key_test.rb | 1 - test/unit/resources/security_identifier_test.rb | 1 - test/unit/resources/security_policy_test.rb | 1 - test/unit/resources/service_test.rb | 1 - test/unit/resources/shadow_test.rb | 2 -- test/unit/resources/ssh_conf_test.rb | 3 +-- test/unit/resources/ssl_test.rb | 3 +-- test/unit/resources/sys_info_test.rb | 1 - test/unit/resources/toml_test.rb | 1 - test/unit/resources/user_test.rb | 1 - test/unit/resources/vbscript_test.rb | 1 - test/unit/resources/virtualization_test.rb | 2 +- test/unit/resources/windows_feature_test.rb | 1 - test/unit/resources/windows_hotfix_test.rb | 1 - test/unit/resources/windows_task_test.rb | 1 - test/unit/resources/wmi_test.rb | 1 - test/unit/resources/x509_certificate_test.rb | 1 - .../resources/{xinetd_test.rb => xinetd_conf_test.rb} | 1 - test/unit/resources/xml_test.rb | 1 - test/unit/resources/yaml_test.rb | 1 - test/unit/resources/yum_test.rb | 1 - test/unit/resources/zfs_dataset_test.rb | 1 - test/unit/resources/zfs_pool_test.rb | 1 - test/unit/utils/database_helpers_test.rb | 2 +- test/unit/utils/filter_array_test.rb | 1 + test/unit/utils/find_files_test.rb | 1 + test/unit/utils/object_traversal_test.rb | 1 + test/unit/utils/simpleconfig_test.rb | 1 + 165 files changed, 199 insertions(+), 125 deletions(-) rename lib/inspec/resources/{login_def.rb => login_defs.rb} (97%) rename lib/inspec/resources/{rabbitmq_conf.rb => rabbitmq_config.rb} (92%) create mode 100644 lib/inspec/resources/script.rb rename lib/inspec/resources/{ssh_conf.rb => ssh_config.rb} (97%) rename lib/inspec/resources/{xinetd.rb => xinetd_conf.rb} (100%) rename test/unit/resources/{xinetd_test.rb => xinetd_conf_test.rb} (99%) diff --git a/lib/inspec/resource.rb b/lib/inspec/resource.rb index 10411b625..cfa9ca8eb 100644 --- a/lib/inspec/resource.rb +++ b/lib/inspec/resource.rb @@ -142,7 +142,7 @@ require 'inspec/resources/kernel_parameter' require 'inspec/resources/key_rsa' require 'inspec/resources/ksh' require 'inspec/resources/limits_conf' -require 'inspec/resources/login_def' +require 'inspec/resources/login_defs' require 'inspec/resources/mount' require 'inspec/resources/mssql_session' require 'inspec/resources/mysql' @@ -170,13 +170,13 @@ require 'inspec/resources/postgres_ident_conf' require 'inspec/resources/postgres_session' require 'inspec/resources/powershell' require 'inspec/resources/processes' -require 'inspec/resources/rabbitmq_conf' +require 'inspec/resources/rabbitmq_config' require 'inspec/resources/registry_key' require 'inspec/resources/security_identifier' require 'inspec/resources/security_policy' require 'inspec/resources/service' require 'inspec/resources/shadow' -require 'inspec/resources/ssh_conf' +require 'inspec/resources/ssh_config' require 'inspec/resources/ssl' require 'inspec/resources/sys_info' require 'inspec/resources/toml' @@ -188,7 +188,7 @@ require 'inspec/resources/windows_hotfix' require 'inspec/resources/windows_task' require 'inspec/resources/wmi' require 'inspec/resources/x509_certificate' -require 'inspec/resources/xinetd' +require 'inspec/resources/xinetd_conf' require 'inspec/resources/yum' require 'inspec/resources/zfs_dataset' require 'inspec/resources/zfs_pool' diff --git a/lib/inspec/resources/file.rb b/lib/inspec/resources/file.rb index 180258826..d7e763732 100644 --- a/lib/inspec/resources/file.rb +++ b/lib/inspec/resources/file.rb @@ -1,6 +1,7 @@ # copyright: 2015, Vulcano Security GmbH require 'shellwords' +require 'inspec/utils/parser' module Inspec::Resources module FilePermissionsSelector @@ -13,6 +14,7 @@ module Inspec::Resources end end + # TODO: rename file_resource.rb class FileResource < Inspec.resource(1) include FilePermissionsSelector include LinuxMountParser diff --git a/lib/inspec/resources/login_def.rb b/lib/inspec/resources/login_defs.rb similarity index 97% rename from lib/inspec/resources/login_def.rb rename to lib/inspec/resources/login_defs.rb index bb9a3f19c..d8f771690 100644 --- a/lib/inspec/resources/login_def.rb +++ b/lib/inspec/resources/login_defs.rb @@ -16,7 +16,7 @@ require 'inspec/utils/file_reader' # end module Inspec::Resources - class LoginDef < Inspec.resource(1) + class LoginDefs < Inspec.resource(1) name 'login_defs' supports platform: 'unix' desc 'Use the login_defs InSpec audit resource to test configuration settings in the /etc/login.defs file. The logins.defs file defines site-specific configuration for the shadow password suite on Linux and UNIX platforms, such as password expiration ranges, minimum/maximum values for automatic selection of user and group identifiers, or the method with which passwords are encrypted.' diff --git a/lib/inspec/resources/nginx_conf.rb b/lib/inspec/resources/nginx_conf.rb index c209d9379..ad17b3ab6 100644 --- a/lib/inspec/resources/nginx_conf.rb +++ b/lib/inspec/resources/nginx_conf.rb @@ -174,7 +174,7 @@ module Inspec::Resources end end - class NginxConfServer + class NginxConfServer # TODO: rename NginxServer attr_reader :params, :parent def initialize(params, parent) @parent = parent @@ -216,6 +216,7 @@ module Inspec::Resources def to_s location = Array(params['_']).join(' ') # go three levels up: 1. to the server entry, 2. http entry and 3. to the root nginx conf + # TODO: fix parent.parent.parent @parent.parent.parent.to_s + ", location #{location.inspect}" end alias inspect to_s diff --git a/lib/inspec/resources/os.rb b/lib/inspec/resources/os.rb index 8d8f0ce5b..d721941fa 100644 --- a/lib/inspec/resources/os.rb +++ b/lib/inspec/resources/os.rb @@ -1,4 +1,3 @@ - require 'inspec/resources/platform' module Inspec::Resources diff --git a/lib/inspec/resources/powershell.rb b/lib/inspec/resources/powershell.rb index cc9372930..ffce6fb07 100644 --- a/lib/inspec/resources/powershell.rb +++ b/lib/inspec/resources/powershell.rb @@ -1,7 +1,7 @@ # copyright: 2015, Vulcano Security GmbH module Inspec::Resources - class PowershellScript < Cmd + class Powershell < Cmd name 'powershell' supports platform: 'windows' supports platform: 'unix' @@ -50,8 +50,10 @@ module Inspec::Resources end end + PowershellScript = Powershell + # this is deprecated syntax and will be removed in future versions - class LegacyPowershellScript < PowershellScript + class LegacyPowershell < Powershell name 'script' def initialize(script) @@ -59,4 +61,6 @@ module Inspec::Resources super(script) end end + + LegacyPowershellScript = LegacyPowershell end diff --git a/lib/inspec/resources/rabbitmq_conf.rb b/lib/inspec/resources/rabbitmq_config.rb similarity index 92% rename from lib/inspec/resources/rabbitmq_conf.rb rename to lib/inspec/resources/rabbitmq_config.rb index 6149ed637..a6c98f07e 100644 --- a/lib/inspec/resources/rabbitmq_conf.rb +++ b/lib/inspec/resources/rabbitmq_config.rb @@ -1,9 +1,9 @@ - require 'inspec/utils/erlang_parser' require 'inspec/utils/file_reader' module Inspec::Resources - class RabbitmqConf < Inspec.resource(1) + class RabbitmqConfig < Inspec.resource(1) + name 'rabbitmq_conf' # TODO: this is an alias. do we want this? name 'rabbitmq_config' supports platform: 'unix' desc 'Use the rabbitmq_config InSpec resource to test configuration data '\ diff --git a/lib/inspec/resources/script.rb b/lib/inspec/resources/script.rb new file mode 100644 index 000000000..252bfd6aa --- /dev/null +++ b/lib/inspec/resources/script.rb @@ -0,0 +1 @@ +require 'inspec/resources/powershell' diff --git a/lib/inspec/resources/service.rb b/lib/inspec/resources/service.rb index d64b9b9ad..74908f0ff 100644 --- a/lib/inspec/resources/service.rb +++ b/lib/inspec/resources/service.rb @@ -1,6 +1,6 @@ - require 'hashie' require 'inspec/utils/file_reader' +require 'inspec/utils/simpleconfig' module Inspec::Resources class Runlevels < Hash diff --git a/lib/inspec/resources/ssh_conf.rb b/lib/inspec/resources/ssh_config.rb similarity index 97% rename from lib/inspec/resources/ssh_conf.rb rename to lib/inspec/resources/ssh_config.rb index 3e8854cb9..184ccefc9 100644 --- a/lib/inspec/resources/ssh_conf.rb +++ b/lib/inspec/resources/ssh_config.rb @@ -4,7 +4,7 @@ require 'inspec/utils/simpleconfig' require 'inspec/utils/file_reader' module Inspec::Resources - class SshConf < Inspec.resource(1) + class SshConfig < Inspec.resource(1) name 'ssh_config' supports platform: 'unix' desc 'Use the `ssh_config` InSpec audit resource to test OpenSSH client configuration data located at `/etc/ssh/ssh_config` on Linux and Unix platforms.' @@ -75,7 +75,7 @@ module Inspec::Resources end end - class SshdConf < SshConf + class SshdConfig < SshConfig name 'sshd_config' supports platform: 'unix' desc 'Use the sshd_config InSpec audit resource to test configuration data for the Open SSH daemon located at /etc/ssh/sshd_config on Linux and UNIX platforms. sshd---the Open SSH daemon---listens on dedicated ports, starts a daemon for each incoming connection, and then handles encryption, authentication, key exchanges, command execution, and data exchanges.' diff --git a/lib/inspec/resources/vbscript.rb b/lib/inspec/resources/vbscript.rb index c21bcdb7d..a808f64ee 100644 --- a/lib/inspec/resources/vbscript.rb +++ b/lib/inspec/resources/vbscript.rb @@ -18,7 +18,7 @@ module Inspec::Resources # Since Windows does not delete tmp files automatically, we remove the VBScript # after we executed it # @see https://msdn.microsoft.com/en-us/library/aa364991.aspx - class VBScript < PowershellScript + class VBScript < Powershell name 'vbscript' supports platform: 'windows' desc '' diff --git a/lib/inspec/resources/windows_task.rb b/lib/inspec/resources/windows_task.rb index a4a70fddc..249ac32ea 100644 --- a/lib/inspec/resources/windows_task.rb +++ b/lib/inspec/resources/windows_task.rb @@ -1,5 +1,5 @@ module Inspec::Resources - class WindowsTasks < Inspec.resource(1) + class WindowsTasks < Inspec.resource(1) # TODO: rename singular name 'windows_task' supports platform: 'windows' desc 'Use the windows_task InSpec audit resource to test task schedules on Microsoft Windows.' diff --git a/lib/inspec/resources/xinetd.rb b/lib/inspec/resources/xinetd_conf.rb similarity index 100% rename from lib/inspec/resources/xinetd.rb rename to lib/inspec/resources/xinetd_conf.rb diff --git a/lib/inspec/rule.rb b/lib/inspec/rule.rb index b17c54605..e678de7d7 100644 --- a/lib/inspec/rule.rb +++ b/lib/inspec/rule.rb @@ -3,6 +3,8 @@ require 'method_source' require 'inspec/describe' require 'inspec/expect' +require 'inspec/resource' +require 'inspec/resources/os' module Inspec class Rule diff --git a/lib/inspec/shell.rb b/lib/inspec/shell.rb index 027dd38c3..76ed9b8a0 100644 --- a/lib/inspec/shell.rb +++ b/lib/inspec/shell.rb @@ -117,7 +117,7 @@ module Inspec end elsif topic == 'matchers' print_matchers_help - elsif !Inspec::Resource.registry[topic].nil? + elsif !Inspec::Resource.registry[topic].nil? # TODO: fix unnecessary logic topic_info = Inspec::Resource.registry[topic] info = "#{mark 'Name:'} #{topic}\n\n" unless topic_info.desc.nil? diff --git a/lib/inspec/utils/simpleconfig.rb b/lib/inspec/utils/simpleconfig.rb index 045cdebd5..f1eaed9e1 100644 --- a/lib/inspec/utils/simpleconfig.rb +++ b/lib/inspec/utils/simpleconfig.rb @@ -1,6 +1,7 @@ # copyright: 2015, Dominik Richter require 'inspec/utils/parser' +require 'hashie' class SimpleConfig include CommentParser diff --git a/lib/resources/aws/aws_iam_user.rb b/lib/resources/aws/aws_iam_user.rb index 92eade959..161133fab 100644 --- a/lib/resources/aws/aws_iam_user.rb +++ b/lib/resources/aws/aws_iam_user.rb @@ -1,3 +1,5 @@ +require 'resource_support/aws' + class AwsIamUser < Inspec.resource(1) name 'aws_iam_user' desc 'Verifies settings for AWS IAM user' diff --git a/test/helper.rb b/test/helper.rb index 12770c713..18de351c4 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -87,8 +87,6 @@ require 'inspec/version' require 'inspec/exceptions' require 'inspec/fetcher' require 'inspec/source_reader' -require 'inspec/resource' -require 'resource_support/aws' require 'inspec/reporters' require 'inspec/backend' require 'inspec/profile' diff --git a/test/helpers/mock_loader.rb b/test/helpers/mock_loader.rb index 47e027030..98b6a348a 100644 --- a/test/helpers/mock_loader.rb +++ b/test/helpers/mock_loader.rb @@ -46,6 +46,10 @@ class MockLoader @backend = Inspec::Backend.create(Inspec::Config.mock) mock = @backend.backend + def @backend.file(*) # BS version of it so stub calls won't blow up + super + end + # create all mock files local = Train.create('local', command_runner: :generic).connection diff --git a/test/unit/profiles/library_eval_context_test.rb b/test/unit/profiles/library_eval_context_test.rb index 520add193..cd469f4b6 100644 --- a/test/unit/profiles/library_eval_context_test.rb +++ b/test/unit/profiles/library_eval_context_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' require 'inspec/library_eval_context' describe Inspec::LibraryEvalContext do diff --git a/test/unit/profiles/profile_context_test.rb b/test/unit/profiles/profile_context_test.rb index 48ff854d3..3eec09324 100644 --- a/test/unit/profiles/profile_context_test.rb +++ b/test/unit/profiles/profile_context_test.rb @@ -1,6 +1,8 @@ require 'helper' require 'inspec/profile_context' +require 'inspec/resources/file' +require 'inspec/resources/command' class Module include Minitest::Spec::DSL diff --git a/test/unit/resource_supports/aws/aws_resource_mixin_test.rb b/test/unit/resource_supports/aws/aws_resource_mixin_test.rb index 17902f175..4e1e88b0a 100644 --- a/test/unit/resource_supports/aws/aws_resource_mixin_test.rb +++ b/test/unit/resource_supports/aws/aws_resource_mixin_test.rb @@ -2,6 +2,9 @@ require 'helper' +require 'resource_support/aws' +require 'resource_support/aws/aws_resource_mixin' + describe 'AwsResourceMixin' do describe 'initialize' do class AwsResourceMixinError diff --git a/test/unit/resources/aide_conf_test.rb b/test/unit/resources/aide_conf_test.rb index a4600872e..658acc49f 100644 --- a/test/unit/resources/aide_conf_test.rb +++ b/test/unit/resources/aide_conf_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::AideConf' do describe 'AideConf Parameters' do diff --git a/test/unit/resources/apache_conf_test.rb b/test/unit/resources/apache_conf_test.rb index eb762ab60..ecd590d95 100644 --- a/test/unit/resources/apache_conf_test.rb +++ b/test/unit/resources/apache_conf_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' require 'hashie' describe 'Inspec::Resources::ApacheConf' do diff --git a/test/unit/resources/apt_test.rb b/test/unit/resources/apt_test.rb index 3f98f615e..4fa6b1ca1 100644 --- a/test/unit/resources/apt_test.rb +++ b/test/unit/resources/apt_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::AptRepo' do diff --git a/test/unit/resources/audit_policy_test.rb b/test/unit/resources/audit_policy_test.rb index 7253feba5..8875567ec 100644 --- a/test/unit/resources/audit_policy_test.rb +++ b/test/unit/resources/audit_policy_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::AuditPolicy' do it 'check audit policy parsing' do diff --git a/test/unit/resources/auditd_conf_test.rb b/test/unit/resources/auditd_conf_test.rb index 763afa994..1b14f4299 100644 --- a/test/unit/resources/auditd_conf_test.rb +++ b/test/unit/resources/auditd_conf_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::AuditDaemonConf' do it 'check audit daemon config parsing' do diff --git a/test/unit/resources/auditd_test.rb b/test/unit/resources/auditd_test.rb index d6c663633..50f9d9cf6 100644 --- a/test/unit/resources/auditd_test.rb +++ b/test/unit/resources/auditd_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::AuditDaemon' do it 'auditd interface' do diff --git a/test/unit/resources/aws_billing_backend.rb b/test/unit/resources/aws_billing_backend.rb index cd71032f7..38347f600 100644 --- a/test/unit/resources/aws_billing_backend.rb +++ b/test/unit/resources/aws_billing_backend.rb @@ -1,3 +1,5 @@ +require 'resource_support/aws' + module MockAwsBillingReports class Empty < AwsBackendBase def describe_report_definitions(_query) diff --git a/test/unit/resources/aws_billing_report_test.rb b/test/unit/resources/aws_billing_report_test.rb index 43b5d0e72..5ab7f62dd 100644 --- a/test/unit/resources/aws_billing_report_test.rb +++ b/test/unit/resources/aws_billing_report_test.rb @@ -1,5 +1,9 @@ require 'helper' -require_relative 'aws_billing_backend' + +require_relative 'aws_billing_backend' # TODO: move this to mocks + +require 'resource_support/aws' +require 'resources/aws/aws_billing_report' class EmptyAwsBillingReportTest < Minitest::Test def setup diff --git a/test/unit/resources/aws_billing_reports_test.rb b/test/unit/resources/aws_billing_reports_test.rb index 8902b37c6..8ca524fa6 100644 --- a/test/unit/resources/aws_billing_reports_test.rb +++ b/test/unit/resources/aws_billing_reports_test.rb @@ -1,6 +1,10 @@ require 'helper' + require_relative 'aws_billing_backend' +require 'resource_support/aws' +require 'resources/aws/aws_billing_reports' + class ConstructorAwsBillingReportsTest < Minitest::Test def setup AwsBillingReports::BackendFactory.select(MockAwsBillingReports::Empty) diff --git a/test/unit/resources/aws_cloudtrail_trail_test.rb b/test/unit/resources/aws_cloudtrail_trail_test.rb index 3bd9476b3..9831f1127 100644 --- a/test/unit/resources/aws_cloudtrail_trail_test.rb +++ b/test/unit/resources/aws_cloudtrail_trail_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_cloudtrail_trail' + # MACTTSB = MockAwsCloudTrailTrailSingularBackend # Abbreviation not used outside this file @@ -183,4 +186,4 @@ module MACTTSB fixtures.detect { |f| f.name == query[:name] } end end -end \ No newline at end of file +end diff --git a/test/unit/resources/aws_cloudtrail_trails_test.rb b/test/unit/resources/aws_cloudtrail_trails_test.rb index ce1678fb1..1faeb2725 100644 --- a/test/unit/resources/aws_cloudtrail_trails_test.rb +++ b/test/unit/resources/aws_cloudtrail_trails_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_cloudtrail_trails' + # MACTTPB = MockAwsCloudTrailTrailsPluralBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_cloudwatch_alarm_test.rb b/test/unit/resources/aws_cloudwatch_alarm_test.rb index 7032f1545..a30f26092 100644 --- a/test/unit/resources/aws_cloudwatch_alarm_test.rb +++ b/test/unit/resources/aws_cloudwatch_alarm_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_cloudwatch_alarm' + # MCWAB = MockCloudwatchAlarmBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_cloudwatch_log_metric_filter_test.rb b/test/unit/resources/aws_cloudwatch_log_metric_filter_test.rb index 86d3b8e82..ac2920486 100644 --- a/test/unit/resources/aws_cloudwatch_log_metric_filter_test.rb +++ b/test/unit/resources/aws_cloudwatch_log_metric_filter_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_cloudwatch_log_metric_filter' + # CWLMF = CloudwatchLogMetricFilter # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_config_delivery_channel_test.rb b/test/unit/resources/aws_config_delivery_channel_test.rb index ce4746f7f..23aba2e12 100644 --- a/test/unit/resources/aws_config_delivery_channel_test.rb +++ b/test/unit/resources/aws_config_delivery_channel_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_config_delivery_channel' + # MDCSB = MockDeliveryChannelSingleBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_config_recorder_test.rb b/test/unit/resources/aws_config_recorder_test.rb index dba1cbe8c..8ac8211a3 100644 --- a/test/unit/resources/aws_config_recorder_test.rb +++ b/test/unit/resources/aws_config_recorder_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_config_recorder' + # MCRSB = MockConfigRecorderSingleBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_ebs_volume_test.rb b/test/unit/resources/aws_ebs_volume_test.rb index 3a78ce5e6..ee0695e61 100644 --- a/test/unit/resources/aws_ebs_volume_test.rb +++ b/test/unit/resources/aws_ebs_volume_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_ebs_volume' + class TestEbs < Minitest::Test Id = 'volume-id'.freeze diff --git a/test/unit/resources/aws_ebs_volumes_test.rb b/test/unit/resources/aws_ebs_volumes_test.rb index e08ec04a3..bd14b611b 100644 --- a/test/unit/resources/aws_ebs_volumes_test.rb +++ b/test/unit/resources/aws_ebs_volumes_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_ebs_volumes' + # MAEIPB = MockAwsEbsVolumesPluralBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_ec2_instance_test.rb b/test/unit/resources/aws_ec2_instance_test.rb index 5cc65069e..25ce7fce8 100644 --- a/test/unit/resources/aws_ec2_instance_test.rb +++ b/test/unit/resources/aws_ec2_instance_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_ec2_instance' + class TestEc2 < Minitest::Test Id = 'instance-id'.freeze InstanceProfile = 'instance-role'.freeze diff --git a/test/unit/resources/aws_ec2_instances_test.rb b/test/unit/resources/aws_ec2_instances_test.rb index cb52b835a..cdfba44d3 100644 --- a/test/unit/resources/aws_ec2_instances_test.rb +++ b/test/unit/resources/aws_ec2_instances_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_ec2_instances' + # MAEIPB = MockAwsEC2InstancesPluralBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_ecs_cluster_test.rb b/test/unit/resources/aws_ecs_cluster_test.rb index 5e625c2e6..6007cd3eb 100644 --- a/test/unit/resources/aws_ecs_cluster_test.rb +++ b/test/unit/resources/aws_ecs_cluster_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_ecs_cluster' + # MAECSB = MockAwsEcsClusterSingularBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_eks_cluster_test.rb b/test/unit/resources/aws_eks_cluster_test.rb index 6c5e22e97..025060606 100644 --- a/test/unit/resources/aws_eks_cluster_test.rb +++ b/test/unit/resources/aws_eks_cluster_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_eks_cluster' + # MAEKSB = MockAwsEksClusterSingularBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_elb_test.rb b/test/unit/resources/aws_elb_test.rb index fc5994a63..59a3a0d73 100644 --- a/test/unit/resources/aws_elb_test.rb +++ b/test/unit/resources/aws_elb_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_elb' + # MAESB = MockAwsElbSingularBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_elbs_test.rb b/test/unit/resources/aws_elbs_test.rb index 16b71d722..a507218e6 100644 --- a/test/unit/resources/aws_elbs_test.rb +++ b/test/unit/resources/aws_elbs_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_elbs' + # MAEPB = MockAwsELBsPluralBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_flow_log_test.rb b/test/unit/resources/aws_flow_log_test.rb index 7743d005a..379f3c925 100644 --- a/test/unit/resources/aws_flow_log_test.rb +++ b/test/unit/resources/aws_flow_log_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_flow_log' + class EmptyAwsFlowLog < Minitest::Test def setup AwsFlowLog::BackendFactory.select(MockAwsFlowLog::Empty) diff --git a/test/unit/resources/aws_iam_access_key_test.rb b/test/unit/resources/aws_iam_access_key_test.rb index 6343b10ce..4e223603a 100644 --- a/test/unit/resources/aws_iam_access_key_test.rb +++ b/test/unit/resources/aws_iam_access_key_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_iam_access_key' + class AwsIamAccessKeyConstructorTest < Minitest::Test def setup AwsIamAccessKey::BackendFactory.select(EmptyMAIKSB) @@ -205,4 +208,4 @@ class BasicMAIKSB < AwsBackendBase } fixtures[query[:access_key_id]] end -end \ No newline at end of file +end diff --git a/test/unit/resources/aws_iam_access_keys_test.rb b/test/unit/resources/aws_iam_access_keys_test.rb index a53b18678..ad550e99e 100644 --- a/test/unit/resources/aws_iam_access_keys_test.rb +++ b/test/unit/resources/aws_iam_access_keys_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_iam_access_keys' + #==========================================================# # Constructor Tests # #==========================================================# diff --git a/test/unit/resources/aws_iam_group_test.rb b/test/unit/resources/aws_iam_group_test.rb index 51fe72cc4..40297c3b1 100644 --- a/test/unit/resources/aws_iam_group_test.rb +++ b/test/unit/resources/aws_iam_group_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_iam_group' + # MAIGSB = MockAwsIamGroupSingularBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_iam_groups_test.rb b/test/unit/resources/aws_iam_groups_test.rb index a67e8dafd..1d7821bf3 100644 --- a/test/unit/resources/aws_iam_groups_test.rb +++ b/test/unit/resources/aws_iam_groups_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_iam_groups' + # MAIGPB = MockAwsIamGroupsPluralBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_iam_password_policy_test.rb b/test/unit/resources/aws_iam_password_policy_test.rb index 1dcf25245..0fe006ba4 100644 --- a/test/unit/resources/aws_iam_password_policy_test.rb +++ b/test/unit/resources/aws_iam_password_policy_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_iam_password_policy' + class AwsIamPasswordPolicyTest < Minitest::Test def setup @mock_conn = Minitest::Mock.new diff --git a/test/unit/resources/aws_iam_policies_test.rb b/test/unit/resources/aws_iam_policies_test.rb index 7e797e665..c7982947d 100644 --- a/test/unit/resources/aws_iam_policies_test.rb +++ b/test/unit/resources/aws_iam_policies_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_iam_policies' + # MAIPPB = MockAwsIamPoliciesPluralBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_iam_policy_test.rb b/test/unit/resources/aws_iam_policy_test.rb index 0ec0c009e..c1039e917 100644 --- a/test/unit/resources/aws_iam_policy_test.rb +++ b/test/unit/resources/aws_iam_policy_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_iam_policy' + # MAIPSB = MockAwsIamPolicySingularBackend # Abbreviation not used outside this file @@ -449,4 +452,4 @@ module MAIPSB raise Aws::IAM::Errors::NoSuchEntity.new(nil, nil) end end -end \ No newline at end of file +end diff --git a/test/unit/resources/aws_iam_role_test.rb b/test/unit/resources/aws_iam_role_test.rb index 5cebd7365..710064afa 100644 --- a/test/unit/resources/aws_iam_role_test.rb +++ b/test/unit/resources/aws_iam_role_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_iam_role' + # MIRB = MockIamRoleBackend # Abbreviation not used outside this file @@ -99,4 +102,4 @@ module AwsMIRB }) end end -end \ No newline at end of file +end diff --git a/test/unit/resources/aws_iam_root_user_test.rb b/test/unit/resources/aws_iam_root_user_test.rb index b56a83669..83d481750 100644 --- a/test/unit/resources/aws_iam_root_user_test.rb +++ b/test/unit/resources/aws_iam_root_user_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_iam_root_user' + class AwsIamRootUserTest < Minitest::Test def setup @mock_conn = Minitest::Mock.new diff --git a/test/unit/resources/aws_iam_user_test.rb b/test/unit/resources/aws_iam_user_test.rb index 68f43c4fc..fcaa5c7be 100644 --- a/test/unit/resources/aws_iam_user_test.rb +++ b/test/unit/resources/aws_iam_user_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_iam_user' + # MAUIB = MockAwsIamUserBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_iam_users_test.rb b/test/unit/resources/aws_iam_users_test.rb index 460e2dab8..1454a0307 100644 --- a/test/unit/resources/aws_iam_users_test.rb +++ b/test/unit/resources/aws_iam_users_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_iam_users' + # Maiusb = Mock AwsIamUsers::BackendFactory # Abbreviation not used outside of this file diff --git a/test/unit/resources/aws_kms_key_test.rb b/test/unit/resources/aws_kms_key_test.rb index 0bc33fb20..d671a75dc 100644 --- a/test/unit/resources/aws_kms_key_test.rb +++ b/test/unit/resources/aws_kms_key_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_kms_key' + # MAKKSB = MockAwsKmsKeyBackend # Abbreviation not used outside this file @@ -224,4 +227,4 @@ module MAKKSB raise Aws::KMS::Errors::NotFoundException.new(nil, nil) end end -end \ No newline at end of file +end diff --git a/test/unit/resources/aws_kms_keys_test.rb b/test/unit/resources/aws_kms_keys_test.rb index d3bcb3a84..cf9bf8760 100644 --- a/test/unit/resources/aws_kms_keys_test.rb +++ b/test/unit/resources/aws_kms_keys_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_kms_keys' + # MAKKPB = MockAwsKmsKeysPluralBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_rds_instance_test.rb b/test/unit/resources/aws_rds_instance_test.rb index 3ac646b58..2d1b29864 100644 --- a/test/unit/resources/aws_rds_instance_test.rb +++ b/test/unit/resources/aws_rds_instance_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_rds_instance' + # MRDSIB = MockRDSInstanceBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_route_table_test.rb b/test/unit/resources/aws_route_table_test.rb index dc9c9e1b3..656d28d26 100644 --- a/test/unit/resources/aws_route_table_test.rb +++ b/test/unit/resources/aws_route_table_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_route_table' + class EmptyAwsRouteTableTest < Minitest::Test def setup AwsRouteTable::BackendFactory.select(AwsMRtbB::Empty) diff --git a/test/unit/resources/aws_route_tables_test.rb b/test/unit/resources/aws_route_tables_test.rb index ab0942ff2..366cb5c39 100644 --- a/test/unit/resources/aws_route_tables_test.rb +++ b/test/unit/resources/aws_route_tables_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_route_tables' + class EmptyAwsRouteTablesTest < Minitest::Test def setup AwsRouteTables::BackendFactory.select(AwsMRtbsB::Empty) diff --git a/test/unit/resources/aws_s3_bucket_object_test.rb b/test/unit/resources/aws_s3_bucket_object_test.rb index 35c6df72f..6dd79f895 100644 --- a/test/unit/resources/aws_s3_bucket_object_test.rb +++ b/test/unit/resources/aws_s3_bucket_object_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_s3_bucket_object' + # MSBOSB = MockS3BucketObjectSingleBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_s3_bucket_test.rb b/test/unit/resources/aws_s3_bucket_test.rb index f99aadb1c..796cba353 100644 --- a/test/unit/resources/aws_s3_bucket_test.rb +++ b/test/unit/resources/aws_s3_bucket_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_s3_bucket' + # MSBSB = MockS3BucketSingleBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_s3_buckets_test.rb b/test/unit/resources/aws_s3_buckets_test.rb index 6dbc07ac8..49caedf2a 100644 --- a/test/unit/resources/aws_s3_buckets_test.rb +++ b/test/unit/resources/aws_s3_buckets_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_s3_buckets' + # MSBB = MockS3BucketsBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_security_group_test.rb b/test/unit/resources/aws_security_group_test.rb index 2cd4e3447..567ebaec7 100644 --- a/test/unit/resources/aws_security_group_test.rb +++ b/test/unit/resources/aws_security_group_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_security_group' + # MESGSB = MockEc2SecurityGroupSingleBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_security_groups_test.rb b/test/unit/resources/aws_security_groups_test.rb index d401d8318..cbe0b0500 100644 --- a/test/unit/resources/aws_security_groups_test.rb +++ b/test/unit/resources/aws_security_groups_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_security_groups' + # MESGB = MockSecurityGroupBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_sns_subscription_test.rb b/test/unit/resources/aws_sns_subscription_test.rb index 5286bd31a..787d22b20 100644 --- a/test/unit/resources/aws_sns_subscription_test.rb +++ b/test/unit/resources/aws_sns_subscription_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_sns_subscription' + # MASSSB = MockAwsSNSSubscriptionSingularBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_sns_topic_test.rb b/test/unit/resources/aws_sns_topic_test.rb index b1a0333d9..3da5c898c 100644 --- a/test/unit/resources/aws_sns_topic_test.rb +++ b/test/unit/resources/aws_sns_topic_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_sns_topic' + # MSNB = MockSnsBackend # Abbreviation not used outside this file @@ -121,4 +124,4 @@ module AwsMSNB }) end end -end \ No newline at end of file +end diff --git a/test/unit/resources/aws_sns_topics_test.rb b/test/unit/resources/aws_sns_topics_test.rb index 3f5d69d86..652e6c021 100644 --- a/test/unit/resources/aws_sns_topics_test.rb +++ b/test/unit/resources/aws_sns_topics_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_sns_topics' + # MSTB = MockSnsTopicsBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_sqs_queue_test.rb b/test/unit/resources/aws_sqs_queue_test.rb index 874949738..93ec4c0b4 100644 --- a/test/unit/resources/aws_sqs_queue_test.rb +++ b/test/unit/resources/aws_sqs_queue_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_sqs_queue' + # MSQB = MockSQsBackend # Abbreviation not used outside this file @@ -123,4 +126,4 @@ module AwsMSQB }) end end -end \ No newline at end of file +end diff --git a/test/unit/resources/aws_subnet_test.rb b/test/unit/resources/aws_subnet_test.rb index 886992428..2a7d343ad 100644 --- a/test/unit/resources/aws_subnet_test.rb +++ b/test/unit/resources/aws_subnet_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_subnet' + # MVSSB = MockVpcSubnetSingleBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_subnets_test.rb b/test/unit/resources/aws_subnets_test.rb index cedc8ed39..e653e541c 100644 --- a/test/unit/resources/aws_subnets_test.rb +++ b/test/unit/resources/aws_subnets_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_subnets' + # MVSB = MockVpcSubnetsBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_vpc_test.rb b/test/unit/resources/aws_vpc_test.rb index e763eb57b..5b461b0f0 100644 --- a/test/unit/resources/aws_vpc_test.rb +++ b/test/unit/resources/aws_vpc_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'resource_support/aws' +require 'resources/aws/aws_vpc' + # MAVSB = MockAwsVpcSingularBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/aws_vpcs_test.rb b/test/unit/resources/aws_vpcs_test.rb index b41e8bae3..342557161 100644 --- a/test/unit/resources/aws_vpcs_test.rb +++ b/test/unit/resources/aws_vpcs_test.rb @@ -1,6 +1,9 @@ require 'helper' require 'ipaddr' +require 'resource_support/aws' +require 'resources/aws/aws_vpcs' + # MAVPB = MockAwsVpcsPluralBackend # Abbreviation not used outside this file diff --git a/test/unit/resources/bash_test.rb b/test/unit/resources/bash_test.rb index e6715e69e..5f766e6e4 100644 --- a/test/unit/resources/bash_test.rb +++ b/test/unit/resources/bash_test.rb @@ -1,8 +1,7 @@ require 'helper' -require 'inspec/resource' -describe Inspec::Resources::Bash do +describe "Inspec::Resources::Bash" do let(:x) { rand.to_s } let(:resource) { load_resource('bash', '$("'+x+'")') } diff --git a/test/unit/resources/bond_test.rb b/test/unit/resources/bond_test.rb index c211f279b..f5e618464 100644 --- a/test/unit/resources/bond_test.rb +++ b/test/unit/resources/bond_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::Bond' do diff --git a/test/unit/resources/bridge_test.rb b/test/unit/resources/bridge_test.rb index 9bffaef7a..11875f603 100644 --- a/test/unit/resources/bridge_test.rb +++ b/test/unit/resources/bridge_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::Bridge' do diff --git a/test/unit/resources/chocolatey_package_test.rb b/test/unit/resources/chocolatey_package_test.rb index 81eb48a04..8d5edb9f5 100644 --- a/test/unit/resources/chocolatey_package_test.rb +++ b/test/unit/resources/chocolatey_package_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' def skip(*args) # noop diff --git a/test/unit/resources/command_test.rb b/test/unit/resources/command_test.rb index aa41c8d79..304a919ee 100644 --- a/test/unit/resources/command_test.rb +++ b/test/unit/resources/command_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe Inspec::Resources::Cmd do let(:x) { rand.to_s } diff --git a/test/unit/resources/cpan_test.rb b/test/unit/resources/cpan_test.rb index efb330bfd..3e9f2dfc6 100644 --- a/test/unit/resources/cpan_test.rb +++ b/test/unit/resources/cpan_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::Cpan' do it 'verify cpan package detail parsing' do diff --git a/test/unit/resources/cran_test.rb b/test/unit/resources/cran_test.rb index 71ccd60c8..c712d6c69 100644 --- a/test/unit/resources/cran_test.rb +++ b/test/unit/resources/cran_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::Cran' do it 'verify cran package detail parsing' do diff --git a/test/unit/resources/crontab_test.rb b/test/unit/resources/crontab_test.rb index 6c5d22bde..69d2912cb 100644 --- a/test/unit/resources/crontab_test.rb +++ b/test/unit/resources/crontab_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::Crontab' do let(:crontab) { load_resource('crontab') } diff --git a/test/unit/resources/csv_test.rb b/test/unit/resources/csv_test.rb index fe64e2087..b0478cdf5 100644 --- a/test/unit/resources/csv_test.rb +++ b/test/unit/resources/csv_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::CSV' do describe 'when loading a valid csv' do diff --git a/test/unit/resources/dh_params_test.rb b/test/unit/resources/dh_params_test.rb index c9c394d67..e3b7f5032 100644 --- a/test/unit/resources/dh_params_test.rb +++ b/test/unit/resources/dh_params_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::DhParams' do let (:resource_dh_params) { load_resource('dh_params', 'dh_params.dh_pem')} diff --git a/test/unit/resources/docker_container_test.rb b/test/unit/resources/docker_container_test.rb index 4feb789b0..24cbfa3c6 100644 --- a/test/unit/resources/docker_container_test.rb +++ b/test/unit/resources/docker_container_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::DockerContainer' do describe 'docker_container' do diff --git a/test/unit/resources/docker_image_test.rb b/test/unit/resources/docker_image_test.rb index 686d6b39d..20ba1886f 100644 --- a/test/unit/resources/docker_image_test.rb +++ b/test/unit/resources/docker_image_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::DockerImage' do describe 'docker_image' do diff --git a/test/unit/resources/docker_plugin_test.rb b/test/unit/resources/docker_plugin_test.rb index f45f6a536..abbe35c37 100644 --- a/test/unit/resources/docker_plugin_test.rb +++ b/test/unit/resources/docker_plugin_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::DockerContainer' do describe 'docker_plugin' do diff --git a/test/unit/resources/docker_service_test.rb b/test/unit/resources/docker_service_test.rb index 8b554d1fa..a797988c6 100644 --- a/test/unit/resources/docker_service_test.rb +++ b/test/unit/resources/docker_service_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::DockerService' do describe 'docker_service' do diff --git a/test/unit/resources/docker_test.rb b/test/unit/resources/docker_test.rb index 99bd48e5c..65a791dc9 100644 --- a/test/unit/resources/docker_test.rb +++ b/test/unit/resources/docker_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::Docker' do describe 'docker' do diff --git a/test/unit/resources/etc_fstab_test.rb b/test/unit/resources/etc_fstab_test.rb index cf4191139..578997682 100644 --- a/test/unit/resources/etc_fstab_test.rb +++ b/test/unit/resources/etc_fstab_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::Fstab' do let(:resource) { load_resource('etc_fstab') } diff --git a/test/unit/resources/etc_group_test.rb b/test/unit/resources/etc_group_test.rb index 96c956a83..ed4ad1f3e 100644 --- a/test/unit/resources/etc_group_test.rb +++ b/test/unit/resources/etc_group_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::EtcGroup' do let(:resource) { load_resource('etc_group') } diff --git a/test/unit/resources/etc_hosts_allow_deny_test.rb b/test/unit/resources/etc_hosts_allow_deny_test.rb index a7fa38474..73607cb3c 100644 --- a/test/unit/resources/etc_hosts_allow_deny_test.rb +++ b/test/unit/resources/etc_hosts_allow_deny_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::EtcHostsAllow' do describe 'EtcHostsAllow Paramaters' do diff --git a/test/unit/resources/etc_hosts_test.rb b/test/unit/resources/etc_hosts_test.rb index 83e6d8776..39942d086 100644 --- a/test/unit/resources/etc_hosts_test.rb +++ b/test/unit/resources/etc_hosts_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::EtcHosts' do let(:resource) { load_resource('etc_hosts') } diff --git a/test/unit/resources/file_test.rb b/test/unit/resources/file_test.rb index 2ec833fda..73e874918 100644 --- a/test/unit/resources/file_test.rb +++ b/test/unit/resources/file_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe Inspec::Resources::FileResource do let(:file) { stub(unix_mode_mask: 000, mode: 000) } diff --git a/test/unit/resources/filesystem_test.rb b/test/unit/resources/filesystem_test.rb index 504270427..b58f25b8a 100644 --- a/test/unit/resources/filesystem_test.rb +++ b/test/unit/resources/filesystem_test.rb @@ -1,5 +1,4 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::FileSystemResource' do # arch linux diff --git a/test/unit/resources/firewalld_test.rb b/test/unit/resources/firewalld_test.rb index 35d7dc5fb..144aa1492 100644 --- a/test/unit/resources/firewalld_test.rb +++ b/test/unit/resources/firewalld_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::FirewallD' do centResource = MockLoader.new(:centos7).load_resource('firewalld') diff --git a/test/unit/resources/gem_test.rb b/test/unit/resources/gem_test.rb index b3f03973e..e0576bb4f 100644 --- a/test/unit/resources/gem_test.rb +++ b/test/unit/resources/gem_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::Gem' do it 'verify gem is not installed' do diff --git a/test/unit/resources/group_test.rb b/test/unit/resources/group_test.rb index 4c9c63691..0dfdaaff8 100644 --- a/test/unit/resources/group_test.rb +++ b/test/unit/resources/group_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::Group' do diff --git a/test/unit/resources/groups_test.rb b/test/unit/resources/groups_test.rb index 328cceff7..621fe3399 100644 --- a/test/unit/resources/groups_test.rb +++ b/test/unit/resources/groups_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'groups resource on unix platform' do let(:resource) { MockLoader.new(:ubuntu1404).load_resource('groups') } diff --git a/test/unit/resources/grub_conf_test.rb b/test/unit/resources/grub_conf_test.rb index 64df67b5c..4c5f32686 100644 --- a/test/unit/resources/grub_conf_test.rb +++ b/test/unit/resources/grub_conf_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::GrubConfig' do diff --git a/test/unit/resources/host_test.rb b/test/unit/resources/host_test.rb index e8773de9e..b78b3e077 100644 --- a/test/unit/resources/host_test.rb +++ b/test/unit/resources/host_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::Host' do diff --git a/test/unit/resources/http_test.rb b/test/unit/resources/http_test.rb index 201c8a22b..3a41ad6bb 100644 --- a/test/unit/resources/http_test.rb +++ b/test/unit/resources/http_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' require "faraday_middleware/response/follow_redirects" describe 'Inspec::Resources::Http' do diff --git a/test/unit/resources/iis_app_pool_test.rb b/test/unit/resources/iis_app_pool_test.rb index f1a517141..785bd0320 100644 --- a/test/unit/resources/iis_app_pool_test.rb +++ b/test/unit/resources/iis_app_pool_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::IisAppPool' do it 'verify default app pool settings' do diff --git a/test/unit/resources/iis_site_test.rb b/test/unit/resources/iis_site_test.rb index 022300b9d..35b08738a 100644 --- a/test/unit/resources/iis_site_test.rb +++ b/test/unit/resources/iis_site_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::IisSite' do it 'verify Default Web Site settings' do diff --git a/test/unit/resources/inetd_conf_test.rb b/test/unit/resources/inetd_conf_test.rb index 6ceb2e148..4942767ef 100644 --- a/test/unit/resources/inetd_conf_test.rb +++ b/test/unit/resources/inetd_conf_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::InetdConf' do it 'verify limits.conf config parsing' do diff --git a/test/unit/resources/ini_test.rb b/test/unit/resources/ini_test.rb index 1a1d4cdce..5d7d5c6d2 100644 --- a/test/unit/resources/ini_test.rb +++ b/test/unit/resources/ini_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::Ini' do diff --git a/test/unit/resources/interface_test.rb b/test/unit/resources/interface_test.rb index b8e80b0a9..607a73856 100644 --- a/test/unit/resources/interface_test.rb +++ b/test/unit/resources/interface_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::Interface' do diff --git a/test/unit/resources/iptables_test.rb b/test/unit/resources/iptables_test.rb index a2936dea7..16f7cd7a5 100644 --- a/test/unit/resources/iptables_test.rb +++ b/test/unit/resources/iptables_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::Iptables' do diff --git a/test/unit/resources/json_test.rb b/test/unit/resources/json_test.rb index c86d33c8e..025de52cb 100644 --- a/test/unit/resources/json_test.rb +++ b/test/unit/resources/json_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::JSON' do describe 'when loading a valid json' do diff --git a/test/unit/resources/kernel_module_test.rb b/test/unit/resources/kernel_module_test.rb index aa1274c08..42dd47a9d 100644 --- a/test/unit/resources/kernel_module_test.rb +++ b/test/unit/resources/kernel_module_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::KernelModule' do diff --git a/test/unit/resources/kernel_parameter_test.rb b/test/unit/resources/kernel_parameter_test.rb index 996424232..e0615f4b0 100644 --- a/test/unit/resources/kernel_parameter_test.rb +++ b/test/unit/resources/kernel_parameter_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::KernelParameter' do it 'verify kernel_parameter parsing' do diff --git a/test/unit/resources/key_rsa_test.rb b/test/unit/resources/key_rsa_test.rb index 9a97221a0..18f3a79ae 100644 --- a/test/unit/resources/key_rsa_test.rb +++ b/test/unit/resources/key_rsa_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::RsaKey' do let (:resource_key) { load_resource('key_rsa', 'test_certificate.rsa.key.pem')} diff --git a/test/unit/resources/ksh_test.rb b/test/unit/resources/ksh_test.rb index d65598800..8450d85e5 100644 --- a/test/unit/resources/ksh_test.rb +++ b/test/unit/resources/ksh_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe Inspec::Resources::Ksh do let(:x) { rand.to_s } diff --git a/test/unit/resources/limits_conf_test.rb b/test/unit/resources/limits_conf_test.rb index 117a1df82..9b5646806 100644 --- a/test/unit/resources/limits_conf_test.rb +++ b/test/unit/resources/limits_conf_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::LimitsConf' do it 'verify limits.conf config parsing' do diff --git a/test/unit/resources/login_def_test.rb b/test/unit/resources/login_def_test.rb index 446fcf6a3..afba3b54d 100644 --- a/test/unit/resources/login_def_test.rb +++ b/test/unit/resources/login_def_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::LoginDef' do it 'verify login.def config parsing' do diff --git a/test/unit/resources/mount_test.rb b/test/unit/resources/mount_test.rb index bfe10f4a9..10c682f68 100644 --- a/test/unit/resources/mount_test.rb +++ b/test/unit/resources/mount_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe Inspec::Resources::FileResource do let(:root_resource) { load_resource('mount', '/') } diff --git a/test/unit/resources/nginx_conf_test.rb b/test/unit/resources/nginx_conf_test.rb index dec954e76..e00ec90af 100644 --- a/test/unit/resources/nginx_conf_test.rb +++ b/test/unit/resources/nginx_conf_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::NginxConf' do # None of these tests currently work correctly on windows. See the diff --git a/test/unit/resources/nginx_test.rb b/test/unit/resources/nginx_test.rb index b8bd25c93..7713cc9cb 100644 --- a/test/unit/resources/nginx_test.rb +++ b/test/unit/resources/nginx_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::Nginx' do describe 'NGINX Methods' do diff --git a/test/unit/resources/npm_test.rb b/test/unit/resources/npm_test.rb index c10a2acce..6b87e7072 100644 --- a/test/unit/resources/npm_test.rb +++ b/test/unit/resources/npm_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::Npm' do it 'verify npm package detail parsing' do diff --git a/test/unit/resources/ntp_conf_test.rb b/test/unit/resources/ntp_conf_test.rb index 51b4c1f95..76f1c99a9 100644 --- a/test/unit/resources/ntp_conf_test.rb +++ b/test/unit/resources/ntp_conf_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::NtpConf' do it 'verify ntp config parsing' do diff --git a/test/unit/resources/oneget_test.rb b/test/unit/resources/oneget_test.rb index 1d44bbcca..d53041294 100644 --- a/test/unit/resources/oneget_test.rb +++ b/test/unit/resources/oneget_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::OneGet' do diff --git a/test/unit/resources/os_env_test.rb b/test/unit/resources/os_env_test.rb index 9c4c46781..d19c49224 100644 --- a/test/unit/resources/os_env_test.rb +++ b/test/unit/resources/os_env_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::OsEnv' do it 'verify env parsing' do diff --git a/test/unit/resources/os_test.rb b/test/unit/resources/os_test.rb index e0052df6c..8a476fa88 100644 --- a/test/unit/resources/os_test.rb +++ b/test/unit/resources/os_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::Os' do it 'verify os parsing on CentOS' do diff --git a/test/unit/resources/package_test.rb b/test/unit/resources/package_test.rb index 2a246553d..de02b8538 100644 --- a/test/unit/resources/package_test.rb +++ b/test/unit/resources/package_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::Package' do # arch linux diff --git a/test/unit/resources/packages_test.rb b/test/unit/resources/packages_test.rb index 34d3ba6c3..22088e35b 100644 --- a/test/unit/resources/packages_test.rb +++ b/test/unit/resources/packages_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::Packages' do it 'verify packages resource' do diff --git a/test/unit/resources/parse_config_test.rb b/test/unit/resources/parse_config_test.rb index f7108f2f4..820e906af 100644 --- a/test/unit/resources/parse_config_test.rb +++ b/test/unit/resources/parse_config_test.rb @@ -1,5 +1,4 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::ParseConfig' do diff --git a/test/unit/resources/passwd_test.rb b/test/unit/resources/passwd_test.rb index 2c38c7885..4b5e233ef 100644 --- a/test/unit/resources/passwd_test.rb +++ b/test/unit/resources/passwd_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::Passwd' do let(:passwd) { load_resource('passwd') } diff --git a/test/unit/resources/pip_test.rb b/test/unit/resources/pip_test.rb index d0b6101cd..4b4354136 100644 --- a/test/unit/resources/pip_test.rb +++ b/test/unit/resources/pip_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::Pip' do it 'verify pip package detail parsing' do diff --git a/test/unit/resources/platform_test.rb b/test/unit/resources/platform_test.rb index 5e752dbff..df25effe4 100644 --- a/test/unit/resources/platform_test.rb +++ b/test/unit/resources/platform_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::Platform' do let(:resource) { resource = MockLoader.new(:ubuntu1504).load_resource('platform') } diff --git a/test/unit/resources/port_linuxports_test.rb b/test/unit/resources/port_linuxports_test.rb index 6721b60f5..19b3ddbc6 100644 --- a/test/unit/resources/port_linuxports_test.rb +++ b/test/unit/resources/port_linuxports_test.rb @@ -1,5 +1,5 @@ require 'helper' -require 'inspec/resource' +require 'utils/parser' class TestLinuxPorts < Minitest::Test def setup diff --git a/test/unit/resources/port_test.rb b/test/unit/resources/port_test.rb index ee70ddf65..f82f27ed8 100644 --- a/test/unit/resources/port_test.rb +++ b/test/unit/resources/port_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::Port' do it 'verify port on Ubuntu 14.04' do diff --git a/test/unit/resources/postgres_hba_conf_test.rb b/test/unit/resources/postgres_hba_conf_test.rb index 5c8966a12..ab2aecaaa 100644 --- a/test/unit/resources/postgres_hba_conf_test.rb +++ b/test/unit/resources/postgres_hba_conf_test.rb @@ -1,7 +1,6 @@ # copyright: 2017 require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::PGHbaConf' do describe 'PGHbaConf Paramaters' do diff --git a/test/unit/resources/postgres_ident_conf_test.rb b/test/unit/resources/postgres_ident_conf_test.rb index f9afa9dec..08e784e63 100644 --- a/test/unit/resources/postgres_ident_conf_test.rb +++ b/test/unit/resources/postgres_ident_conf_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::PGIdentConf' do describe 'PGIdentConf Paramaters' do diff --git a/test/unit/resources/powershell_test.rb b/test/unit/resources/powershell_test.rb index 8c7bf0617..2a1a7557e 100644 --- a/test/unit/resources/powershell_test.rb +++ b/test/unit/resources/powershell_test.rb @@ -1,8 +1,7 @@ require 'helper' -require 'inspec/resource' -describe 'Inspec::Resources::PowershellScript' do +describe 'Inspec::Resources::Powershell' do let(:base64_command) { # Encoded version of `$ProgressPreference='SilentlyContinue';Get-Help` 'JABQAHIAbwBnAHIAZQBzAHMAUAByAGUAZgBlAHIAZQBuAGMAZQA9ACcAUwBpAGwA' \ diff --git a/test/unit/resources/processes_test.rb b/test/unit/resources/processes_test.rb index 92b6da18e..dd9b8d5a2 100644 --- a/test/unit/resources/processes_test.rb +++ b/test/unit/resources/processes_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::Processes' do it 'handles empty process results' do diff --git a/test/unit/resources/rabbitmq_conf_test.rb b/test/unit/resources/rabbitmq_conf_test.rb index eaa38d2f5..501bad531 100644 --- a/test/unit/resources/rabbitmq_conf_test.rb +++ b/test/unit/resources/rabbitmq_conf_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::RabbitmqConf' do diff --git a/test/unit/resources/registry_key_test.rb b/test/unit/resources/registry_key_test.rb index 08530d6b0..740aba142 100644 --- a/test/unit/resources/registry_key_test.rb +++ b/test/unit/resources/registry_key_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::RegistryKey' do it 'read reg key with human readable name' do diff --git a/test/unit/resources/security_identifier_test.rb b/test/unit/resources/security_identifier_test.rb index 8f229cc3e..5cad530d4 100644 --- a/test/unit/resources/security_identifier_test.rb +++ b/test/unit/resources/security_identifier_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::SecurityIdentifier' do it 'returns a SID for an existing user' do diff --git a/test/unit/resources/security_policy_test.rb b/test/unit/resources/security_policy_test.rb index 3746fe695..cf14489dc 100644 --- a/test/unit/resources/security_policy_test.rb +++ b/test/unit/resources/security_policy_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::SecurityPolicy' do it 'verify processes resource' do diff --git a/test/unit/resources/service_test.rb b/test/unit/resources/service_test.rb index f773bf242..d720ed448 100644 --- a/test/unit/resources/service_test.rb +++ b/test/unit/resources/service_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' require 'hashie' describe 'Inspec::Resources::Service' do diff --git a/test/unit/resources/shadow_test.rb b/test/unit/resources/shadow_test.rb index dc6082689..133758e1d 100644 --- a/test/unit/resources/shadow_test.rb +++ b/test/unit/resources/shadow_test.rb @@ -1,6 +1,4 @@ - require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::Shadow' do let(:shadow) { load_resource('shadow') } diff --git a/test/unit/resources/ssh_conf_test.rb b/test/unit/resources/ssh_conf_test.rb index 71d622701..110f08d81 100644 --- a/test/unit/resources/ssh_conf_test.rb +++ b/test/unit/resources/ssh_conf_test.rb @@ -1,8 +1,7 @@ require 'helper' -require 'inspec/resource' -describe 'Inspec::Resources::SshConf' do +describe 'Inspec::Resources::SshConfig' do describe 'ssh_config' do it 'check ssh config parsing' do diff --git a/test/unit/resources/ssl_test.rb b/test/unit/resources/ssl_test.rb index db638d489..7c5c73849 100644 --- a/test/unit/resources/ssl_test.rb +++ b/test/unit/resources/ssl_test.rb @@ -1,6 +1,5 @@ - require 'helper' -require 'inspec/resource' +require 'sslshake' describe 'Inspec::Resources::SSL' do it 'verify cipher enabled' do diff --git a/test/unit/resources/sys_info_test.rb b/test/unit/resources/sys_info_test.rb index eb30f6e50..5dc846784 100644 --- a/test/unit/resources/sys_info_test.rb +++ b/test/unit/resources/sys_info_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::SysInfo' do describe 'sys_info' do diff --git a/test/unit/resources/toml_test.rb b/test/unit/resources/toml_test.rb index 4d2963960..382de9c7f 100644 --- a/test/unit/resources/toml_test.rb +++ b/test/unit/resources/toml_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::TOML' do describe 'when loading valid TOML' do diff --git a/test/unit/resources/user_test.rb b/test/unit/resources/user_test.rb index c92b8f713..a410b267b 100644 --- a/test/unit/resources/user_test.rb +++ b/test/unit/resources/user_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::User' do diff --git a/test/unit/resources/vbscript_test.rb b/test/unit/resources/vbscript_test.rb index 0b2598f16..2b043a28d 100644 --- a/test/unit/resources/vbscript_test.rb +++ b/test/unit/resources/vbscript_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::VbScript' do diff --git a/test/unit/resources/virtualization_test.rb b/test/unit/resources/virtualization_test.rb index 4a657a725..9d2f53137 100644 --- a/test/unit/resources/virtualization_test.rb +++ b/test/unit/resources/virtualization_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::Virtualization' do def mock_proc(mocked_files) @@ -14,6 +13,7 @@ describe 'Inspec::Resources::Virtualization' do it 'fails the resource if OS is not Linux' do mocked_files = [] mock_loader = MockLoader.new(:windows) + mock_loader.backend.stub :file, mock_proc(mocked_files) do mock_resource = mock_loader.load_resource('virtualization') mock_resource.resource_failed?.must_equal true diff --git a/test/unit/resources/windows_feature_test.rb b/test/unit/resources/windows_feature_test.rb index 00b0a1a85..e92fde57b 100644 --- a/test/unit/resources/windows_feature_test.rb +++ b/test/unit/resources/windows_feature_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::WindowsFeature' do it 'can retrieve feature info using PowerShell' do diff --git a/test/unit/resources/windows_hotfix_test.rb b/test/unit/resources/windows_hotfix_test.rb index d909ac900..35577c737 100644 --- a/test/unit/resources/windows_hotfix_test.rb +++ b/test/unit/resources/windows_hotfix_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::WindowsHotfix' do diff --git a/test/unit/resources/windows_task_test.rb b/test/unit/resources/windows_task_test.rb index 06984cf41..2ba283800 100644 --- a/test/unit/resources/windows_task_test.rb +++ b/test/unit/resources/windows_task_test.rb @@ -1,5 +1,4 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::WindowsTasks' do it 'verify parsing a windows task that does not exist' do diff --git a/test/unit/resources/wmi_test.rb b/test/unit/resources/wmi_test.rb index 9cb16da7c..6b5c2c859 100644 --- a/test/unit/resources/wmi_test.rb +++ b/test/unit/resources/wmi_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::WMI' do diff --git a/test/unit/resources/x509_certificate_test.rb b/test/unit/resources/x509_certificate_test.rb index 7450dc4da..7b82abdeb 100644 --- a/test/unit/resources/x509_certificate_test.rb +++ b/test/unit/resources/x509_certificate_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::X509Certificate' do let (:resource_cert) { diff --git a/test/unit/resources/xinetd_test.rb b/test/unit/resources/xinetd_conf_test.rb similarity index 99% rename from test/unit/resources/xinetd_test.rb rename to test/unit/resources/xinetd_conf_test.rb index e0369b621..908779b95 100644 --- a/test/unit/resources/xinetd_test.rb +++ b/test/unit/resources/xinetd_conf_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::XinetdConf' do let(:resource) { load_resource('xinetd_conf') } diff --git a/test/unit/resources/xml_test.rb b/test/unit/resources/xml_test.rb index b50f50049..46b4b642b 100644 --- a/test/unit/resources/xml_test.rb +++ b/test/unit/resources/xml_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' require 'rexml/document' describe 'Inspec::Resources::XML' do diff --git a/test/unit/resources/yaml_test.rb b/test/unit/resources/yaml_test.rb index 38fe8623d..23db3e4b6 100644 --- a/test/unit/resources/yaml_test.rb +++ b/test/unit/resources/yaml_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::YAML' do describe 'when loading a valid yaml' do diff --git a/test/unit/resources/yum_test.rb b/test/unit/resources/yum_test.rb index 79874ad24..350dbc2a9 100644 --- a/test/unit/resources/yum_test.rb +++ b/test/unit/resources/yum_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe 'Inspec::Resources::YumRepo' do it 'get repository details' do diff --git a/test/unit/resources/zfs_dataset_test.rb b/test/unit/resources/zfs_dataset_test.rb index 748bacde7..0868b4d4d 100644 --- a/test/unit/resources/zfs_dataset_test.rb +++ b/test/unit/resources/zfs_dataset_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe Inspec::Resources::ZfsDataset do let(:loader) { MockLoader.new(:freebsd10) } diff --git a/test/unit/resources/zfs_pool_test.rb b/test/unit/resources/zfs_pool_test.rb index e853df8a4..e438b92ab 100644 --- a/test/unit/resources/zfs_pool_test.rb +++ b/test/unit/resources/zfs_pool_test.rb @@ -1,6 +1,5 @@ require 'helper' -require 'inspec/resource' describe Inspec::Resources::ZfsPool do let(:loader) { MockLoader.new(:freebsd10) } diff --git a/test/unit/utils/database_helpers_test.rb b/test/unit/utils/database_helpers_test.rb index b4a2207f2..b69e0b92c 100644 --- a/test/unit/utils/database_helpers_test.rb +++ b/test/unit/utils/database_helpers_test.rb @@ -1,5 +1,5 @@ - require 'helper' +require 'inspec/utils/database_helpers' describe DatabaseHelper do describe DatabaseHelper::SQLColumn do diff --git a/test/unit/utils/filter_array_test.rb b/test/unit/utils/filter_array_test.rb index 16e3266a6..155143854 100644 --- a/test/unit/utils/filter_array_test.rb +++ b/test/unit/utils/filter_array_test.rb @@ -1,5 +1,6 @@ require 'helper' +require 'inspec/utils/filter_array' describe FilterArray do let (:data) {[ diff --git a/test/unit/utils/find_files_test.rb b/test/unit/utils/find_files_test.rb index 07f4e27b1..a4def4138 100644 --- a/test/unit/utils/find_files_test.rb +++ b/test/unit/utils/find_files_test.rb @@ -1,5 +1,6 @@ require 'helper' +require 'utils/find_files' describe FindFiles do let (:helper) do diff --git a/test/unit/utils/object_traversal_test.rb b/test/unit/utils/object_traversal_test.rb index 7f89da43f..657b3da08 100644 --- a/test/unit/utils/object_traversal_test.rb +++ b/test/unit/utils/object_traversal_test.rb @@ -1,5 +1,6 @@ require 'helper' +require 'inspec/utils/object_traversal' class Tester include ObjectTraverser diff --git a/test/unit/utils/simpleconfig_test.rb b/test/unit/utils/simpleconfig_test.rb index fe3f598b9..aa516e29f 100644 --- a/test/unit/utils/simpleconfig_test.rb +++ b/test/unit/utils/simpleconfig_test.rb @@ -1,5 +1,6 @@ require 'helper' +require 'inspec/utils/simpleconfig' describe 'SimpleConfig Default Parser' do it 'should parse an empty string' do From 61585de0f00110fe033c274d3026f4984635b999 Mon Sep 17 00:00:00 2001 From: Ryan Davis Date: Fri, 24 May 2019 15:33:24 -0700 Subject: [PATCH 02/11] Moved out all of the requires for inspec/resources/* from inspec/resource.rb All requires moved to inspec/resources.rb Signed-off-by: Ryan Davis --- lib/inspec.rb | 1 + lib/inspec/resource.rb | 118 --------------------------------------- lib/inspec/resources.rb | 119 ++++++++++++++++++++++++++++++++++++++++ test/helper.rb | 2 + 4 files changed, 122 insertions(+), 118 deletions(-) create mode 100644 lib/inspec/resources.rb diff --git a/lib/inspec.rb b/lib/inspec.rb index 847a7f5a6..c6a84673c 100644 --- a/lib/inspec.rb +++ b/lib/inspec.rb @@ -28,3 +28,4 @@ require 'inspec/base_cli' require 'inspec/fetcher' require 'inspec/source_reader' require 'inspec/resource' +require 'inspec/resources' diff --git a/lib/inspec/resource.rb b/lib/inspec/resource.rb index cfa9ca8eb..1f3ea54d1 100644 --- a/lib/inspec/resource.rb +++ b/lib/inspec/resource.rb @@ -81,121 +81,3 @@ end # Many resources use FilterTable. require 'inspec/utils/filter' - -# Detect if we are running the stripped-down inspec-core -# This relies on AWS being stripped from the inspec-core gem -inspec_core_only = !File.exist?(File.join(File.dirname(__FILE__), '..', 'resource_support', 'aws.rb')) - -# Do not attempt to load cloud resources if we are in inspec-core mode -unless inspec_core_only - require 'resource_support/aws' - require 'resources/azure/azure_backend.rb' - require 'resources/azure/azure_generic_resource.rb' - require 'resources/azure/azure_resource_group.rb' - require 'resources/azure/azure_virtual_machine.rb' - require 'resources/azure/azure_virtual_machine_data_disk.rb' -end - -require 'inspec/resources/aide_conf' -require 'inspec/resources/apache' -require 'inspec/resources/apache_conf' -require 'inspec/resources/apt' -require 'inspec/resources/audit_policy' -require 'inspec/resources/auditd' -require 'inspec/resources/auditd_conf' -require 'inspec/resources/bash' -require 'inspec/resources/bond' -require 'inspec/resources/bridge' -require 'inspec/resources/chocolatey_package' -require 'inspec/resources/command' -require 'inspec/resources/cran' -require 'inspec/resources/cpan' -require 'inspec/resources/crontab' -require 'inspec/resources/dh_params' -require 'inspec/resources/directory' -require 'inspec/resources/docker' -require 'inspec/resources/docker_container' -require 'inspec/resources/docker_image' -require 'inspec/resources/docker_plugin' -require 'inspec/resources/docker_service' -require 'inspec/resources/elasticsearch' -require 'inspec/resources/etc_fstab' -require 'inspec/resources/etc_group' -require 'inspec/resources/etc_hosts_allow_deny' -require 'inspec/resources/etc_hosts' -require 'inspec/resources/file' -require 'inspec/resources/filesystem' -require 'inspec/resources/firewalld' -require 'inspec/resources/gem' -require 'inspec/resources/groups' -require 'inspec/resources/grub_conf' -require 'inspec/resources/host' -require 'inspec/resources/http' -require 'inspec/resources/iis_app' -require 'inspec/resources/iis_app_pool' -require 'inspec/resources/iis_site' -require 'inspec/resources/inetd_conf' -require 'inspec/resources/interface' -require 'inspec/resources/iptables' -require 'inspec/resources/kernel_module' -require 'inspec/resources/kernel_parameter' -require 'inspec/resources/key_rsa' -require 'inspec/resources/ksh' -require 'inspec/resources/limits_conf' -require 'inspec/resources/login_defs' -require 'inspec/resources/mount' -require 'inspec/resources/mssql_session' -require 'inspec/resources/mysql' -require 'inspec/resources/mysql_conf' -require 'inspec/resources/mysql_session' -require 'inspec/resources/nginx' -require 'inspec/resources/nginx_conf' -require 'inspec/resources/npm' -require 'inspec/resources/ntp_conf' -require 'inspec/resources/oneget' -require 'inspec/resources/oracledb_session' -require 'inspec/resources/os' -require 'inspec/resources/os_env' -require 'inspec/resources/package' -require 'inspec/resources/packages' -require 'inspec/resources/parse_config' -require 'inspec/resources/passwd' -require 'inspec/resources/pip' -require 'inspec/resources/platform' -require 'inspec/resources/port' -require 'inspec/resources/postgres' -require 'inspec/resources/postgres_conf' -require 'inspec/resources/postgres_hba_conf' -require 'inspec/resources/postgres_ident_conf' -require 'inspec/resources/postgres_session' -require 'inspec/resources/powershell' -require 'inspec/resources/processes' -require 'inspec/resources/rabbitmq_config' -require 'inspec/resources/registry_key' -require 'inspec/resources/security_identifier' -require 'inspec/resources/security_policy' -require 'inspec/resources/service' -require 'inspec/resources/shadow' -require 'inspec/resources/ssh_config' -require 'inspec/resources/ssl' -require 'inspec/resources/sys_info' -require 'inspec/resources/toml' -require 'inspec/resources/users' -require 'inspec/resources/vbscript' -require 'inspec/resources/virtualization' -require 'inspec/resources/windows_feature' -require 'inspec/resources/windows_hotfix' -require 'inspec/resources/windows_task' -require 'inspec/resources/wmi' -require 'inspec/resources/x509_certificate' -require 'inspec/resources/xinetd_conf' -require 'inspec/resources/yum' -require 'inspec/resources/zfs_dataset' -require 'inspec/resources/zfs_pool' - -# file formats, depend on json implementation -require 'inspec/resources/json' -require 'inspec/resources/yaml' -require 'inspec/resources/csv' -require 'inspec/resources/ini' -require 'inspec/resources/xml' diff --git a/lib/inspec/resources.rb b/lib/inspec/resources.rb new file mode 100644 index 000000000..d7c59f3f9 --- /dev/null +++ b/lib/inspec/resources.rb @@ -0,0 +1,119 @@ +require 'inspec/resource' + +# Detect if we are running the stripped-down inspec-core +# This relies on AWS being stripped from the inspec-core gem +inspec_core_only = !File.exist?(File.join(File.dirname(__FILE__), '..', 'resource_support', 'aws.rb')) + +# Do not attempt to load cloud resources if we are in inspec-core mode +unless inspec_core_only + require 'resource_support/aws' + require 'resources/azure/azure_backend.rb' + require 'resources/azure/azure_generic_resource.rb' + require 'resources/azure/azure_resource_group.rb' + require 'resources/azure/azure_virtual_machine.rb' + require 'resources/azure/azure_virtual_machine_data_disk.rb' +end + +require 'inspec/resources/aide_conf' +require 'inspec/resources/apache' +require 'inspec/resources/apache_conf' +require 'inspec/resources/apt' +require 'inspec/resources/audit_policy' +require 'inspec/resources/auditd' +require 'inspec/resources/auditd_conf' +require 'inspec/resources/bash' +require 'inspec/resources/bond' +require 'inspec/resources/bridge' +require 'inspec/resources/chocolatey_package' +require 'inspec/resources/command' +require 'inspec/resources/cran' +require 'inspec/resources/cpan' +require 'inspec/resources/crontab' +require 'inspec/resources/dh_params' +require 'inspec/resources/directory' +require 'inspec/resources/docker' +require 'inspec/resources/docker_container' +require 'inspec/resources/docker_image' +require 'inspec/resources/docker_plugin' +require 'inspec/resources/docker_service' +require 'inspec/resources/elasticsearch' +require 'inspec/resources/etc_fstab' +require 'inspec/resources/etc_group' +require 'inspec/resources/etc_hosts_allow_deny' +require 'inspec/resources/etc_hosts' +require 'inspec/resources/file' +require 'inspec/resources/filesystem' +require 'inspec/resources/firewalld' +require 'inspec/resources/gem' +require 'inspec/resources/groups' +require 'inspec/resources/grub_conf' +require 'inspec/resources/host' +require 'inspec/resources/http' +require 'inspec/resources/iis_app' +require 'inspec/resources/iis_app_pool' +require 'inspec/resources/iis_site' +require 'inspec/resources/inetd_conf' +require 'inspec/resources/interface' +require 'inspec/resources/iptables' +require 'inspec/resources/kernel_module' +require 'inspec/resources/kernel_parameter' +require 'inspec/resources/key_rsa' +require 'inspec/resources/ksh' +require 'inspec/resources/limits_conf' +require 'inspec/resources/login_defs' +require 'inspec/resources/mount' +require 'inspec/resources/mssql_session' +require 'inspec/resources/mysql' +require 'inspec/resources/mysql_conf' +require 'inspec/resources/mysql_session' +require 'inspec/resources/nginx' +require 'inspec/resources/nginx_conf' +require 'inspec/resources/npm' +require 'inspec/resources/ntp_conf' +require 'inspec/resources/oneget' +require 'inspec/resources/oracledb_session' +require 'inspec/resources/os' +require 'inspec/resources/os_env' +require 'inspec/resources/package' +require 'inspec/resources/packages' +require 'inspec/resources/parse_config' +require 'inspec/resources/passwd' +require 'inspec/resources/pip' +require 'inspec/resources/platform' +require 'inspec/resources/port' +require 'inspec/resources/postgres' +require 'inspec/resources/postgres_conf' +require 'inspec/resources/postgres_hba_conf' +require 'inspec/resources/postgres_ident_conf' +require 'inspec/resources/postgres_session' +require 'inspec/resources/powershell' +require 'inspec/resources/processes' +require 'inspec/resources/rabbitmq_config' +require 'inspec/resources/registry_key' +require 'inspec/resources/security_identifier' +require 'inspec/resources/security_policy' +require 'inspec/resources/service' +require 'inspec/resources/shadow' +require 'inspec/resources/ssh_config' +require 'inspec/resources/ssl' +require 'inspec/resources/sys_info' +require 'inspec/resources/toml' +require 'inspec/resources/users' +require 'inspec/resources/vbscript' +require 'inspec/resources/virtualization' +require 'inspec/resources/windows_feature' +require 'inspec/resources/windows_hotfix' +require 'inspec/resources/windows_task' +require 'inspec/resources/wmi' +require 'inspec/resources/x509_certificate' +require 'inspec/resources/xinetd_conf' +require 'inspec/resources/yum' +require 'inspec/resources/zfs_dataset' +require 'inspec/resources/zfs_pool' + +# file formats, depend on json implementation +require 'inspec/resources/json' +require 'inspec/resources/yaml' +require 'inspec/resources/csv' +require 'inspec/resources/ini' +require 'inspec/resources/xml' diff --git a/test/helper.rb b/test/helper.rb index 18de351c4..555164d82 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -83,6 +83,8 @@ require 'zip' require 'json' require 'inspec/base_cli' +require 'inspec/resource' +require 'inspec/resources' require 'inspec/version' require 'inspec/exceptions' require 'inspec/fetcher' From 69f29279830a236b0468dbdc2061d6fde2317d4e Mon Sep 17 00:00:00 2001 From: Ryan Davis Date: Sat, 25 May 2019 02:40:45 -0700 Subject: [PATCH 03/11] Stripping test/helper.rb of all the big inspec requires. Signed-off-by: Ryan Davis --- test/helper.rb | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/test/helper.rb b/test/helper.rb index 555164d82..479e054eb 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -82,24 +82,9 @@ require 'tmpdir' require 'zip' require 'json' -require 'inspec/base_cli' -require 'inspec/resource' -require 'inspec/resources' require 'inspec/version' -require 'inspec/exceptions' -require 'inspec/fetcher' -require 'inspec/source_reader' -require 'inspec/reporters' +require 'inspec/log' require 'inspec/backend' -require 'inspec/profile' -require 'inspec/runner' -require 'inspec/runner_mock' -require 'inspec/globals' -require 'inspec/impact' -require 'inspec/config' -require 'fetchers/mock' -require 'inspec/dependencies/cache' -require 'bundles/inspec-supermarket' require 'train' CMD = Train.create('local', command_runner: :generic).connection From 761f48e63c6fad2051297e9b80d9597984544555 Mon Sep 17 00:00:00 2001 From: Ryan Davis Date: Fri, 24 May 2019 16:20:54 -0700 Subject: [PATCH 04/11] Get user_test.rb working Signed-off-by: Ryan Davis --- lib/inspec/config.rb | 3 +++ lib/inspec/resources/powershell.rb | 1 + lib/inspec/resources/users.rb | 3 ++- test/unit/resources/user_test.rb | 3 +++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/inspec/config.rb b/lib/inspec/config.rb index 23b504583..330d3b47a 100644 --- a/lib/inspec/config.rb +++ b/lib/inspec/config.rb @@ -4,6 +4,9 @@ require 'pp' require 'stringio' require 'forwardable' +require 'thor' +require 'base64' +require 'inspec/base_cli' module Inspec class Config diff --git a/lib/inspec/resources/powershell.rb b/lib/inspec/resources/powershell.rb index ffce6fb07..26bb9aa8f 100644 --- a/lib/inspec/resources/powershell.rb +++ b/lib/inspec/resources/powershell.rb @@ -1,4 +1,5 @@ # copyright: 2015, Vulcano Security GmbH +require 'inspec/resources/command' module Inspec::Resources class Powershell < Cmd diff --git a/lib/inspec/resources/users.rb b/lib/inspec/resources/users.rb index ffa977458..a9d8c601e 100644 --- a/lib/inspec/resources/users.rb +++ b/lib/inspec/resources/users.rb @@ -1,7 +1,8 @@ - require 'inspec/utils/parser' require 'inspec/utils/convert' require 'inspec/utils/filter' +require 'inspec/utils/simpleconfig' +require 'inspec/resources/powershell' module Inspec::Resources # This file contains two resources, the `user` and `users` resource. diff --git a/test/unit/resources/user_test.rb b/test/unit/resources/user_test.rb index a410b267b..7a389649e 100644 --- a/test/unit/resources/user_test.rb +++ b/test/unit/resources/user_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/users' +require 'inspec/resources/command' describe 'Inspec::Resources::User' do From de8258c9f731196205886857503d9f8fa40ffa97 Mon Sep 17 00:00:00 2001 From: Ryan Davis Date: Fri, 24 May 2019 16:21:05 -0700 Subject: [PATCH 05/11] Get yaml_test.rb working Signed-off-by: Ryan Davis --- lib/inspec/resources/yaml.rb | 1 + lib/inspec/utils/file_reader.rb | 1 + test/helpers/mock_loader.rb | 4 ---- test/unit/resources/yaml_test.rb | 2 ++ 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/inspec/resources/yaml.rb b/lib/inspec/resources/yaml.rb index 164b83d3e..55ab1307f 100644 --- a/lib/inspec/resources/yaml.rb +++ b/lib/inspec/resources/yaml.rb @@ -1,5 +1,6 @@ require 'yaml' +require 'inspec/resources/json' # Parses a yaml document # Usage: diff --git a/lib/inspec/utils/file_reader.rb b/lib/inspec/utils/file_reader.rb index 2621865b2..32d43f2e6 100644 --- a/lib/inspec/utils/file_reader.rb +++ b/lib/inspec/utils/file_reader.rb @@ -1,3 +1,4 @@ +require 'inspec/resources/file' module FileReader def read_file_content(path, allow_empty = false) diff --git a/test/helpers/mock_loader.rb b/test/helpers/mock_loader.rb index 98b6a348a..47e027030 100644 --- a/test/helpers/mock_loader.rb +++ b/test/helpers/mock_loader.rb @@ -46,10 +46,6 @@ class MockLoader @backend = Inspec::Backend.create(Inspec::Config.mock) mock = @backend.backend - def @backend.file(*) # BS version of it so stub calls won't blow up - super - end - # create all mock files local = Train.create('local', command_runner: :generic).connection diff --git a/test/unit/resources/yaml_test.rb b/test/unit/resources/yaml_test.rb index 23db3e4b6..51dbeca4a 100644 --- a/test/unit/resources/yaml_test.rb +++ b/test/unit/resources/yaml_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/yaml' describe 'Inspec::Resources::YAML' do describe 'when loading a valid yaml' do From 9ec91484fca93b244c9e153a0dab56e301df8fbf Mon Sep 17 00:00:00 2001 From: Ryan Davis Date: Fri, 24 May 2019 16:47:59 -0700 Subject: [PATCH 06/11] Get all non-resource tests fixed again. Signed-off-by: Ryan Davis --- test/unit/bundles/inspec-supermarket/api_test.rb | 2 +- test/unit/dsl/control_test.rb | 8 +++++++- test/unit/dsl/other_keywords_test.rb | 1 + test/unit/fetchers/mock_test.rb | 1 + test/unit/impact_test.rb | 1 + test/unit/profiles/profile_resource_exceptions_test.rb | 1 + test/unit/profiles/profile_test.rb | 5 ++++- test/unit/runner_test.rb | 1 + test/unit/utils/bsd_mount_parser_test.rb | 1 + test/unit/utils/find_files_test.rb | 4 +++- test/unit/utils/passwd_parser_test.rb | 1 + test/unit/utils/solaris_netstat_parser_test.rb | 1 + 12 files changed, 23 insertions(+), 4 deletions(-) diff --git a/test/unit/bundles/inspec-supermarket/api_test.rb b/test/unit/bundles/inspec-supermarket/api_test.rb index 91c56d5c4..2365386f1 100644 --- a/test/unit/bundles/inspec-supermarket/api_test.rb +++ b/test/unit/bundles/inspec-supermarket/api_test.rb @@ -1,5 +1,5 @@ require 'helper' -require 'inspec-supermarket/api' +require 'bundles/inspec-supermarket/api' def default_url?(supermarket_url) supermarket_url == Supermarket::API::SUPERMARKET_URL diff --git a/test/unit/dsl/control_test.rb b/test/unit/dsl/control_test.rb index 95ab77f67..99f93c45b 100644 --- a/test/unit/dsl/control_test.rb +++ b/test/unit/dsl/control_test.rb @@ -1,6 +1,8 @@ require 'helper' require 'inspec/config' +require 'inspec/runner_mock' +require 'fetchers/mock' describe 'controls' do def load(content) @@ -8,7 +10,11 @@ describe 'controls' do 'inspec.yml' => "name: mock", 'controls/mock.rb' => "control '1' do\n#{content}\nend\n", } - opts = { test_collector: Inspec::RunnerMock.new, backend: Inspec::Backend.create(Inspec::Config.mock) } + opts = { + test_collector: Inspec::RunnerMock.new, + backend: Inspec::Backend.create(Inspec::Config.mock) + } + Inspec::Profile.for_target(data, opts) .params[:controls]['1'] end diff --git a/test/unit/dsl/other_keywords_test.rb b/test/unit/dsl/other_keywords_test.rb index 2ab859f0a..bebcb01e9 100644 --- a/test/unit/dsl/other_keywords_test.rb +++ b/test/unit/dsl/other_keywords_test.rb @@ -1,6 +1,7 @@ require 'helper' require 'inspec/runner_mock' +require 'inspec/runner' describe 'inspec keyword' do def load(content) diff --git a/test/unit/fetchers/mock_test.rb b/test/unit/fetchers/mock_test.rb index c3c059685..02eb8e5b8 100644 --- a/test/unit/fetchers/mock_test.rb +++ b/test/unit/fetchers/mock_test.rb @@ -1,5 +1,6 @@ require 'helper' +require 'fetchers/mock' describe Fetchers::Mock do let(:fetcher) { Fetchers::Mock } diff --git a/test/unit/impact_test.rb b/test/unit/impact_test.rb index 7cea7e1a2..fe193705d 100644 --- a/test/unit/impact_test.rb +++ b/test/unit/impact_test.rb @@ -1,6 +1,7 @@ # copyright: 2017, Chef Software Inc. require 'helper' +require 'inspec/impact' describe 'Impact' do let(:impact) { Inspec::Impact } diff --git a/test/unit/profiles/profile_resource_exceptions_test.rb b/test/unit/profiles/profile_resource_exceptions_test.rb index f71b0b43b..3933f386e 100644 --- a/test/unit/profiles/profile_resource_exceptions_test.rb +++ b/test/unit/profiles/profile_resource_exceptions_test.rb @@ -2,6 +2,7 @@ require 'helper' require 'inspec/profile_context' +require 'inspec/runner_mock' describe 'resource exception' do let(:profile) do diff --git a/test/unit/profiles/profile_test.rb b/test/unit/profiles/profile_test.rb index 5224acd5e..190e8b3f2 100644 --- a/test/unit/profiles/profile_test.rb +++ b/test/unit/profiles/profile_test.rb @@ -1,6 +1,9 @@ - require 'helper' require 'inspec/profile_context' +require 'inspec/runner_mock' +require 'inspec/resource' +require 'inspec/resources/command' + describe Inspec::Profile do let(:logger) { Minitest::Mock.new } diff --git a/test/unit/runner_test.rb b/test/unit/runner_test.rb index d452c6540..9199e6772 100644 --- a/test/unit/runner_test.rb +++ b/test/unit/runner_test.rb @@ -2,6 +2,7 @@ require 'helper' require 'inspec/secrets' +require 'inspec/runner' describe Inspec::Runner do let(:runner) { Inspec::Runner.new({ command_runner: :generic }) } diff --git a/test/unit/utils/bsd_mount_parser_test.rb b/test/unit/utils/bsd_mount_parser_test.rb index 23e85ade1..ad63d8bbc 100644 --- a/test/unit/utils/bsd_mount_parser_test.rb +++ b/test/unit/utils/bsd_mount_parser_test.rb @@ -1,5 +1,6 @@ require 'helper' +require 'inspec/utils/parser' describe BsdMountParser do let (:parser) { Class.new() { include BsdMountParser }.new } diff --git a/test/unit/utils/find_files_test.rb b/test/unit/utils/find_files_test.rb index a4def4138..a08120489 100644 --- a/test/unit/utils/find_files_test.rb +++ b/test/unit/utils/find_files_test.rb @@ -1,6 +1,8 @@ require 'helper' -require 'utils/find_files' +require 'inspec/utils/find_files' +require 'inspec/resources/command' + describe FindFiles do let (:helper) do diff --git a/test/unit/utils/passwd_parser_test.rb b/test/unit/utils/passwd_parser_test.rb index 710259dab..345cb0c78 100644 --- a/test/unit/utils/passwd_parser_test.rb +++ b/test/unit/utils/passwd_parser_test.rb @@ -1,5 +1,6 @@ require 'helper' +require 'inspec/utils/parser' describe PasswdParser do let (:parser) { Class.new() { include PasswdParser }.new } diff --git a/test/unit/utils/solaris_netstat_parser_test.rb b/test/unit/utils/solaris_netstat_parser_test.rb index fce9cf0a2..c4d5cb6fb 100644 --- a/test/unit/utils/solaris_netstat_parser_test.rb +++ b/test/unit/utils/solaris_netstat_parser_test.rb @@ -1,5 +1,6 @@ require 'helper' +require 'inspec/utils/parser' describe SolarisNetstatParser do let (:parser) { Class.new() { include SolarisNetstatParser }.new } From 82c9aa6ed63edbbb8befb597039d8c09c1ab5704 Mon Sep 17 00:00:00 2001 From: Ryan Davis Date: Sat, 25 May 2019 01:33:26 -0700 Subject: [PATCH 07/11] Got the rest of the tests to pass. Signed-off-by: Ryan Davis --- lib/inspec/resources/apt.rb | 1 + lib/inspec/resources/audit_policy.rb | 2 ++ lib/inspec/resources/bond.rb | 2 +- lib/inspec/resources/bridge.rb | 1 + lib/inspec/resources/chocolatey_package.rb | 3 +++ lib/inspec/resources/cpan.rb | 1 + lib/inspec/resources/cran.rb | 1 + lib/inspec/resources/crontab.rb | 2 +- lib/inspec/resources/csv.rb | 1 + lib/inspec/resources/docker.rb | 1 + lib/inspec/resources/docker_container.rb | 1 + lib/inspec/resources/docker_image.rb | 1 + lib/inspec/resources/docker_plugin.rb | 1 + lib/inspec/resources/docker_service.rb | 1 + lib/inspec/resources/filesystem.rb | 2 ++ lib/inspec/resources/firewalld.rb | 1 + lib/inspec/resources/gem.rb | 1 + lib/inspec/resources/groups.rb | 4 +++- lib/inspec/resources/host.rb | 1 + lib/inspec/resources/http.rb | 1 + lib/inspec/resources/iis_app_pool.rb | 3 +++ lib/inspec/resources/iis_site.rb | 3 +++ lib/inspec/resources/ini.rb | 2 +- lib/inspec/resources/interface.rb | 3 ++- lib/inspec/resources/iptables.rb | 1 + lib/inspec/resources/kernel_module.rb | 1 + lib/inspec/resources/kernel_parameter.rb | 1 + lib/inspec/resources/mount.rb | 3 --- lib/inspec/resources/mssql_session.rb | 2 +- lib/inspec/resources/mysql_session.rb | 1 + lib/inspec/resources/nginx.rb | 1 + lib/inspec/resources/npm.rb | 2 +- lib/inspec/resources/oneget.rb | 1 + lib/inspec/resources/oracledb_session.rb | 2 +- lib/inspec/resources/package.rb | 2 ++ lib/inspec/resources/packages.rb | 1 + lib/inspec/resources/parse_config.rb | 1 + lib/inspec/resources/pip.rb | 3 ++- lib/inspec/resources/processes.rb | 1 + lib/inspec/resources/registry_key.rb | 1 + lib/inspec/resources/security_identifier.rb | 2 ++ lib/inspec/resources/security_policy.rb | 2 ++ lib/inspec/resources/sys_info.rb | 3 +++ lib/inspec/resources/vbscript.rb | 2 +- lib/inspec/resources/windows_feature.rb | 1 + lib/inspec/resources/windows_hotfix.rb | 1 + lib/inspec/resources/windows_task.rb | 2 ++ lib/inspec/resources/wmi.rb | 2 +- lib/inspec/resources/xml.rb | 1 + lib/inspec/resources/yum.rb | 1 + lib/inspec/resources/zfs_dataset.rb | 1 + lib/inspec/resources/zfs_pool.rb | 1 + lib/inspec/utils/parser.rb | 4 ++++ lib/resource_support/aws/aws_plural_resource_mixin.rb | 3 +++ lib/resource_support/aws/aws_singular_resource_mixin.rb | 3 +++ lib/resources/aws/aws_billing_report.rb | 7 +++++++ lib/resources/aws/aws_billing_reports.rb | 3 +++ lib/resources/aws/aws_cloudtrail_trail.rb | 4 ++++ lib/resources/aws/aws_cloudtrail_trails.rb | 4 ++++ lib/resources/aws/aws_cloudwatch_alarm.rb | 4 ++++ lib/resources/aws/aws_cloudwatch_log_metric_filter.rb | 4 ++++ lib/resources/aws/aws_config_delivery_channel.rb | 4 ++++ lib/resources/aws/aws_config_recorder.rb | 4 ++++ lib/resources/aws/aws_ebs_volume.rb | 4 ++++ lib/resources/aws/aws_ebs_volumes.rb | 4 ++++ lib/resources/aws/aws_ec2_instance.rb | 4 ++++ lib/resources/aws/aws_ec2_instances.rb | 4 ++++ lib/resources/aws/aws_ecs_cluster.rb | 4 ++++ lib/resources/aws/aws_eks_cluster.rb | 4 ++++ lib/resources/aws/aws_elb.rb | 4 ++++ lib/resources/aws/aws_elbs.rb | 4 ++++ lib/resources/aws/aws_flow_log.rb | 4 ++++ lib/resources/aws/aws_iam_access_key.rb | 4 ++++ lib/resources/aws/aws_iam_access_keys.rb | 4 ++++ lib/resources/aws/aws_iam_group.rb | 4 ++++ lib/resources/aws/aws_iam_groups.rb | 4 ++++ lib/resources/aws/aws_iam_password_policy.rb | 4 ++++ lib/resources/aws/aws_iam_policies.rb | 4 ++++ lib/resources/aws/aws_iam_policy.rb | 4 ++++ lib/resources/aws/aws_iam_role.rb | 4 ++++ lib/resources/aws/aws_iam_root_user.rb | 4 ++++ lib/resources/aws/aws_iam_user.rb | 4 +++- lib/resources/aws/aws_iam_users.rb | 4 ++++ lib/resources/aws/aws_kms_key.rb | 4 ++++ lib/resources/aws/aws_kms_keys.rb | 4 ++++ lib/resources/aws/aws_rds_instance.rb | 4 ++++ lib/resources/aws/aws_route_table.rb | 4 ++++ lib/resources/aws/aws_route_tables.rb | 4 ++++ lib/resources/aws/aws_s3_bucket.rb | 4 ++++ lib/resources/aws/aws_s3_bucket_object.rb | 4 ++++ lib/resources/aws/aws_s3_buckets.rb | 4 ++++ lib/resources/aws/aws_security_group.rb | 4 ++++ lib/resources/aws/aws_security_groups.rb | 4 ++++ lib/resources/aws/aws_sns_subscription.rb | 4 ++++ lib/resources/aws/aws_sns_topic.rb | 4 ++++ lib/resources/aws/aws_sns_topics.rb | 4 ++++ lib/resources/aws/aws_sqs_queue.rb | 4 ++++ lib/resources/aws/aws_subnet.rb | 4 ++++ lib/resources/aws/aws_subnets.rb | 4 ++++ lib/resources/aws/aws_vpc.rb | 4 ++++ lib/resources/aws/aws_vpcs.rb | 4 ++++ test/unit/reporters/automate_test.rb | 2 +- test/unit/reporters/base_test.rb | 2 +- test/unit/reporters/cli_test.rb | 2 +- test/unit/reporters/json_automate_test.rb | 2 +- test/unit/reporters/json_min_test.rb | 2 +- test/unit/reporters/json_test.rb | 2 +- test/unit/reporters/junit_test.rb | 2 +- test/unit/reporters/yaml_test.rb | 2 +- test/unit/resources/aide_conf_test.rb | 2 ++ test/unit/resources/apache_conf_test.rb | 2 ++ test/unit/resources/apt_test.rb | 2 ++ test/unit/resources/audit_policy_test.rb | 2 ++ test/unit/resources/auditd_conf_test.rb | 2 ++ test/unit/resources/auditd_test.rb | 2 ++ test/unit/resources/aws_billing_report_test.rb | 2 ++ test/unit/resources/aws_billing_reports_test.rb | 2 ++ test/unit/resources/aws_cloudtrail_trail_test.rb | 2 ++ test/unit/resources/aws_cloudtrail_trails_test.rb | 2 ++ test/unit/resources/aws_cloudwatch_alarm_test.rb | 2 ++ .../resources/aws_cloudwatch_log_metric_filter_test.rb | 2 ++ test/unit/resources/aws_config_delivery_channel_test.rb | 2 ++ test/unit/resources/aws_config_recorder_test.rb | 2 ++ test/unit/resources/aws_ebs_volume_test.rb | 2 ++ test/unit/resources/aws_ebs_volumes_test.rb | 2 ++ test/unit/resources/aws_ec2_instance_test.rb | 2 ++ test/unit/resources/aws_ec2_instances_test.rb | 2 ++ test/unit/resources/aws_ecs_cluster_test.rb | 2 ++ test/unit/resources/aws_eks_cluster_test.rb | 2 ++ test/unit/resources/aws_elb_test.rb | 2 ++ test/unit/resources/aws_elbs_test.rb | 2 ++ test/unit/resources/aws_flow_log_test.rb | 2 ++ test/unit/resources/aws_iam_access_key_test.rb | 2 ++ test/unit/resources/aws_iam_access_keys_test.rb | 2 ++ test/unit/resources/aws_iam_group_test.rb | 2 ++ test/unit/resources/aws_iam_groups_test.rb | 2 ++ test/unit/resources/aws_iam_password_policy_test.rb | 2 ++ test/unit/resources/aws_iam_policies_test.rb | 2 ++ test/unit/resources/aws_iam_policy_test.rb | 2 ++ test/unit/resources/aws_iam_role_test.rb | 2 ++ test/unit/resources/aws_iam_root_user_test.rb | 2 ++ test/unit/resources/aws_iam_user_test.rb | 2 ++ test/unit/resources/aws_iam_users_test.rb | 2 ++ test/unit/resources/aws_kms_key_test.rb | 2 ++ test/unit/resources/aws_kms_keys_test.rb | 2 ++ test/unit/resources/aws_rds_instance_test.rb | 2 ++ test/unit/resources/aws_route_table_test.rb | 2 ++ test/unit/resources/aws_route_tables_test.rb | 2 ++ test/unit/resources/aws_s3_bucket_object_test.rb | 2 ++ test/unit/resources/aws_s3_bucket_test.rb | 2 ++ test/unit/resources/aws_s3_buckets_test.rb | 2 ++ test/unit/resources/aws_security_group_test.rb | 2 ++ test/unit/resources/aws_security_groups_test.rb | 2 ++ test/unit/resources/aws_sns_subscription_test.rb | 2 ++ test/unit/resources/aws_sns_topic_test.rb | 2 ++ test/unit/resources/aws_sns_topics_test.rb | 2 ++ test/unit/resources/aws_sqs_queue_test.rb | 2 ++ test/unit/resources/aws_subnet_test.rb | 2 ++ test/unit/resources/aws_subnets_test.rb | 2 ++ test/unit/resources/aws_vpc_test.rb | 2 ++ test/unit/resources/aws_vpcs_test.rb | 2 ++ test/unit/resources/bash_test.rb | 2 ++ test/unit/resources/bond_test.rb | 2 ++ test/unit/resources/bridge_test.rb | 2 ++ test/unit/resources/chocolatey_package_test.rb | 2 ++ test/unit/resources/command_test.rb | 2 ++ test/unit/resources/cpan_test.rb | 2 ++ test/unit/resources/cran_test.rb | 2 ++ test/unit/resources/crontab_test.rb | 2 ++ test/unit/resources/csv_test.rb | 2 ++ test/unit/resources/dh_params_test.rb | 2 ++ test/unit/resources/docker_container_test.rb | 2 ++ test/unit/resources/docker_image_test.rb | 2 ++ test/unit/resources/docker_plugin_test.rb | 2 ++ test/unit/resources/docker_service_test.rb | 2 ++ test/unit/resources/docker_test.rb | 2 ++ test/unit/resources/elasticsearch_test.rb | 2 ++ test/unit/resources/etc_fstab_test.rb | 2 ++ test/unit/resources/etc_group_test.rb | 2 ++ test/unit/resources/etc_hosts_allow_deny_test.rb | 2 ++ test/unit/resources/etc_hosts_test.rb | 2 ++ test/unit/resources/file_test.rb | 2 ++ test/unit/resources/filesystem_test.rb | 2 ++ test/unit/resources/firewalld_test.rb | 2 ++ test/unit/resources/gem_test.rb | 2 ++ test/unit/resources/group_test.rb | 2 ++ test/unit/resources/groups_test.rb | 2 ++ test/unit/resources/grub_conf_test.rb | 2 ++ test/unit/resources/host_test.rb | 2 ++ test/unit/resources/http_test.rb | 2 ++ test/unit/resources/iis_app_pool_test.rb | 2 ++ test/unit/resources/iis_site_test.rb | 2 ++ test/unit/resources/inetd_conf_test.rb | 2 ++ test/unit/resources/ini_test.rb | 2 ++ test/unit/resources/interface_test.rb | 2 ++ test/unit/resources/iptables_test.rb | 2 ++ test/unit/resources/json_test.rb | 2 ++ test/unit/resources/kernel_module_test.rb | 2 ++ test/unit/resources/kernel_parameter_test.rb | 2 ++ test/unit/resources/key_rsa_test.rb | 2 ++ test/unit/resources/ksh_test.rb | 2 ++ test/unit/resources/limits_conf_test.rb | 2 ++ test/unit/resources/login_def_test.rb | 2 ++ test/unit/resources/mount_test.rb | 3 +++ test/unit/resources/mssql_session_test.rb | 2 ++ test/unit/resources/mysql_conf_test.rb | 2 ++ test/unit/resources/mysql_session_test.rb | 2 ++ test/unit/resources/nginx_conf_test.rb | 2 ++ test/unit/resources/nginx_test.rb | 2 ++ test/unit/resources/npm_test.rb | 2 ++ test/unit/resources/ntp_conf_test.rb | 2 ++ test/unit/resources/oneget_test.rb | 2 ++ test/unit/resources/oracledb_session_test.rb | 2 ++ test/unit/resources/os_env_test.rb | 2 ++ test/unit/resources/os_test.rb | 2 ++ test/unit/resources/package_test.rb | 2 ++ test/unit/resources/packages_test.rb | 2 ++ test/unit/resources/parse_config_test.rb | 2 ++ test/unit/resources/passwd_test.rb | 2 ++ test/unit/resources/pip_test.rb | 2 ++ test/unit/resources/platform_test.rb | 2 ++ test/unit/resources/port_linuxports_test.rb | 4 +++- test/unit/resources/port_test.rb | 2 ++ test/unit/resources/postgres_conf_test.rb | 2 ++ test/unit/resources/postgres_hba_conf_test.rb | 2 ++ test/unit/resources/postgres_ident_conf_test.rb | 3 +++ test/unit/resources/postgres_session_test.rb | 2 ++ test/unit/resources/powershell_test.rb | 2 ++ test/unit/resources/processes_test.rb | 2 ++ test/unit/resources/rabbitmq_conf_test.rb | 2 ++ test/unit/resources/registry_key_test.rb | 2 ++ test/unit/resources/security_identifier_test.rb | 2 ++ test/unit/resources/security_policy_test.rb | 2 ++ test/unit/resources/service_test.rb | 2 ++ test/unit/resources/shadow_test.rb | 2 ++ test/unit/resources/ssh_conf_test.rb | 2 ++ test/unit/resources/ssl_test.rb | 2 ++ test/unit/resources/sys_info_test.rb | 2 ++ test/unit/resources/toml_test.rb | 2 ++ test/unit/resources/vbscript_test.rb | 2 ++ test/unit/resources/virtualization_test.rb | 3 +++ test/unit/resources/windows_feature_test.rb | 2 ++ test/unit/resources/windows_hotfix_test.rb | 2 ++ test/unit/resources/windows_task_test.rb | 2 ++ test/unit/resources/wmi_test.rb | 2 ++ test/unit/resources/x509_certificate_test.rb | 2 ++ test/unit/resources/xinetd_conf_test.rb | 2 ++ test/unit/resources/xml_test.rb | 2 ++ test/unit/resources/yaml_test.rb | 2 ++ test/unit/resources/yum_test.rb | 2 ++ test/unit/resources/zfs_dataset_test.rb | 2 ++ test/unit/resources/zfs_pool_test.rb | 2 ++ 252 files changed, 562 insertions(+), 24 deletions(-) diff --git a/lib/inspec/resources/apt.rb b/lib/inspec/resources/apt.rb index f99d2f0f3..7cd17ebce 100644 --- a/lib/inspec/resources/apt.rb +++ b/lib/inspec/resources/apt.rb @@ -1,3 +1,4 @@ +require 'inspec/resources/command' # Verifies apt and ppa repositories # diff --git a/lib/inspec/resources/audit_policy.rb b/lib/inspec/resources/audit_policy.rb index 43ba7c49c..54a397e06 100644 --- a/lib/inspec/resources/audit_policy.rb +++ b/lib/inspec/resources/audit_policy.rb @@ -1,3 +1,5 @@ +require 'inspec/resources/command' + # copyright: 2015, Vulcano Security GmbH # Advanced Auditing: diff --git a/lib/inspec/resources/bond.rb b/lib/inspec/resources/bond.rb index 47d2464f0..11a54ff1d 100644 --- a/lib/inspec/resources/bond.rb +++ b/lib/inspec/resources/bond.rb @@ -1,6 +1,6 @@ - require 'inspec/resources/file' require 'inspec/utils/file_reader' +require 'inspec/utils/simpleconfig' module Inspec::Resources class Bond < FileResource diff --git a/lib/inspec/resources/bridge.rb b/lib/inspec/resources/bridge.rb index 82fc37f78..e5901785b 100644 --- a/lib/inspec/resources/bridge.rb +++ b/lib/inspec/resources/bridge.rb @@ -1,3 +1,4 @@ +require 'inspec/resources/file' # Usage: # describe bridge('br0') do diff --git a/lib/inspec/resources/chocolatey_package.rb b/lib/inspec/resources/chocolatey_package.rb index a8924d915..c717087c2 100644 --- a/lib/inspec/resources/chocolatey_package.rb +++ b/lib/inspec/resources/chocolatey_package.rb @@ -1,5 +1,8 @@ # frozen_string_literal: true +require 'inspec/resources/command' +require 'inspec/resources/powershell' + # Check for Chocolatey packages to be installed module Inspec::Resources class ChocoPkg < Inspec.resource(1) diff --git a/lib/inspec/resources/cpan.rb b/lib/inspec/resources/cpan.rb index 02fcb3ac0..d235a65d5 100644 --- a/lib/inspec/resources/cpan.rb +++ b/lib/inspec/resources/cpan.rb @@ -1,3 +1,4 @@ +require 'inspec/resources/command' # Usage: # describe cpan('DBD::Pg') do diff --git a/lib/inspec/resources/cran.rb b/lib/inspec/resources/cran.rb index a2bd54ad2..6194a12a6 100644 --- a/lib/inspec/resources/cran.rb +++ b/lib/inspec/resources/cran.rb @@ -1,3 +1,4 @@ +require 'inspec/resources/command' # Usage: # describe cran('DBI') do diff --git a/lib/inspec/resources/crontab.rb b/lib/inspec/resources/crontab.rb index daf62f622..479e3175e 100644 --- a/lib/inspec/resources/crontab.rb +++ b/lib/inspec/resources/crontab.rb @@ -1,4 +1,4 @@ - +require 'inspec/resources/file' require 'inspec/utils/parser' require 'inspec/utils/filter' diff --git a/lib/inspec/resources/csv.rb b/lib/inspec/resources/csv.rb index 3d2a4b75b..345a57db5 100644 --- a/lib/inspec/resources/csv.rb +++ b/lib/inspec/resources/csv.rb @@ -1,3 +1,4 @@ +require 'inspec/resources/json' # Parses a csv document # This implementation was inspired by a blog post diff --git a/lib/inspec/resources/docker.rb b/lib/inspec/resources/docker.rb index a4bdf547c..b7a0e9f4a 100644 --- a/lib/inspec/resources/docker.rb +++ b/lib/inspec/resources/docker.rb @@ -2,6 +2,7 @@ # Copyright 2017, Christoph Hartmann # +require 'inspec/resources/command' require 'inspec/utils/filter' require 'hashie/mash' diff --git a/lib/inspec/resources/docker_container.rb b/lib/inspec/resources/docker_container.rb index 1e57b79a3..ee2df90ee 100644 --- a/lib/inspec/resources/docker_container.rb +++ b/lib/inspec/resources/docker_container.rb @@ -1,6 +1,7 @@ # # Copyright 2017, Christoph Hartmann +require 'inspec/resources/docker' require_relative 'docker_object' module Inspec::Resources diff --git a/lib/inspec/resources/docker_image.rb b/lib/inspec/resources/docker_image.rb index f05f631ed..b19d660f9 100644 --- a/lib/inspec/resources/docker_image.rb +++ b/lib/inspec/resources/docker_image.rb @@ -1,6 +1,7 @@ # # Copyright 2017, Christoph Hartmann +require 'inspec/resources/docker' require_relative 'docker_object' module Inspec::Resources diff --git a/lib/inspec/resources/docker_plugin.rb b/lib/inspec/resources/docker_plugin.rb index f5ce8dd46..dc2fbbe4a 100644 --- a/lib/inspec/resources/docker_plugin.rb +++ b/lib/inspec/resources/docker_plugin.rb @@ -1,3 +1,4 @@ +require 'inspec/resources/docker' module Inspec::Resources class DockerPlugin < Inspec.resource(1) diff --git a/lib/inspec/resources/docker_service.rb b/lib/inspec/resources/docker_service.rb index 7594235dc..1d77a3ff5 100644 --- a/lib/inspec/resources/docker_service.rb +++ b/lib/inspec/resources/docker_service.rb @@ -1,6 +1,7 @@ # # Copyright 2017, Christoph Hartmann +require 'inspec/resources/docker' require_relative 'docker_object' module Inspec::Resources diff --git a/lib/inspec/resources/filesystem.rb b/lib/inspec/resources/filesystem.rb index 02c8575e8..61dd0458e 100644 --- a/lib/inspec/resources/filesystem.rb +++ b/lib/inspec/resources/filesystem.rb @@ -1,3 +1,5 @@ +require 'inspec/resources/command' + module Inspec::Resources class FileSystemResource < Inspec.resource(1) name 'filesystem' diff --git a/lib/inspec/resources/firewalld.rb b/lib/inspec/resources/firewalld.rb index 5aacc6975..7f4b10557 100644 --- a/lib/inspec/resources/firewalld.rb +++ b/lib/inspec/resources/firewalld.rb @@ -1,3 +1,4 @@ +require 'inspec/resources/command' module Inspec::Resources class FirewallD < Inspec.resource(1) diff --git a/lib/inspec/resources/gem.rb b/lib/inspec/resources/gem.rb index 2f04ef8c0..6d5d93cc1 100644 --- a/lib/inspec/resources/gem.rb +++ b/lib/inspec/resources/gem.rb @@ -1,3 +1,4 @@ +require 'inspec/resources/command' module Inspec::Resources class GemPackage < Inspec.resource(1) diff --git a/lib/inspec/resources/groups.rb b/lib/inspec/resources/groups.rb index c738a9623..b7f1197fd 100644 --- a/lib/inspec/resources/groups.rb +++ b/lib/inspec/resources/groups.rb @@ -1,4 +1,6 @@ - +require 'inspec/resources/etc_group' +require 'inspec/resources/powershell' +require 'inspec/resources/parse_config' require 'inspec/utils/filter' module Inspec::Resources diff --git a/lib/inspec/resources/host.rb b/lib/inspec/resources/host.rb index 33cb49ce7..2f27fb9c1 100644 --- a/lib/inspec/resources/host.rb +++ b/lib/inspec/resources/host.rb @@ -1,3 +1,4 @@ +require 'inspec/resources/command' # Usage: # describe host('example.com') do diff --git a/lib/inspec/resources/http.rb b/lib/inspec/resources/http.rb index f1755144f..21538dd82 100644 --- a/lib/inspec/resources/http.rb +++ b/lib/inspec/resources/http.rb @@ -2,6 +2,7 @@ # copyright: 2017, Chef Software Inc # license: Apache v2 +require 'inspec/resources/command' require 'faraday' require 'faraday_middleware' require 'hashie' diff --git a/lib/inspec/resources/iis_app_pool.rb b/lib/inspec/resources/iis_app_pool.rb index a51914c95..34e789cd4 100644 --- a/lib/inspec/resources/iis_app_pool.rb +++ b/lib/inspec/resources/iis_app_pool.rb @@ -1,4 +1,7 @@ # frozen_string_literal: true + +require 'inspec/resources/powershell' + # check for web applications in IIS # Note: this is only supported in windows 2012 and later diff --git a/lib/inspec/resources/iis_site.rb b/lib/inspec/resources/iis_site.rb index 0999a3cff..cd003ab81 100644 --- a/lib/inspec/resources/iis_site.rb +++ b/lib/inspec/resources/iis_site.rb @@ -1,4 +1,7 @@ # frozen_string_literal: true + +require 'inspec/resources/command' + # check for site in IIS # Usage: # describe iis_site('Default Web Site') do diff --git a/lib/inspec/resources/ini.rb b/lib/inspec/resources/ini.rb index 5061bac84..97f246ea7 100644 --- a/lib/inspec/resources/ini.rb +++ b/lib/inspec/resources/ini.rb @@ -1,4 +1,4 @@ - +require 'inspec/resources/json' require 'inspec/utils/simpleconfig' module Inspec::Resources diff --git a/lib/inspec/resources/interface.rb b/lib/inspec/resources/interface.rb index c817f4d26..fc7c68aaf 100644 --- a/lib/inspec/resources/interface.rb +++ b/lib/inspec/resources/interface.rb @@ -1,5 +1,6 @@ - +require 'inspec/resources/command' require 'inspec/utils/convert' +require 'inspec/utils/simpleconfig' module Inspec::Resources class NetworkInterface < Inspec.resource(1) diff --git a/lib/inspec/resources/iptables.rb b/lib/inspec/resources/iptables.rb index 6c51615b9..c15dbe056 100644 --- a/lib/inspec/resources/iptables.rb +++ b/lib/inspec/resources/iptables.rb @@ -1,3 +1,4 @@ +require 'inspec/resources/command' # Usage: # describe iptables do diff --git a/lib/inspec/resources/kernel_module.rb b/lib/inspec/resources/kernel_module.rb index 9816746fc..adc7ddfb1 100644 --- a/lib/inspec/resources/kernel_module.rb +++ b/lib/inspec/resources/kernel_module.rb @@ -1,3 +1,4 @@ +require 'inspec/resources/command' module Inspec::Resources class KernelModule < Inspec.resource(1) diff --git a/lib/inspec/resources/kernel_parameter.rb b/lib/inspec/resources/kernel_parameter.rb index ad179565b..51f57373c 100644 --- a/lib/inspec/resources/kernel_parameter.rb +++ b/lib/inspec/resources/kernel_parameter.rb @@ -1,3 +1,4 @@ +require 'inspec/resources/command' module Inspec::Resources class KernelParameter < Inspec.resource(1) diff --git a/lib/inspec/resources/mount.rb b/lib/inspec/resources/mount.rb index a52a6f6fb..ae6d3a448 100644 --- a/lib/inspec/resources/mount.rb +++ b/lib/inspec/resources/mount.rb @@ -1,6 +1,3 @@ - -require 'inspec/utils/simpleconfig' - module Inspec::Resources class Mount < Inspec.resource(1) name 'mount' diff --git a/lib/inspec/resources/mssql_session.rb b/lib/inspec/resources/mssql_session.rb index 8bd68e091..05cbfc5db 100644 --- a/lib/inspec/resources/mssql_session.rb +++ b/lib/inspec/resources/mssql_session.rb @@ -1,4 +1,4 @@ - +require 'inspec/resources/command' require 'hashie/mash' require 'inspec/utils/database_helpers' diff --git a/lib/inspec/resources/mysql_session.rb b/lib/inspec/resources/mysql_session.rb index dbd160db1..fd3bb6c86 100644 --- a/lib/inspec/resources/mysql_session.rb +++ b/lib/inspec/resources/mysql_session.rb @@ -1,5 +1,6 @@ # copyright: 2015, Vulcano Security GmbH +require 'inspec/resources/command' require 'shellwords' module Inspec::Resources diff --git a/lib/inspec/resources/nginx.rb b/lib/inspec/resources/nginx.rb index 0e3df9858..3bb91a63c 100644 --- a/lib/inspec/resources/nginx.rb +++ b/lib/inspec/resources/nginx.rb @@ -1,6 +1,7 @@ require 'pathname' require 'hashie/mash' +require 'inspec/resources/command' module Inspec::Resources class Nginx < Inspec.resource(1) diff --git a/lib/inspec/resources/npm.rb b/lib/inspec/resources/npm.rb index 631d41db8..812151c56 100644 --- a/lib/inspec/resources/npm.rb +++ b/lib/inspec/resources/npm.rb @@ -1,4 +1,4 @@ - +require 'inspec/resources/command' require 'shellwords' module Inspec::Resources diff --git a/lib/inspec/resources/oneget.rb b/lib/inspec/resources/oneget.rb index ee4718273..c83600255 100644 --- a/lib/inspec/resources/oneget.rb +++ b/lib/inspec/resources/oneget.rb @@ -1,3 +1,4 @@ +require 'inspec/resources/command' # This resource talks with OneGet (https://github.com/OneGet/oneget) # Its part of Windows Management Framework 5.0 and part of Windows 10 diff --git a/lib/inspec/resources/oracledb_session.rb b/lib/inspec/resources/oracledb_session.rb index defe0fd26..c251d63b5 100644 --- a/lib/inspec/resources/oracledb_session.rb +++ b/lib/inspec/resources/oracledb_session.rb @@ -1,4 +1,4 @@ - +require 'inspec/resources/command' require 'hashie/mash' require 'inspec/utils/database_helpers' require 'htmlentities' diff --git a/lib/inspec/resources/package.rb b/lib/inspec/resources/package.rb index be46d5023..6fbdc5a1a 100644 --- a/lib/inspec/resources/package.rb +++ b/lib/inspec/resources/package.rb @@ -1,3 +1,5 @@ +require 'inspec/resources/directory' +require 'inspec/utils/simpleconfig' # Resource to determine package information # diff --git a/lib/inspec/resources/packages.rb b/lib/inspec/resources/packages.rb index 24a9ecfb2..26842ffd5 100644 --- a/lib/inspec/resources/packages.rb +++ b/lib/inspec/resources/packages.rb @@ -1,6 +1,7 @@ # copyright: 2017, Chef Software, Inc. require 'inspec/utils/filter' +require 'inspec/resources/command' module Inspec::Resources class Packages < Inspec.resource(1) diff --git a/lib/inspec/resources/parse_config.rb b/lib/inspec/resources/parse_config.rb index 2b457562b..ec9698d41 100644 --- a/lib/inspec/resources/parse_config.rb +++ b/lib/inspec/resources/parse_config.rb @@ -10,6 +10,7 @@ # describe parse_config(audit, options ) do require 'inspec/utils/file_reader' +require 'inspec/utils/simpleconfig' module Inspec::Resources class PConfig < Inspec.resource(1) diff --git a/lib/inspec/resources/pip.rb b/lib/inspec/resources/pip.rb index 1a381adff..bd6533c8d 100644 --- a/lib/inspec/resources/pip.rb +++ b/lib/inspec/resources/pip.rb @@ -1,9 +1,10 @@ +require 'inspec/resources/command' +require 'inspec/utils/simpleconfig' # Usage: # describe pip('Jinja2') do # it { should be_installed } # end -# module Inspec::Resources class PipPackage < Inspec.resource(1) diff --git a/lib/inspec/resources/processes.rb b/lib/inspec/resources/processes.rb index 1957f6ee5..741dae8bf 100644 --- a/lib/inspec/resources/processes.rb +++ b/lib/inspec/resources/processes.rb @@ -2,6 +2,7 @@ require 'inspec/utils/filter' require 'ostruct' +require 'inspec/resources/command' module Inspec::Resources class Processes < Inspec.resource(1) diff --git a/lib/inspec/resources/registry_key.rb b/lib/inspec/resources/registry_key.rb index 249482064..2386afded 100644 --- a/lib/inspec/resources/registry_key.rb +++ b/lib/inspec/resources/registry_key.rb @@ -1,6 +1,7 @@ # copyright: 2015, Vulcano Security GmbH require 'json' +require 'inspec/resources/powershell' # Three constructor methods are available: # 1. resistry_key(path'): diff --git a/lib/inspec/resources/security_identifier.rb b/lib/inspec/resources/security_identifier.rb index f5d7fca30..8b24c3d49 100644 --- a/lib/inspec/resources/security_identifier.rb +++ b/lib/inspec/resources/security_identifier.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require 'inspec/resources/command' + module Inspec::Resources class SecurityIdentifier < Inspec.resource(1) name 'security_identifier' diff --git a/lib/inspec/resources/security_policy.rb b/lib/inspec/resources/security_policy.rb index 49bb66c17..214ab0a5d 100644 --- a/lib/inspec/resources/security_policy.rb +++ b/lib/inspec/resources/security_policy.rb @@ -11,6 +11,8 @@ # parameters. Therefore we need a combination of Registry and secedit output require 'hashie' +require 'inspec/resources/command' +require 'inspec/utils/simpleconfig' module Inspec::Resources # known and supported MS privilege rights diff --git a/lib/inspec/resources/sys_info.rb b/lib/inspec/resources/sys_info.rb index 9867127e1..c461bd26f 100644 --- a/lib/inspec/resources/sys_info.rb +++ b/lib/inspec/resources/sys_info.rb @@ -1,3 +1,6 @@ +require 'inspec/resources/command' +require 'inspec/resources/powershell' + module Inspec::Resources # this resource returns additional system informatio class System < Inspec.resource(1) diff --git a/lib/inspec/resources/vbscript.rb b/lib/inspec/resources/vbscript.rb index a808f64ee..fea794ee5 100644 --- a/lib/inspec/resources/vbscript.rb +++ b/lib/inspec/resources/vbscript.rb @@ -1,4 +1,4 @@ - +require 'inspec/resources/powershell' require 'securerandom' module Inspec::Resources diff --git a/lib/inspec/resources/windows_feature.rb b/lib/inspec/resources/windows_feature.rb index 38034613e..3bc2022ba 100644 --- a/lib/inspec/resources/windows_feature.rb +++ b/lib/inspec/resources/windows_feature.rb @@ -1,3 +1,4 @@ +require 'inspec/resources/command' module Inspec::Resources class WindowsFeature < Inspec.resource(1) diff --git a/lib/inspec/resources/windows_hotfix.rb b/lib/inspec/resources/windows_hotfix.rb index 8b9719b5b..72e449ca1 100644 --- a/lib/inspec/resources/windows_hotfix.rb +++ b/lib/inspec/resources/windows_hotfix.rb @@ -1,3 +1,4 @@ +require 'inspec/resources/powershell' module Inspec::Resources class WindowsHotfix < Inspec.resource(1) diff --git a/lib/inspec/resources/windows_task.rb b/lib/inspec/resources/windows_task.rb index 249ac32ea..5d9085c1a 100644 --- a/lib/inspec/resources/windows_task.rb +++ b/lib/inspec/resources/windows_task.rb @@ -1,3 +1,5 @@ +require 'inspec/resources/powershell' + module Inspec::Resources class WindowsTasks < Inspec.resource(1) # TODO: rename singular name 'windows_task' diff --git a/lib/inspec/resources/wmi.rb b/lib/inspec/resources/wmi.rb index f29e7326c..6ed81de8a 100644 --- a/lib/inspec/resources/wmi.rb +++ b/lib/inspec/resources/wmi.rb @@ -1,4 +1,4 @@ - +require 'inspec/resources/powershell' require 'inspec/utils/object_traversal' module Inspec::Resources diff --git a/lib/inspec/resources/xml.rb b/lib/inspec/resources/xml.rb index f2ce317be..c7537f0d1 100644 --- a/lib/inspec/resources/xml.rb +++ b/lib/inspec/resources/xml.rb @@ -1,3 +1,4 @@ +require 'inspec/resources/json' module Inspec::Resources class XmlConfig < JsonConfig diff --git a/lib/inspec/resources/yum.rb b/lib/inspec/resources/yum.rb index fcf4d044b..20f96d971 100644 --- a/lib/inspec/resources/yum.rb +++ b/lib/inspec/resources/yum.rb @@ -1,3 +1,4 @@ +require 'inspec/resources/command' # Usage: # describe yum do diff --git a/lib/inspec/resources/zfs_dataset.rb b/lib/inspec/resources/zfs_dataset.rb index 5eb11d083..ea840116f 100644 --- a/lib/inspec/resources/zfs_dataset.rb +++ b/lib/inspec/resources/zfs_dataset.rb @@ -1,3 +1,4 @@ +require 'inspec/resources/command' module Inspec::Resources class ZfsDataset < Inspec.resource(1) diff --git a/lib/inspec/resources/zfs_pool.rb b/lib/inspec/resources/zfs_pool.rb index bed9c7bc9..d9b99f77f 100644 --- a/lib/inspec/resources/zfs_pool.rb +++ b/lib/inspec/resources/zfs_pool.rb @@ -1,3 +1,4 @@ +require 'inspec/resources/command' module Inspec::Resources class ZfsPool < Inspec.resource(1) diff --git a/lib/inspec/utils/parser.rb b/lib/inspec/utils/parser.rb index 8b57d147d..6cc540136 100644 --- a/lib/inspec/utils/parser.rb +++ b/lib/inspec/utils/parser.rb @@ -1,4 +1,6 @@ +require 'inspec/resources/command' + module PasswdParser # Parse /etc/passwd files. # @@ -269,3 +271,5 @@ module XinetdParser res end end + +require 'inspec/utils/simpleconfig' diff --git a/lib/resource_support/aws/aws_plural_resource_mixin.rb b/lib/resource_support/aws/aws_plural_resource_mixin.rb index 1c44746c6..c8f588971 100644 --- a/lib/resource_support/aws/aws_plural_resource_mixin.rb +++ b/lib/resource_support/aws/aws_plural_resource_mixin.rb @@ -1,3 +1,6 @@ +require 'resource_support/aws/aws_resource_mixin' +require 'resource_support/aws/aws_backend_factory_mixin' + module AwsPluralResourceMixin include AwsResourceMixin attr_reader :table diff --git a/lib/resource_support/aws/aws_singular_resource_mixin.rb b/lib/resource_support/aws/aws_singular_resource_mixin.rb index a34556f88..accf71f60 100644 --- a/lib/resource_support/aws/aws_singular_resource_mixin.rb +++ b/lib/resource_support/aws/aws_singular_resource_mixin.rb @@ -1,3 +1,6 @@ +require 'resource_support/aws/aws_resource_mixin' +require 'resource_support/aws/aws_backend_factory_mixin' + module AwsSingularResourceMixin include AwsResourceMixin diff --git a/lib/resources/aws/aws_billing_report.rb b/lib/resources/aws/aws_billing_report.rb index 865812a90..5beb4bdd7 100644 --- a/lib/resources/aws/aws_billing_report.rb +++ b/lib/resources/aws/aws_billing_report.rb @@ -1,3 +1,10 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' + +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-costandusagereportservice.rb' + class AwsBillingReport < Inspec.resource(1) name 'aws_billing_report' supports platform: 'aws' diff --git a/lib/resources/aws/aws_billing_reports.rb b/lib/resources/aws/aws_billing_reports.rb index d6da2b234..97696232c 100644 --- a/lib/resources/aws/aws_billing_reports.rb +++ b/lib/resources/aws/aws_billing_reports.rb @@ -1,4 +1,7 @@ require 'inspec/utils/filter' +require 'resource_support/aws/aws_plural_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-costandusagereportservice' class AwsBillingReports < Inspec.resource(1) name 'aws_billing_reports' diff --git a/lib/resources/aws/aws_cloudtrail_trail.rb b/lib/resources/aws/aws_cloudtrail_trail.rb index a3ac6e73c..57a437208 100644 --- a/lib/resources/aws/aws_cloudtrail_trail.rb +++ b/lib/resources/aws/aws_cloudtrail_trail.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-cloudtrail' + class AwsCloudTrailTrail < Inspec.resource(1) name 'aws_cloudtrail_trail' desc 'Verifies settings for an individual AWS CloudTrail Trail' diff --git a/lib/resources/aws/aws_cloudtrail_trails.rb b/lib/resources/aws/aws_cloudtrail_trails.rb index bc5c4e309..d6d3d96d9 100644 --- a/lib/resources/aws/aws_cloudtrail_trails.rb +++ b/lib/resources/aws/aws_cloudtrail_trails.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_plural_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-cloudtrail' + class AwsCloudTrailTrails < Inspec.resource(1) name 'aws_cloudtrail_trails' desc 'Verifies settings for AWS CloudTrail Trails in bulk' diff --git a/lib/resources/aws/aws_cloudwatch_alarm.rb b/lib/resources/aws/aws_cloudwatch_alarm.rb index 92a93ea26..72b89be80 100644 --- a/lib/resources/aws/aws_cloudwatch_alarm.rb +++ b/lib/resources/aws/aws_cloudwatch_alarm.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-cloudwatch' + class AwsCloudwatchAlarm < Inspec.resource(1) name 'aws_cloudwatch_alarm' desc <<~EXAMPLE diff --git a/lib/resources/aws/aws_cloudwatch_log_metric_filter.rb b/lib/resources/aws/aws_cloudwatch_log_metric_filter.rb index bb2b5ff34..663908946 100644 --- a/lib/resources/aws/aws_cloudwatch_log_metric_filter.rb +++ b/lib/resources/aws/aws_cloudwatch_log_metric_filter.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-cloudwatchlogs' + class AwsCloudwatchLogMetricFilter < Inspec.resource(1) name 'aws_cloudwatch_log_metric_filter' desc 'Verifies individual Cloudwatch Log Metric Filters' diff --git a/lib/resources/aws/aws_config_delivery_channel.rb b/lib/resources/aws/aws_config_delivery_channel.rb index 5ebf420b2..912693f01 100644 --- a/lib/resources/aws/aws_config_delivery_channel.rb +++ b/lib/resources/aws/aws_config_delivery_channel.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-configservice' + class AwsConfigDeliveryChannel < Inspec.resource(1) name 'aws_config_delivery_channel' desc 'Verifies settings for AWS Config Delivery Channel' diff --git a/lib/resources/aws/aws_config_recorder.rb b/lib/resources/aws/aws_config_recorder.rb index 4ebf3b71b..56f794c4a 100644 --- a/lib/resources/aws/aws_config_recorder.rb +++ b/lib/resources/aws/aws_config_recorder.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-configservice' + class AwsConfigurationRecorder < Inspec.resource(1) name 'aws_config_recorder' desc 'Verifies settings for AWS Configuration Recorder' diff --git a/lib/resources/aws/aws_ebs_volume.rb b/lib/resources/aws/aws_ebs_volume.rb index 842183909..85be0439d 100644 --- a/lib/resources/aws/aws_ebs_volume.rb +++ b/lib/resources/aws/aws_ebs_volume.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-ec2' + class AwsEbsVolume < Inspec.resource(1) name 'aws_ebs_volume' desc 'Verifies settings for an EBS volume' diff --git a/lib/resources/aws/aws_ebs_volumes.rb b/lib/resources/aws/aws_ebs_volumes.rb index dca0ff9d8..5fd1c2d5c 100644 --- a/lib/resources/aws/aws_ebs_volumes.rb +++ b/lib/resources/aws/aws_ebs_volumes.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_plural_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-ec2' + class AwsEbsVolumes < Inspec.resource(1) name 'aws_ebs_volumes' desc 'Verifies settings for AWS EBS Volumes in bulk' diff --git a/lib/resources/aws/aws_ec2_instance.rb b/lib/resources/aws/aws_ec2_instance.rb index e638e3e1a..6539ea09b 100644 --- a/lib/resources/aws/aws_ec2_instance.rb +++ b/lib/resources/aws/aws_ec2_instance.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-ec2' + class AwsEc2Instance < Inspec.resource(1) name 'aws_ec2_instance' desc 'Verifies settings for an EC2 instance' diff --git a/lib/resources/aws/aws_ec2_instances.rb b/lib/resources/aws/aws_ec2_instances.rb index 3f819db95..fa2e64a85 100644 --- a/lib/resources/aws/aws_ec2_instances.rb +++ b/lib/resources/aws/aws_ec2_instances.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_plural_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-ec2' + class AwsEc2Instances < Inspec.resource(1) name 'aws_ec2_instances' desc 'Verifies settings for AWS EC2 Instances in bulk' diff --git a/lib/resources/aws/aws_ecs_cluster.rb b/lib/resources/aws/aws_ecs_cluster.rb index 0ffdf7e38..cc294562c 100644 --- a/lib/resources/aws/aws_ecs_cluster.rb +++ b/lib/resources/aws/aws_ecs_cluster.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-ecs' + class AwsEcsCluster < Inspec.resource(1) name 'aws_ecs_cluster' desc 'Verifies settings for an ECS cluster' diff --git a/lib/resources/aws/aws_eks_cluster.rb b/lib/resources/aws/aws_eks_cluster.rb index 737f50374..e91c5c478 100644 --- a/lib/resources/aws/aws_eks_cluster.rb +++ b/lib/resources/aws/aws_eks_cluster.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-eks' + class AwsEksCluster < Inspec.resource(1) name 'aws_eks_cluster' desc 'Verifies settings for an EKS cluster' diff --git a/lib/resources/aws/aws_elb.rb b/lib/resources/aws/aws_elb.rb index 40d60a6fc..34694d1cd 100644 --- a/lib/resources/aws/aws_elb.rb +++ b/lib/resources/aws/aws_elb.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-elasticloadbalancing' + class AwsElb < Inspec.resource(1) name 'aws_elb' desc 'Verifies settings for AWS Elastic Load Balancer' diff --git a/lib/resources/aws/aws_elbs.rb b/lib/resources/aws/aws_elbs.rb index 34e9299b2..628df1620 100644 --- a/lib/resources/aws/aws_elbs.rb +++ b/lib/resources/aws/aws_elbs.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_plural_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-elasticloadbalancing' + class AwsElbs < Inspec.resource(1) name 'aws_elbs' desc 'Verifies settings for AWS ELBs (classic Elastic Load Balancers) in bulk' diff --git a/lib/resources/aws/aws_flow_log.rb b/lib/resources/aws/aws_flow_log.rb index b97f97337..43b802a5a 100644 --- a/lib/resources/aws/aws_flow_log.rb +++ b/lib/resources/aws/aws_flow_log.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-ec2' + class AwsFlowLog < Inspec.resource(1) name 'aws_flow_log' supports platform: 'aws' diff --git a/lib/resources/aws/aws_iam_access_key.rb b/lib/resources/aws/aws_iam_access_key.rb index 3b13786ea..eeb7387d2 100644 --- a/lib/resources/aws/aws_iam_access_key.rb +++ b/lib/resources/aws/aws_iam_access_key.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-iam' + class AwsIamAccessKey < Inspec.resource(1) name 'aws_iam_access_key' desc 'Verifies settings for an individual IAM access key' diff --git a/lib/resources/aws/aws_iam_access_keys.rb b/lib/resources/aws/aws_iam_access_keys.rb index a25cc0738..81c428a7a 100644 --- a/lib/resources/aws/aws_iam_access_keys.rb +++ b/lib/resources/aws/aws_iam_access_keys.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_plural_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-iam' + class AwsIamAccessKeys < Inspec.resource(1) name 'aws_iam_access_keys' desc 'Verifies settings for AWS IAM Access Keys in bulk' diff --git a/lib/resources/aws/aws_iam_group.rb b/lib/resources/aws/aws_iam_group.rb index e7387bcc7..99c654d75 100644 --- a/lib/resources/aws/aws_iam_group.rb +++ b/lib/resources/aws/aws_iam_group.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-iam' + class AwsIamGroup < Inspec.resource(1) name 'aws_iam_group' desc 'Verifies settings for AWS IAM Group' diff --git a/lib/resources/aws/aws_iam_groups.rb b/lib/resources/aws/aws_iam_groups.rb index 2c2ce56ea..ba4d19b4c 100644 --- a/lib/resources/aws/aws_iam_groups.rb +++ b/lib/resources/aws/aws_iam_groups.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_plural_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-iam' + class AwsIamGroups < Inspec.resource(1) name 'aws_iam_groups' desc 'Verifies settings for AWS IAM groups in bulk' diff --git a/lib/resources/aws/aws_iam_password_policy.rb b/lib/resources/aws/aws_iam_password_policy.rb index 82ce5ae62..189275275 100644 --- a/lib/resources/aws/aws_iam_password_policy.rb +++ b/lib/resources/aws/aws_iam_password_policy.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-iam' + class AwsIamPasswordPolicy < Inspec.resource(1) name 'aws_iam_password_policy' desc 'Verifies iam password policy' diff --git a/lib/resources/aws/aws_iam_policies.rb b/lib/resources/aws/aws_iam_policies.rb index 7f2ea8ad1..ecf89d3c2 100644 --- a/lib/resources/aws/aws_iam_policies.rb +++ b/lib/resources/aws/aws_iam_policies.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_plural_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-iam' + class AwsIamPolicies < Inspec.resource(1) name 'aws_iam_policies' desc 'Verifies settings for AWS IAM Policies in bulk' diff --git a/lib/resources/aws/aws_iam_policy.rb b/lib/resources/aws/aws_iam_policy.rb index 2fc041194..f7062322b 100644 --- a/lib/resources/aws/aws_iam_policy.rb +++ b/lib/resources/aws/aws_iam_policy.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-iam' + require 'json' require 'set' require 'uri' diff --git a/lib/resources/aws/aws_iam_role.rb b/lib/resources/aws/aws_iam_role.rb index 2b29d4224..4dfa8b923 100644 --- a/lib/resources/aws/aws_iam_role.rb +++ b/lib/resources/aws/aws_iam_role.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-iam' + class AwsIamRole < Inspec.resource(1) name 'aws_iam_role' desc 'Verifies settings for an IAM Role' diff --git a/lib/resources/aws/aws_iam_root_user.rb b/lib/resources/aws/aws_iam_root_user.rb index c4853082a..b5231be15 100644 --- a/lib/resources/aws/aws_iam_root_user.rb +++ b/lib/resources/aws/aws_iam_root_user.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-iam' + class AwsIamRootUser < Inspec.resource(1) name 'aws_iam_root_user' desc 'Verifies settings for AWS root account' diff --git a/lib/resources/aws/aws_iam_user.rb b/lib/resources/aws/aws_iam_user.rb index 161133fab..b817ebf30 100644 --- a/lib/resources/aws/aws_iam_user.rb +++ b/lib/resources/aws/aws_iam_user.rb @@ -1,4 +1,6 @@ -require 'resource_support/aws' +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-iam' class AwsIamUser < Inspec.resource(1) name 'aws_iam_user' diff --git a/lib/resources/aws/aws_iam_users.rb b/lib/resources/aws/aws_iam_users.rb index 4572f3730..adc2f819f 100644 --- a/lib/resources/aws/aws_iam_users.rb +++ b/lib/resources/aws/aws_iam_users.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_plural_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-iam' + class AwsIamUsers < Inspec.resource(1) name 'aws_iam_users' desc 'Verifies settings for AWS IAM users' diff --git a/lib/resources/aws/aws_kms_key.rb b/lib/resources/aws/aws_kms_key.rb index aeacce9c1..053f47414 100644 --- a/lib/resources/aws/aws_kms_key.rb +++ b/lib/resources/aws/aws_kms_key.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-kms' + class AwsKmsKey < Inspec.resource(1) name 'aws_kms_key' desc 'Verifies settings for an individual AWS KMS Key' diff --git a/lib/resources/aws/aws_kms_keys.rb b/lib/resources/aws/aws_kms_keys.rb index 570d5ada8..6de91650a 100644 --- a/lib/resources/aws/aws_kms_keys.rb +++ b/lib/resources/aws/aws_kms_keys.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_plural_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-kms' + class AwsKmsKeys < Inspec.resource(1) name 'aws_kms_keys' desc 'Verifies settings for AWS KMS Keys in bulk' diff --git a/lib/resources/aws/aws_rds_instance.rb b/lib/resources/aws/aws_rds_instance.rb index 7db4e765f..26b5a68c9 100644 --- a/lib/resources/aws/aws_rds_instance.rb +++ b/lib/resources/aws/aws_rds_instance.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-rds' + class AwsRdsInstance < Inspec.resource(1) name 'aws_rds_instance' desc 'Verifies settings for an rds instance' diff --git a/lib/resources/aws/aws_route_table.rb b/lib/resources/aws/aws_route_table.rb index 81045166c..d67e1c8e1 100644 --- a/lib/resources/aws/aws_route_table.rb +++ b/lib/resources/aws/aws_route_table.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-ec2' + class AwsRouteTable < Inspec.resource(1) name 'aws_route_table' desc 'Verifies settings for an AWS Route Table' diff --git a/lib/resources/aws/aws_route_tables.rb b/lib/resources/aws/aws_route_tables.rb index 86cabb4e0..6d3a8f213 100644 --- a/lib/resources/aws/aws_route_tables.rb +++ b/lib/resources/aws/aws_route_tables.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_plural_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-ec2' + class AwsRouteTables < Inspec.resource(1) name 'aws_route_tables' desc 'Verifies settings for AWS Route Tables in bulk' diff --git a/lib/resources/aws/aws_s3_bucket.rb b/lib/resources/aws/aws_s3_bucket.rb index 7d6316b6f..0a851f1f6 100644 --- a/lib/resources/aws/aws_s3_bucket.rb +++ b/lib/resources/aws/aws_s3_bucket.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-s3' + class AwsS3Bucket < Inspec.resource(1) name 'aws_s3_bucket' desc 'Verifies settings for a s3 bucket' diff --git a/lib/resources/aws/aws_s3_bucket_object.rb b/lib/resources/aws/aws_s3_bucket_object.rb index 1a0b5d568..d4c30872d 100644 --- a/lib/resources/aws/aws_s3_bucket_object.rb +++ b/lib/resources/aws/aws_s3_bucket_object.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-s3' + class AwsS3BucketObject < Inspec.resource(1) name 'aws_s3_bucket_object' desc 'Verifies settings for a s3 bucket object' diff --git a/lib/resources/aws/aws_s3_buckets.rb b/lib/resources/aws/aws_s3_buckets.rb index 417adf237..311d6d1a7 100644 --- a/lib/resources/aws/aws_s3_buckets.rb +++ b/lib/resources/aws/aws_s3_buckets.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_plural_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-s3' + class AwsS3Buckets < Inspec.resource(1) name 'aws_s3_buckets' desc 'Verifies settings for AWS S3 Buckets in bulk' diff --git a/lib/resources/aws/aws_security_group.rb b/lib/resources/aws/aws_security_group.rb index fda46132b..667d3e635 100644 --- a/lib/resources/aws/aws_security_group.rb +++ b/lib/resources/aws/aws_security_group.rb @@ -1,6 +1,10 @@ require 'set' require 'ipaddr' +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-ec2' + class AwsSecurityGroup < Inspec.resource(1) name 'aws_security_group' desc 'Verifies settings for an individual AWS Security Group.' diff --git a/lib/resources/aws/aws_security_groups.rb b/lib/resources/aws/aws_security_groups.rb index 396db9333..f207507f9 100644 --- a/lib/resources/aws/aws_security_groups.rb +++ b/lib/resources/aws/aws_security_groups.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_plural_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-ec2' + class AwsSecurityGroups < Inspec.resource(1) name 'aws_security_groups' desc 'Verifies settings for AWS Security Groups in bulk' diff --git a/lib/resources/aws/aws_sns_subscription.rb b/lib/resources/aws/aws_sns_subscription.rb index 4bf6852da..b76eed675 100644 --- a/lib/resources/aws/aws_sns_subscription.rb +++ b/lib/resources/aws/aws_sns_subscription.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-sns' + class AwsSnsSubscription < Inspec.resource(1) name 'aws_sns_subscription' desc 'Verifies settings for an SNS Subscription' diff --git a/lib/resources/aws/aws_sns_topic.rb b/lib/resources/aws/aws_sns_topic.rb index 34f70dff2..6097c9f09 100644 --- a/lib/resources/aws/aws_sns_topic.rb +++ b/lib/resources/aws/aws_sns_topic.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-sns' + class AwsSnsTopic < Inspec.resource(1) name 'aws_sns_topic' desc 'Verifies settings for an SNS Topic' diff --git a/lib/resources/aws/aws_sns_topics.rb b/lib/resources/aws/aws_sns_topics.rb index 559f87b10..3565f322e 100644 --- a/lib/resources/aws/aws_sns_topics.rb +++ b/lib/resources/aws/aws_sns_topics.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_plural_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-sns' + class AwsSnsTopics < Inspec.resource(1) name 'aws_sns_topics' desc 'Verifies settings for SNS Topics in bulk' diff --git a/lib/resources/aws/aws_sqs_queue.rb b/lib/resources/aws/aws_sqs_queue.rb index 3ba76ba5d..cdc60736c 100644 --- a/lib/resources/aws/aws_sqs_queue.rb +++ b/lib/resources/aws/aws_sqs_queue.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-sqs' + require 'uri' class AwsSqsQueue < Inspec.resource(1) diff --git a/lib/resources/aws/aws_subnet.rb b/lib/resources/aws/aws_subnet.rb index fdd841d50..e5279e54a 100644 --- a/lib/resources/aws/aws_subnet.rb +++ b/lib/resources/aws/aws_subnet.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-ec2' + class AwsSubnet < Inspec.resource(1) name 'aws_subnet' desc 'This resource is used to test the attributes of a VPC subnet' diff --git a/lib/resources/aws/aws_subnets.rb b/lib/resources/aws/aws_subnets.rb index 2bda9d045..6750ff498 100644 --- a/lib/resources/aws/aws_subnets.rb +++ b/lib/resources/aws/aws_subnets.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_plural_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-ec2' + class AwsSubnets < Inspec.resource(1) name 'aws_subnets' desc 'Verifies settings for VPC Subnets in bulk' diff --git a/lib/resources/aws/aws_vpc.rb b/lib/resources/aws/aws_vpc.rb index 17dbd48af..b1d1d85be 100644 --- a/lib/resources/aws/aws_vpc.rb +++ b/lib/resources/aws/aws_vpc.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_singular_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-ec2' + class AwsVpc < Inspec.resource(1) name 'aws_vpc' desc 'Verifies settings for AWS VPC' diff --git a/lib/resources/aws/aws_vpcs.rb b/lib/resources/aws/aws_vpcs.rb index 682b5fe27..887348f74 100644 --- a/lib/resources/aws/aws_vpcs.rb +++ b/lib/resources/aws/aws_vpcs.rb @@ -1,3 +1,7 @@ +require 'resource_support/aws/aws_plural_resource_mixin' +require 'resource_support/aws/aws_backend_base' +require 'aws-sdk-ec2' + class AwsVpcs < Inspec.resource(1) name 'aws_vpcs' desc 'Verifies settings for AWS VPCs in bulk' diff --git a/test/unit/reporters/automate_test.rb b/test/unit/reporters/automate_test.rb index 6f43596e7..fc182e101 100644 --- a/test/unit/reporters/automate_test.rb +++ b/test/unit/reporters/automate_test.rb @@ -1,5 +1,5 @@ - require 'helper' +require 'inspec/reporters' describe Inspec::Reporters::Automate do let(:path) { File.expand_path(File.dirname(__FILE__)) } diff --git a/test/unit/reporters/base_test.rb b/test/unit/reporters/base_test.rb index 1d1806ba9..19e599278 100644 --- a/test/unit/reporters/base_test.rb +++ b/test/unit/reporters/base_test.rb @@ -1,5 +1,5 @@ - require 'helper' +require 'inspec/reporters' describe Inspec::Reporters::Base do let(:path) { File.expand_path(File.dirname(__FILE__)) } diff --git a/test/unit/reporters/cli_test.rb b/test/unit/reporters/cli_test.rb index b205510e3..e185476e6 100644 --- a/test/unit/reporters/cli_test.rb +++ b/test/unit/reporters/cli_test.rb @@ -1,5 +1,5 @@ - require 'helper' +require 'inspec/reporters' describe Inspec::Reporters::CLI do WINDOWS = RUBY_PLATFORM =~ /windows|mswin|msys|mingw|cygwin/ diff --git a/test/unit/reporters/json_automate_test.rb b/test/unit/reporters/json_automate_test.rb index 7555ca4dc..8c4fcaef9 100644 --- a/test/unit/reporters/json_automate_test.rb +++ b/test/unit/reporters/json_automate_test.rb @@ -1,5 +1,5 @@ - require 'helper' +require 'inspec/reporters' describe Inspec::Reporters::JsonAutomate do let(:path) { File.expand_path(File.dirname(__FILE__)) } diff --git a/test/unit/reporters/json_min_test.rb b/test/unit/reporters/json_min_test.rb index 723264495..8da91dcb0 100644 --- a/test/unit/reporters/json_min_test.rb +++ b/test/unit/reporters/json_min_test.rb @@ -1,5 +1,5 @@ - require 'helper' +require 'inspec/reporters' describe Inspec::Reporters::JsonMin do let(:path) { File.expand_path(File.dirname(__FILE__)) } diff --git a/test/unit/reporters/json_test.rb b/test/unit/reporters/json_test.rb index 3092e30b6..8f7038ead 100644 --- a/test/unit/reporters/json_test.rb +++ b/test/unit/reporters/json_test.rb @@ -1,5 +1,5 @@ - require 'helper' +require 'inspec/reporters' describe Inspec::Reporters::Json do let(:path) { File.expand_path(File.dirname(__FILE__)) } diff --git a/test/unit/reporters/junit_test.rb b/test/unit/reporters/junit_test.rb index 6af05ba15..805626b75 100644 --- a/test/unit/reporters/junit_test.rb +++ b/test/unit/reporters/junit_test.rb @@ -1,5 +1,5 @@ - require 'helper' +require 'inspec/reporters' describe Inspec::Reporters::Junit do let(:path) { File.expand_path(File.dirname(__FILE__)) } diff --git a/test/unit/reporters/yaml_test.rb b/test/unit/reporters/yaml_test.rb index a3b41b70d..06477b8e8 100644 --- a/test/unit/reporters/yaml_test.rb +++ b/test/unit/reporters/yaml_test.rb @@ -1,5 +1,5 @@ - require 'helper' +require 'inspec/reporters' describe Inspec::Reporters::Yaml do let(:path) { File.expand_path(File.dirname(__FILE__)) } diff --git a/test/unit/resources/aide_conf_test.rb b/test/unit/resources/aide_conf_test.rb index 658acc49f..2bc4dec74 100644 --- a/test/unit/resources/aide_conf_test.rb +++ b/test/unit/resources/aide_conf_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/aide_conf' describe 'Inspec::Resources::AideConf' do describe 'AideConf Parameters' do diff --git a/test/unit/resources/apache_conf_test.rb b/test/unit/resources/apache_conf_test.rb index ecd590d95..575a6e6fe 100644 --- a/test/unit/resources/apache_conf_test.rb +++ b/test/unit/resources/apache_conf_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/apache_conf' require 'hashie' describe 'Inspec::Resources::ApacheConf' do diff --git a/test/unit/resources/apt_test.rb b/test/unit/resources/apt_test.rb index 4fa6b1ca1..6fd6601a5 100644 --- a/test/unit/resources/apt_test.rb +++ b/test/unit/resources/apt_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/apt' describe 'Inspec::Resources::AptRepo' do diff --git a/test/unit/resources/audit_policy_test.rb b/test/unit/resources/audit_policy_test.rb index 8875567ec..bba127205 100644 --- a/test/unit/resources/audit_policy_test.rb +++ b/test/unit/resources/audit_policy_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/audit_policy' describe 'Inspec::Resources::AuditPolicy' do it 'check audit policy parsing' do diff --git a/test/unit/resources/auditd_conf_test.rb b/test/unit/resources/auditd_conf_test.rb index 1b14f4299..d1dedb970 100644 --- a/test/unit/resources/auditd_conf_test.rb +++ b/test/unit/resources/auditd_conf_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/auditd_conf' describe 'Inspec::Resources::AuditDaemonConf' do it 'check audit daemon config parsing' do diff --git a/test/unit/resources/auditd_test.rb b/test/unit/resources/auditd_test.rb index 50f9d9cf6..6a8904852 100644 --- a/test/unit/resources/auditd_test.rb +++ b/test/unit/resources/auditd_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/auditd' describe 'Inspec::Resources::AuditDaemon' do it 'auditd interface' do diff --git a/test/unit/resources/aws_billing_report_test.rb b/test/unit/resources/aws_billing_report_test.rb index 5ab7f62dd..736d03b2f 100644 --- a/test/unit/resources/aws_billing_report_test.rb +++ b/test/unit/resources/aws_billing_report_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_billing_report' require_relative 'aws_billing_backend' # TODO: move this to mocks diff --git a/test/unit/resources/aws_billing_reports_test.rb b/test/unit/resources/aws_billing_reports_test.rb index 8ca524fa6..8f36e8ca4 100644 --- a/test/unit/resources/aws_billing_reports_test.rb +++ b/test/unit/resources/aws_billing_reports_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_billing_reports' require_relative 'aws_billing_backend' diff --git a/test/unit/resources/aws_cloudtrail_trail_test.rb b/test/unit/resources/aws_cloudtrail_trail_test.rb index 9831f1127..065d08d41 100644 --- a/test/unit/resources/aws_cloudtrail_trail_test.rb +++ b/test/unit/resources/aws_cloudtrail_trail_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_cloudtrail_trail' require 'resource_support/aws' require 'resources/aws/aws_cloudtrail_trail' diff --git a/test/unit/resources/aws_cloudtrail_trails_test.rb b/test/unit/resources/aws_cloudtrail_trails_test.rb index 1faeb2725..97a03333f 100644 --- a/test/unit/resources/aws_cloudtrail_trails_test.rb +++ b/test/unit/resources/aws_cloudtrail_trails_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_cloudtrail_trails' require 'resource_support/aws' require 'resources/aws/aws_cloudtrail_trails' diff --git a/test/unit/resources/aws_cloudwatch_alarm_test.rb b/test/unit/resources/aws_cloudwatch_alarm_test.rb index a30f26092..169d0946d 100644 --- a/test/unit/resources/aws_cloudwatch_alarm_test.rb +++ b/test/unit/resources/aws_cloudwatch_alarm_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_cloudwatch_alarm' require 'resource_support/aws' require 'resources/aws/aws_cloudwatch_alarm' diff --git a/test/unit/resources/aws_cloudwatch_log_metric_filter_test.rb b/test/unit/resources/aws_cloudwatch_log_metric_filter_test.rb index ac2920486..2e87723b2 100644 --- a/test/unit/resources/aws_cloudwatch_log_metric_filter_test.rb +++ b/test/unit/resources/aws_cloudwatch_log_metric_filter_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_cloudwatch_log_metric_filter' require 'resource_support/aws' require 'resources/aws/aws_cloudwatch_log_metric_filter' diff --git a/test/unit/resources/aws_config_delivery_channel_test.rb b/test/unit/resources/aws_config_delivery_channel_test.rb index 23aba2e12..942fc76e0 100644 --- a/test/unit/resources/aws_config_delivery_channel_test.rb +++ b/test/unit/resources/aws_config_delivery_channel_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_config_delivery_channel' require 'resource_support/aws' require 'resources/aws/aws_config_delivery_channel' diff --git a/test/unit/resources/aws_config_recorder_test.rb b/test/unit/resources/aws_config_recorder_test.rb index 8ac8211a3..c47473d19 100644 --- a/test/unit/resources/aws_config_recorder_test.rb +++ b/test/unit/resources/aws_config_recorder_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_config_recorder' require 'resource_support/aws' require 'resources/aws/aws_config_recorder' diff --git a/test/unit/resources/aws_ebs_volume_test.rb b/test/unit/resources/aws_ebs_volume_test.rb index ee0695e61..e16153af8 100644 --- a/test/unit/resources/aws_ebs_volume_test.rb +++ b/test/unit/resources/aws_ebs_volume_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_ebs_volume' require 'resource_support/aws' require 'resources/aws/aws_ebs_volume' diff --git a/test/unit/resources/aws_ebs_volumes_test.rb b/test/unit/resources/aws_ebs_volumes_test.rb index bd14b611b..383a83745 100644 --- a/test/unit/resources/aws_ebs_volumes_test.rb +++ b/test/unit/resources/aws_ebs_volumes_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_ebs_volumes' require 'resource_support/aws' require 'resources/aws/aws_ebs_volumes' diff --git a/test/unit/resources/aws_ec2_instance_test.rb b/test/unit/resources/aws_ec2_instance_test.rb index 25ce7fce8..7dafbf5cd 100644 --- a/test/unit/resources/aws_ec2_instance_test.rb +++ b/test/unit/resources/aws_ec2_instance_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_ec2_instance' require 'resource_support/aws' require 'resources/aws/aws_ec2_instance' diff --git a/test/unit/resources/aws_ec2_instances_test.rb b/test/unit/resources/aws_ec2_instances_test.rb index cdfba44d3..335b72d7f 100644 --- a/test/unit/resources/aws_ec2_instances_test.rb +++ b/test/unit/resources/aws_ec2_instances_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_ec2_instances' require 'resource_support/aws' require 'resources/aws/aws_ec2_instances' diff --git a/test/unit/resources/aws_ecs_cluster_test.rb b/test/unit/resources/aws_ecs_cluster_test.rb index 6007cd3eb..feeecf6bf 100644 --- a/test/unit/resources/aws_ecs_cluster_test.rb +++ b/test/unit/resources/aws_ecs_cluster_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_ecs_cluster' require 'resource_support/aws' require 'resources/aws/aws_ecs_cluster' diff --git a/test/unit/resources/aws_eks_cluster_test.rb b/test/unit/resources/aws_eks_cluster_test.rb index 025060606..7554b313c 100644 --- a/test/unit/resources/aws_eks_cluster_test.rb +++ b/test/unit/resources/aws_eks_cluster_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_eks_cluster' require 'resource_support/aws' require 'resources/aws/aws_eks_cluster' diff --git a/test/unit/resources/aws_elb_test.rb b/test/unit/resources/aws_elb_test.rb index 59a3a0d73..0379618a7 100644 --- a/test/unit/resources/aws_elb_test.rb +++ b/test/unit/resources/aws_elb_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_elb' require 'resource_support/aws' require 'resources/aws/aws_elb' diff --git a/test/unit/resources/aws_elbs_test.rb b/test/unit/resources/aws_elbs_test.rb index a507218e6..c56462753 100644 --- a/test/unit/resources/aws_elbs_test.rb +++ b/test/unit/resources/aws_elbs_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_elbs' require 'resource_support/aws' require 'resources/aws/aws_elbs' diff --git a/test/unit/resources/aws_flow_log_test.rb b/test/unit/resources/aws_flow_log_test.rb index 379f3c925..b36a58b6f 100644 --- a/test/unit/resources/aws_flow_log_test.rb +++ b/test/unit/resources/aws_flow_log_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_flow_log' require 'resource_support/aws' require 'resources/aws/aws_flow_log' diff --git a/test/unit/resources/aws_iam_access_key_test.rb b/test/unit/resources/aws_iam_access_key_test.rb index 4e223603a..9e60dbbbd 100644 --- a/test/unit/resources/aws_iam_access_key_test.rb +++ b/test/unit/resources/aws_iam_access_key_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_iam_access_key' require 'resource_support/aws' require 'resources/aws/aws_iam_access_key' diff --git a/test/unit/resources/aws_iam_access_keys_test.rb b/test/unit/resources/aws_iam_access_keys_test.rb index ad550e99e..d11364da7 100644 --- a/test/unit/resources/aws_iam_access_keys_test.rb +++ b/test/unit/resources/aws_iam_access_keys_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_iam_access_keys' require 'resource_support/aws' require 'resources/aws/aws_iam_access_keys' diff --git a/test/unit/resources/aws_iam_group_test.rb b/test/unit/resources/aws_iam_group_test.rb index 40297c3b1..dae9ab747 100644 --- a/test/unit/resources/aws_iam_group_test.rb +++ b/test/unit/resources/aws_iam_group_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_iam_group' require 'resource_support/aws' require 'resources/aws/aws_iam_group' diff --git a/test/unit/resources/aws_iam_groups_test.rb b/test/unit/resources/aws_iam_groups_test.rb index 1d7821bf3..6acd082c0 100644 --- a/test/unit/resources/aws_iam_groups_test.rb +++ b/test/unit/resources/aws_iam_groups_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_iam_groups' require 'resource_support/aws' require 'resources/aws/aws_iam_groups' diff --git a/test/unit/resources/aws_iam_password_policy_test.rb b/test/unit/resources/aws_iam_password_policy_test.rb index 0fe006ba4..c301e7a14 100644 --- a/test/unit/resources/aws_iam_password_policy_test.rb +++ b/test/unit/resources/aws_iam_password_policy_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_iam_password_policy' require 'resource_support/aws' require 'resources/aws/aws_iam_password_policy' diff --git a/test/unit/resources/aws_iam_policies_test.rb b/test/unit/resources/aws_iam_policies_test.rb index c7982947d..3651fb97f 100644 --- a/test/unit/resources/aws_iam_policies_test.rb +++ b/test/unit/resources/aws_iam_policies_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_iam_policies' require 'resource_support/aws' require 'resources/aws/aws_iam_policies' diff --git a/test/unit/resources/aws_iam_policy_test.rb b/test/unit/resources/aws_iam_policy_test.rb index c1039e917..2b7e4aaa3 100644 --- a/test/unit/resources/aws_iam_policy_test.rb +++ b/test/unit/resources/aws_iam_policy_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_iam_policy' require 'resource_support/aws' require 'resources/aws/aws_iam_policy' diff --git a/test/unit/resources/aws_iam_role_test.rb b/test/unit/resources/aws_iam_role_test.rb index 710064afa..975bb67af 100644 --- a/test/unit/resources/aws_iam_role_test.rb +++ b/test/unit/resources/aws_iam_role_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_iam_role' require 'resource_support/aws' require 'resources/aws/aws_iam_role' diff --git a/test/unit/resources/aws_iam_root_user_test.rb b/test/unit/resources/aws_iam_root_user_test.rb index 83d481750..1dba746e5 100644 --- a/test/unit/resources/aws_iam_root_user_test.rb +++ b/test/unit/resources/aws_iam_root_user_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_iam_root_user' require 'resource_support/aws' require 'resources/aws/aws_iam_root_user' diff --git a/test/unit/resources/aws_iam_user_test.rb b/test/unit/resources/aws_iam_user_test.rb index fcaa5c7be..cb6956a7c 100644 --- a/test/unit/resources/aws_iam_user_test.rb +++ b/test/unit/resources/aws_iam_user_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_iam_user' require 'resource_support/aws' require 'resources/aws/aws_iam_user' diff --git a/test/unit/resources/aws_iam_users_test.rb b/test/unit/resources/aws_iam_users_test.rb index 1454a0307..bb9f02206 100644 --- a/test/unit/resources/aws_iam_users_test.rb +++ b/test/unit/resources/aws_iam_users_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_iam_users' require 'resource_support/aws' require 'resources/aws/aws_iam_users' diff --git a/test/unit/resources/aws_kms_key_test.rb b/test/unit/resources/aws_kms_key_test.rb index d671a75dc..ae31dcd49 100644 --- a/test/unit/resources/aws_kms_key_test.rb +++ b/test/unit/resources/aws_kms_key_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_kms_key' require 'resource_support/aws' require 'resources/aws/aws_kms_key' diff --git a/test/unit/resources/aws_kms_keys_test.rb b/test/unit/resources/aws_kms_keys_test.rb index cf9bf8760..33524d183 100644 --- a/test/unit/resources/aws_kms_keys_test.rb +++ b/test/unit/resources/aws_kms_keys_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_kms_keys' require 'resource_support/aws' require 'resources/aws/aws_kms_keys' diff --git a/test/unit/resources/aws_rds_instance_test.rb b/test/unit/resources/aws_rds_instance_test.rb index 2d1b29864..f6788867b 100644 --- a/test/unit/resources/aws_rds_instance_test.rb +++ b/test/unit/resources/aws_rds_instance_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_rds_instance' require 'resource_support/aws' require 'resources/aws/aws_rds_instance' diff --git a/test/unit/resources/aws_route_table_test.rb b/test/unit/resources/aws_route_table_test.rb index 656d28d26..604c5d5b9 100644 --- a/test/unit/resources/aws_route_table_test.rb +++ b/test/unit/resources/aws_route_table_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_route_table' require 'resource_support/aws' require 'resources/aws/aws_route_table' diff --git a/test/unit/resources/aws_route_tables_test.rb b/test/unit/resources/aws_route_tables_test.rb index 366cb5c39..fedfd6c91 100644 --- a/test/unit/resources/aws_route_tables_test.rb +++ b/test/unit/resources/aws_route_tables_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_route_tables' require 'resource_support/aws' require 'resources/aws/aws_route_tables' diff --git a/test/unit/resources/aws_s3_bucket_object_test.rb b/test/unit/resources/aws_s3_bucket_object_test.rb index 6dd79f895..b360058a5 100644 --- a/test/unit/resources/aws_s3_bucket_object_test.rb +++ b/test/unit/resources/aws_s3_bucket_object_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_s3_bucket_object' require 'resource_support/aws' require 'resources/aws/aws_s3_bucket_object' diff --git a/test/unit/resources/aws_s3_bucket_test.rb b/test/unit/resources/aws_s3_bucket_test.rb index 796cba353..d9ad5db39 100644 --- a/test/unit/resources/aws_s3_bucket_test.rb +++ b/test/unit/resources/aws_s3_bucket_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_s3_bucket' require 'resource_support/aws' require 'resources/aws/aws_s3_bucket' diff --git a/test/unit/resources/aws_s3_buckets_test.rb b/test/unit/resources/aws_s3_buckets_test.rb index 49caedf2a..4d93bffc4 100644 --- a/test/unit/resources/aws_s3_buckets_test.rb +++ b/test/unit/resources/aws_s3_buckets_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_s3_buckets' require 'resource_support/aws' require 'resources/aws/aws_s3_buckets' diff --git a/test/unit/resources/aws_security_group_test.rb b/test/unit/resources/aws_security_group_test.rb index 567ebaec7..59fe536d6 100644 --- a/test/unit/resources/aws_security_group_test.rb +++ b/test/unit/resources/aws_security_group_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_security_group' require 'resource_support/aws' require 'resources/aws/aws_security_group' diff --git a/test/unit/resources/aws_security_groups_test.rb b/test/unit/resources/aws_security_groups_test.rb index cbe0b0500..88500c6a8 100644 --- a/test/unit/resources/aws_security_groups_test.rb +++ b/test/unit/resources/aws_security_groups_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_security_groups' require 'resource_support/aws' require 'resources/aws/aws_security_groups' diff --git a/test/unit/resources/aws_sns_subscription_test.rb b/test/unit/resources/aws_sns_subscription_test.rb index 787d22b20..7a1a268d6 100644 --- a/test/unit/resources/aws_sns_subscription_test.rb +++ b/test/unit/resources/aws_sns_subscription_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_sns_subscription' require 'resource_support/aws' require 'resources/aws/aws_sns_subscription' diff --git a/test/unit/resources/aws_sns_topic_test.rb b/test/unit/resources/aws_sns_topic_test.rb index 3da5c898c..c7c4f8d83 100644 --- a/test/unit/resources/aws_sns_topic_test.rb +++ b/test/unit/resources/aws_sns_topic_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_sns_topic' require 'resource_support/aws' require 'resources/aws/aws_sns_topic' diff --git a/test/unit/resources/aws_sns_topics_test.rb b/test/unit/resources/aws_sns_topics_test.rb index 652e6c021..29b5ce1bc 100644 --- a/test/unit/resources/aws_sns_topics_test.rb +++ b/test/unit/resources/aws_sns_topics_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_sns_topics' require 'resource_support/aws' require 'resources/aws/aws_sns_topics' diff --git a/test/unit/resources/aws_sqs_queue_test.rb b/test/unit/resources/aws_sqs_queue_test.rb index 93ec4c0b4..fa44117f5 100644 --- a/test/unit/resources/aws_sqs_queue_test.rb +++ b/test/unit/resources/aws_sqs_queue_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_sqs_queue' require 'resource_support/aws' require 'resources/aws/aws_sqs_queue' diff --git a/test/unit/resources/aws_subnet_test.rb b/test/unit/resources/aws_subnet_test.rb index 2a7d343ad..07158c7af 100644 --- a/test/unit/resources/aws_subnet_test.rb +++ b/test/unit/resources/aws_subnet_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_subnet' require 'resource_support/aws' require 'resources/aws/aws_subnet' diff --git a/test/unit/resources/aws_subnets_test.rb b/test/unit/resources/aws_subnets_test.rb index e653e541c..f1a10f7b1 100644 --- a/test/unit/resources/aws_subnets_test.rb +++ b/test/unit/resources/aws_subnets_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_subnets' require 'resource_support/aws' require 'resources/aws/aws_subnets' diff --git a/test/unit/resources/aws_vpc_test.rb b/test/unit/resources/aws_vpc_test.rb index 5b461b0f0..84f6afcae 100644 --- a/test/unit/resources/aws_vpc_test.rb +++ b/test/unit/resources/aws_vpc_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_vpc' require 'resource_support/aws' require 'resources/aws/aws_vpc' diff --git a/test/unit/resources/aws_vpcs_test.rb b/test/unit/resources/aws_vpcs_test.rb index 342557161..d1f9414e3 100644 --- a/test/unit/resources/aws_vpcs_test.rb +++ b/test/unit/resources/aws_vpcs_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'resources/aws/aws_vpcs' require 'ipaddr' require 'resource_support/aws' diff --git a/test/unit/resources/bash_test.rb b/test/unit/resources/bash_test.rb index 5f766e6e4..ecdcae4a6 100644 --- a/test/unit/resources/bash_test.rb +++ b/test/unit/resources/bash_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/bash' describe "Inspec::Resources::Bash" do let(:x) { rand.to_s } diff --git a/test/unit/resources/bond_test.rb b/test/unit/resources/bond_test.rb index f5e618464..f8f46dbc6 100644 --- a/test/unit/resources/bond_test.rb +++ b/test/unit/resources/bond_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/bond' describe 'Inspec::Resources::Bond' do diff --git a/test/unit/resources/bridge_test.rb b/test/unit/resources/bridge_test.rb index 11875f603..575822cb8 100644 --- a/test/unit/resources/bridge_test.rb +++ b/test/unit/resources/bridge_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/bridge' describe 'Inspec::Resources::Bridge' do diff --git a/test/unit/resources/chocolatey_package_test.rb b/test/unit/resources/chocolatey_package_test.rb index 8d5edb9f5..e69b4bea8 100644 --- a/test/unit/resources/chocolatey_package_test.rb +++ b/test/unit/resources/chocolatey_package_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/chocolatey_package' def skip(*args) # noop diff --git a/test/unit/resources/command_test.rb b/test/unit/resources/command_test.rb index 304a919ee..843c2f12b 100644 --- a/test/unit/resources/command_test.rb +++ b/test/unit/resources/command_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/command' describe Inspec::Resources::Cmd do let(:x) { rand.to_s } diff --git a/test/unit/resources/cpan_test.rb b/test/unit/resources/cpan_test.rb index 3e9f2dfc6..a825a13e3 100644 --- a/test/unit/resources/cpan_test.rb +++ b/test/unit/resources/cpan_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/cpan' describe 'Inspec::Resources::Cpan' do it 'verify cpan package detail parsing' do diff --git a/test/unit/resources/cran_test.rb b/test/unit/resources/cran_test.rb index c712d6c69..26c54e737 100644 --- a/test/unit/resources/cran_test.rb +++ b/test/unit/resources/cran_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/cran' describe 'Inspec::Resources::Cran' do it 'verify cran package detail parsing' do diff --git a/test/unit/resources/crontab_test.rb b/test/unit/resources/crontab_test.rb index 69d2912cb..3684c5254 100644 --- a/test/unit/resources/crontab_test.rb +++ b/test/unit/resources/crontab_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/crontab' describe 'Inspec::Resources::Crontab' do let(:crontab) { load_resource('crontab') } diff --git a/test/unit/resources/csv_test.rb b/test/unit/resources/csv_test.rb index b0478cdf5..cdb77581f 100644 --- a/test/unit/resources/csv_test.rb +++ b/test/unit/resources/csv_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/csv' describe 'Inspec::Resources::CSV' do describe 'when loading a valid csv' do diff --git a/test/unit/resources/dh_params_test.rb b/test/unit/resources/dh_params_test.rb index e3b7f5032..fe52f998d 100644 --- a/test/unit/resources/dh_params_test.rb +++ b/test/unit/resources/dh_params_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/dh_params' describe 'Inspec::Resources::DhParams' do let (:resource_dh_params) { load_resource('dh_params', 'dh_params.dh_pem')} diff --git a/test/unit/resources/docker_container_test.rb b/test/unit/resources/docker_container_test.rb index 24cbfa3c6..7fd146928 100644 --- a/test/unit/resources/docker_container_test.rb +++ b/test/unit/resources/docker_container_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/docker_container' describe 'Inspec::Resources::DockerContainer' do describe 'docker_container' do diff --git a/test/unit/resources/docker_image_test.rb b/test/unit/resources/docker_image_test.rb index 20ba1886f..35c4a597e 100644 --- a/test/unit/resources/docker_image_test.rb +++ b/test/unit/resources/docker_image_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/docker_image' describe 'Inspec::Resources::DockerImage' do describe 'docker_image' do diff --git a/test/unit/resources/docker_plugin_test.rb b/test/unit/resources/docker_plugin_test.rb index abbe35c37..3b526f611 100644 --- a/test/unit/resources/docker_plugin_test.rb +++ b/test/unit/resources/docker_plugin_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/docker_plugin' describe 'Inspec::Resources::DockerContainer' do describe 'docker_plugin' do diff --git a/test/unit/resources/docker_service_test.rb b/test/unit/resources/docker_service_test.rb index a797988c6..3bebe7a32 100644 --- a/test/unit/resources/docker_service_test.rb +++ b/test/unit/resources/docker_service_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/docker_service' describe 'Inspec::Resources::DockerService' do describe 'docker_service' do diff --git a/test/unit/resources/docker_test.rb b/test/unit/resources/docker_test.rb index 65a791dc9..36235a8ca 100644 --- a/test/unit/resources/docker_test.rb +++ b/test/unit/resources/docker_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/docker' describe 'Inspec::Resources::Docker' do describe 'docker' do diff --git a/test/unit/resources/elasticsearch_test.rb b/test/unit/resources/elasticsearch_test.rb index daf91214c..35c276bfb 100644 --- a/test/unit/resources/elasticsearch_test.rb +++ b/test/unit/resources/elasticsearch_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/elasticsearch' describe 'Inspec::Resources::Elasticsearch' do let(:resource) { load_resource('elasticsearch') } diff --git a/test/unit/resources/etc_fstab_test.rb b/test/unit/resources/etc_fstab_test.rb index 578997682..f9735a836 100644 --- a/test/unit/resources/etc_fstab_test.rb +++ b/test/unit/resources/etc_fstab_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/etc_fstab' describe 'Inspec::Resources::Fstab' do let(:resource) { load_resource('etc_fstab') } diff --git a/test/unit/resources/etc_group_test.rb b/test/unit/resources/etc_group_test.rb index ed4ad1f3e..5ca08faf7 100644 --- a/test/unit/resources/etc_group_test.rb +++ b/test/unit/resources/etc_group_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/etc_group' describe 'Inspec::Resources::EtcGroup' do let(:resource) { load_resource('etc_group') } diff --git a/test/unit/resources/etc_hosts_allow_deny_test.rb b/test/unit/resources/etc_hosts_allow_deny_test.rb index 73607cb3c..8da60134a 100644 --- a/test/unit/resources/etc_hosts_allow_deny_test.rb +++ b/test/unit/resources/etc_hosts_allow_deny_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/etc_hosts_allow_deny' describe 'Inspec::Resources::EtcHostsAllow' do describe 'EtcHostsAllow Paramaters' do diff --git a/test/unit/resources/etc_hosts_test.rb b/test/unit/resources/etc_hosts_test.rb index 39942d086..f42a5357d 100644 --- a/test/unit/resources/etc_hosts_test.rb +++ b/test/unit/resources/etc_hosts_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/etc_hosts' describe 'Inspec::Resources::EtcHosts' do let(:resource) { load_resource('etc_hosts') } diff --git a/test/unit/resources/file_test.rb b/test/unit/resources/file_test.rb index 73e874918..d6bb7ac84 100644 --- a/test/unit/resources/file_test.rb +++ b/test/unit/resources/file_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/file' describe Inspec::Resources::FileResource do let(:file) { stub(unix_mode_mask: 000, mode: 000) } diff --git a/test/unit/resources/filesystem_test.rb b/test/unit/resources/filesystem_test.rb index b58f25b8a..643b1e878 100644 --- a/test/unit/resources/filesystem_test.rb +++ b/test/unit/resources/filesystem_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/filesystem' describe 'Inspec::Resources::FileSystemResource' do # arch linux diff --git a/test/unit/resources/firewalld_test.rb b/test/unit/resources/firewalld_test.rb index 144aa1492..38ba5e7d1 100644 --- a/test/unit/resources/firewalld_test.rb +++ b/test/unit/resources/firewalld_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/firewalld' describe 'Inspec::Resources::FirewallD' do centResource = MockLoader.new(:centos7).load_resource('firewalld') diff --git a/test/unit/resources/gem_test.rb b/test/unit/resources/gem_test.rb index e0576bb4f..13603eac8 100644 --- a/test/unit/resources/gem_test.rb +++ b/test/unit/resources/gem_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/gem' describe 'Inspec::Resources::Gem' do it 'verify gem is not installed' do diff --git a/test/unit/resources/group_test.rb b/test/unit/resources/group_test.rb index 0dfdaaff8..cb11bc01f 100644 --- a/test/unit/resources/group_test.rb +++ b/test/unit/resources/group_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/groups' describe 'Inspec::Resources::Group' do diff --git a/test/unit/resources/groups_test.rb b/test/unit/resources/groups_test.rb index 621fe3399..4295d3659 100644 --- a/test/unit/resources/groups_test.rb +++ b/test/unit/resources/groups_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/groups' describe 'groups resource on unix platform' do let(:resource) { MockLoader.new(:ubuntu1404).load_resource('groups') } diff --git a/test/unit/resources/grub_conf_test.rb b/test/unit/resources/grub_conf_test.rb index 4c5f32686..af97feace 100644 --- a/test/unit/resources/grub_conf_test.rb +++ b/test/unit/resources/grub_conf_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/grub_conf' describe 'Inspec::Resources::GrubConfig' do diff --git a/test/unit/resources/host_test.rb b/test/unit/resources/host_test.rb index b78b3e077..0198a156b 100644 --- a/test/unit/resources/host_test.rb +++ b/test/unit/resources/host_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/host' describe 'Inspec::Resources::Host' do diff --git a/test/unit/resources/http_test.rb b/test/unit/resources/http_test.rb index 3a41ad6bb..744fbdd5a 100644 --- a/test/unit/resources/http_test.rb +++ b/test/unit/resources/http_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/http' require "faraday_middleware/response/follow_redirects" describe 'Inspec::Resources::Http' do diff --git a/test/unit/resources/iis_app_pool_test.rb b/test/unit/resources/iis_app_pool_test.rb index 785bd0320..e178c8307 100644 --- a/test/unit/resources/iis_app_pool_test.rb +++ b/test/unit/resources/iis_app_pool_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/iis_app_pool' describe 'Inspec::Resources::IisAppPool' do it 'verify default app pool settings' do diff --git a/test/unit/resources/iis_site_test.rb b/test/unit/resources/iis_site_test.rb index 35b08738a..0ba97672c 100644 --- a/test/unit/resources/iis_site_test.rb +++ b/test/unit/resources/iis_site_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/iis_site' describe 'Inspec::Resources::IisSite' do it 'verify Default Web Site settings' do diff --git a/test/unit/resources/inetd_conf_test.rb b/test/unit/resources/inetd_conf_test.rb index 4942767ef..4827274e3 100644 --- a/test/unit/resources/inetd_conf_test.rb +++ b/test/unit/resources/inetd_conf_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/inetd_conf' describe 'Inspec::Resources::InetdConf' do it 'verify limits.conf config parsing' do diff --git a/test/unit/resources/ini_test.rb b/test/unit/resources/ini_test.rb index 5d7d5c6d2..3964300be 100644 --- a/test/unit/resources/ini_test.rb +++ b/test/unit/resources/ini_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/ini' describe 'Inspec::Resources::Ini' do diff --git a/test/unit/resources/interface_test.rb b/test/unit/resources/interface_test.rb index 607a73856..ae3d1bff5 100644 --- a/test/unit/resources/interface_test.rb +++ b/test/unit/resources/interface_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/interface' describe 'Inspec::Resources::Interface' do diff --git a/test/unit/resources/iptables_test.rb b/test/unit/resources/iptables_test.rb index 16f7cd7a5..a6cbd3e99 100644 --- a/test/unit/resources/iptables_test.rb +++ b/test/unit/resources/iptables_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/iptables' describe 'Inspec::Resources::Iptables' do diff --git a/test/unit/resources/json_test.rb b/test/unit/resources/json_test.rb index 025de52cb..54e986f12 100644 --- a/test/unit/resources/json_test.rb +++ b/test/unit/resources/json_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/json' describe 'Inspec::Resources::JSON' do describe 'when loading a valid json' do diff --git a/test/unit/resources/kernel_module_test.rb b/test/unit/resources/kernel_module_test.rb index 42dd47a9d..f78706a42 100644 --- a/test/unit/resources/kernel_module_test.rb +++ b/test/unit/resources/kernel_module_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/kernel_module' describe 'Inspec::Resources::KernelModule' do diff --git a/test/unit/resources/kernel_parameter_test.rb b/test/unit/resources/kernel_parameter_test.rb index e0615f4b0..5cd5b4e55 100644 --- a/test/unit/resources/kernel_parameter_test.rb +++ b/test/unit/resources/kernel_parameter_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/kernel_parameter' describe 'Inspec::Resources::KernelParameter' do it 'verify kernel_parameter parsing' do diff --git a/test/unit/resources/key_rsa_test.rb b/test/unit/resources/key_rsa_test.rb index 18f3a79ae..7c3341218 100644 --- a/test/unit/resources/key_rsa_test.rb +++ b/test/unit/resources/key_rsa_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/key_rsa' describe 'Inspec::Resources::RsaKey' do let (:resource_key) { load_resource('key_rsa', 'test_certificate.rsa.key.pem')} diff --git a/test/unit/resources/ksh_test.rb b/test/unit/resources/ksh_test.rb index 8450d85e5..89fc881a7 100644 --- a/test/unit/resources/ksh_test.rb +++ b/test/unit/resources/ksh_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/ksh' describe Inspec::Resources::Ksh do let(:x) { rand.to_s } diff --git a/test/unit/resources/limits_conf_test.rb b/test/unit/resources/limits_conf_test.rb index 9b5646806..b3fd7603f 100644 --- a/test/unit/resources/limits_conf_test.rb +++ b/test/unit/resources/limits_conf_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/limits_conf' describe 'Inspec::Resources::LimitsConf' do it 'verify limits.conf config parsing' do diff --git a/test/unit/resources/login_def_test.rb b/test/unit/resources/login_def_test.rb index afba3b54d..d59f70217 100644 --- a/test/unit/resources/login_def_test.rb +++ b/test/unit/resources/login_def_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/login_defs' # TODO: rename file describe 'Inspec::Resources::LoginDef' do it 'verify login.def config parsing' do diff --git a/test/unit/resources/mount_test.rb b/test/unit/resources/mount_test.rb index 10c682f68..3de04c16a 100644 --- a/test/unit/resources/mount_test.rb +++ b/test/unit/resources/mount_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/file' # TODO: rename this test file? +require 'inspec/resources/mount' describe Inspec::Resources::FileResource do let(:root_resource) { load_resource('mount', '/') } diff --git a/test/unit/resources/mssql_session_test.rb b/test/unit/resources/mssql_session_test.rb index bd81d401a..940b24970 100644 --- a/test/unit/resources/mssql_session_test.rb +++ b/test/unit/resources/mssql_session_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/mssql_session' describe 'Inspec::Resources::MssqlSession' do it 'verify default mssql_session configuration' do diff --git a/test/unit/resources/mysql_conf_test.rb b/test/unit/resources/mysql_conf_test.rb index dfbcb1c92..998b6bb71 100644 --- a/test/unit/resources/mysql_conf_test.rb +++ b/test/unit/resources/mysql_conf_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/mysql_conf' describe 'Inspec::Resources::MysqlConf' do it 'verify mysql.conf config parsing' do diff --git a/test/unit/resources/mysql_session_test.rb b/test/unit/resources/mysql_session_test.rb index 7647cb87e..0ddecb1a9 100644 --- a/test/unit/resources/mysql_session_test.rb +++ b/test/unit/resources/mysql_session_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/mysql_session' describe 'Inspec::Resources::MysqlSession' do it 'verify mysql_session escaped login details with single quotes correctly' do diff --git a/test/unit/resources/nginx_conf_test.rb b/test/unit/resources/nginx_conf_test.rb index e00ec90af..a40abf94e 100644 --- a/test/unit/resources/nginx_conf_test.rb +++ b/test/unit/resources/nginx_conf_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/nginx_conf' describe 'Inspec::Resources::NginxConf' do # None of these tests currently work correctly on windows. See the diff --git a/test/unit/resources/nginx_test.rb b/test/unit/resources/nginx_test.rb index 7713cc9cb..703b90b21 100644 --- a/test/unit/resources/nginx_test.rb +++ b/test/unit/resources/nginx_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/nginx' describe 'Inspec::Resources::Nginx' do describe 'NGINX Methods' do diff --git a/test/unit/resources/npm_test.rb b/test/unit/resources/npm_test.rb index 6b87e7072..be8c3d7f6 100644 --- a/test/unit/resources/npm_test.rb +++ b/test/unit/resources/npm_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/npm' describe 'Inspec::Resources::Npm' do it 'verify npm package detail parsing' do diff --git a/test/unit/resources/ntp_conf_test.rb b/test/unit/resources/ntp_conf_test.rb index 76f1c99a9..9ac98bd68 100644 --- a/test/unit/resources/ntp_conf_test.rb +++ b/test/unit/resources/ntp_conf_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/ntp_conf' describe 'Inspec::Resources::NtpConf' do it 'verify ntp config parsing' do diff --git a/test/unit/resources/oneget_test.rb b/test/unit/resources/oneget_test.rb index d53041294..dad344527 100644 --- a/test/unit/resources/oneget_test.rb +++ b/test/unit/resources/oneget_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/oneget' describe 'Inspec::Resources::OneGet' do diff --git a/test/unit/resources/oracledb_session_test.rb b/test/unit/resources/oracledb_session_test.rb index 884549c65..828f6827d 100644 --- a/test/unit/resources/oracledb_session_test.rb +++ b/test/unit/resources/oracledb_session_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/oracledb_session' describe 'Inspec::Resources::OracledbSession' do it 'verify oracledb_session configuration' do diff --git a/test/unit/resources/os_env_test.rb b/test/unit/resources/os_env_test.rb index d19c49224..550c56c9f 100644 --- a/test/unit/resources/os_env_test.rb +++ b/test/unit/resources/os_env_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/os_env' describe 'Inspec::Resources::OsEnv' do it 'verify env parsing' do diff --git a/test/unit/resources/os_test.rb b/test/unit/resources/os_test.rb index 8a476fa88..98435c7f3 100644 --- a/test/unit/resources/os_test.rb +++ b/test/unit/resources/os_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/os' describe 'Inspec::Resources::Os' do it 'verify os parsing on CentOS' do diff --git a/test/unit/resources/package_test.rb b/test/unit/resources/package_test.rb index de02b8538..85aeec3b3 100644 --- a/test/unit/resources/package_test.rb +++ b/test/unit/resources/package_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/package' describe 'Inspec::Resources::Package' do # arch linux diff --git a/test/unit/resources/packages_test.rb b/test/unit/resources/packages_test.rb index 22088e35b..c65879ff8 100644 --- a/test/unit/resources/packages_test.rb +++ b/test/unit/resources/packages_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/packages' describe 'Inspec::Resources::Packages' do it 'verify packages resource' do diff --git a/test/unit/resources/parse_config_test.rb b/test/unit/resources/parse_config_test.rb index 820e906af..a1090332e 100644 --- a/test/unit/resources/parse_config_test.rb +++ b/test/unit/resources/parse_config_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/parse_config' describe 'Inspec::Resources::ParseConfig' do diff --git a/test/unit/resources/passwd_test.rb b/test/unit/resources/passwd_test.rb index 4b5e233ef..574b9fb6d 100644 --- a/test/unit/resources/passwd_test.rb +++ b/test/unit/resources/passwd_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/passwd' describe 'Inspec::Resources::Passwd' do let(:passwd) { load_resource('passwd') } diff --git a/test/unit/resources/pip_test.rb b/test/unit/resources/pip_test.rb index 4b4354136..7ce878430 100644 --- a/test/unit/resources/pip_test.rb +++ b/test/unit/resources/pip_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/pip' describe 'Inspec::Resources::Pip' do it 'verify pip package detail parsing' do diff --git a/test/unit/resources/platform_test.rb b/test/unit/resources/platform_test.rb index df25effe4..f040bbaa0 100644 --- a/test/unit/resources/platform_test.rb +++ b/test/unit/resources/platform_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/platform' describe 'Inspec::Resources::Platform' do let(:resource) { resource = MockLoader.new(:ubuntu1504).load_resource('platform') } diff --git a/test/unit/resources/port_linuxports_test.rb b/test/unit/resources/port_linuxports_test.rb index 19b3ddbc6..25a2e9f25 100644 --- a/test/unit/resources/port_linuxports_test.rb +++ b/test/unit/resources/port_linuxports_test.rb @@ -1,5 +1,7 @@ require 'helper' -require 'utils/parser' +require 'inspec/resource' +require 'inspec/resources/port' +require 'inspec/utils/parser' class TestLinuxPorts < Minitest::Test def setup diff --git a/test/unit/resources/port_test.rb b/test/unit/resources/port_test.rb index f82f27ed8..15f423e16 100644 --- a/test/unit/resources/port_test.rb +++ b/test/unit/resources/port_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/port' describe 'Inspec::Resources::Port' do it 'verify port on Ubuntu 14.04' do diff --git a/test/unit/resources/postgres_conf_test.rb b/test/unit/resources/postgres_conf_test.rb index 315bbbabc..4d9e9b280 100644 --- a/test/unit/resources/postgres_conf_test.rb +++ b/test/unit/resources/postgres_conf_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/postgres_conf' describe 'Inspec::Resources::Postgres' do it 'verify postgresql.conf config parsing of a simple key value' do diff --git a/test/unit/resources/postgres_hba_conf_test.rb b/test/unit/resources/postgres_hba_conf_test.rb index ab2aecaaa..dfde6e106 100644 --- a/test/unit/resources/postgres_hba_conf_test.rb +++ b/test/unit/resources/postgres_hba_conf_test.rb @@ -1,6 +1,8 @@ # copyright: 2017 require 'helper' +require 'inspec/resource' +require 'inspec/resources/postgres_hba_conf' describe 'Inspec::Resources::PGHbaConf' do describe 'PGHbaConf Paramaters' do diff --git a/test/unit/resources/postgres_ident_conf_test.rb b/test/unit/resources/postgres_ident_conf_test.rb index 08e784e63..4deee8bff 100644 --- a/test/unit/resources/postgres_ident_conf_test.rb +++ b/test/unit/resources/postgres_ident_conf_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/postgres_ident_conf' +require 'inspec/resources/directory' describe 'Inspec::Resources::PGIdentConf' do describe 'PGIdentConf Paramaters' do diff --git a/test/unit/resources/postgres_session_test.rb b/test/unit/resources/postgres_session_test.rb index 5a1e999d2..964627a1d 100644 --- a/test/unit/resources/postgres_session_test.rb +++ b/test/unit/resources/postgres_session_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/postgres_session' describe 'Inspec::Resources::PostgresSession' do it 'verify postgres_session create_psql_cmd with a basic query' do diff --git a/test/unit/resources/powershell_test.rb b/test/unit/resources/powershell_test.rb index 2a1a7557e..e2b65bda4 100644 --- a/test/unit/resources/powershell_test.rb +++ b/test/unit/resources/powershell_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/powershell' describe 'Inspec::Resources::Powershell' do let(:base64_command) { diff --git a/test/unit/resources/processes_test.rb b/test/unit/resources/processes_test.rb index dd9b8d5a2..ccbd26783 100644 --- a/test/unit/resources/processes_test.rb +++ b/test/unit/resources/processes_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/processes' describe 'Inspec::Resources::Processes' do it 'handles empty process results' do diff --git a/test/unit/resources/rabbitmq_conf_test.rb b/test/unit/resources/rabbitmq_conf_test.rb index 501bad531..d9f17b511 100644 --- a/test/unit/resources/rabbitmq_conf_test.rb +++ b/test/unit/resources/rabbitmq_conf_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/rabbitmq_config' describe 'Inspec::Resources::RabbitmqConf' do diff --git a/test/unit/resources/registry_key_test.rb b/test/unit/resources/registry_key_test.rb index 740aba142..fcf8e2ad2 100644 --- a/test/unit/resources/registry_key_test.rb +++ b/test/unit/resources/registry_key_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/registry_key' describe 'Inspec::Resources::RegistryKey' do it 'read reg key with human readable name' do diff --git a/test/unit/resources/security_identifier_test.rb b/test/unit/resources/security_identifier_test.rb index 5cad530d4..a1a6712c2 100644 --- a/test/unit/resources/security_identifier_test.rb +++ b/test/unit/resources/security_identifier_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/security_identifier' describe 'Inspec::Resources::SecurityIdentifier' do it 'returns a SID for an existing user' do diff --git a/test/unit/resources/security_policy_test.rb b/test/unit/resources/security_policy_test.rb index cf14489dc..bc81e0052 100644 --- a/test/unit/resources/security_policy_test.rb +++ b/test/unit/resources/security_policy_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/security_policy' describe 'Inspec::Resources::SecurityPolicy' do it 'verify processes resource' do diff --git a/test/unit/resources/service_test.rb b/test/unit/resources/service_test.rb index d720ed448..f28837711 100644 --- a/test/unit/resources/service_test.rb +++ b/test/unit/resources/service_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/service' require 'hashie' describe 'Inspec::Resources::Service' do diff --git a/test/unit/resources/shadow_test.rb b/test/unit/resources/shadow_test.rb index 133758e1d..9b524f0d0 100644 --- a/test/unit/resources/shadow_test.rb +++ b/test/unit/resources/shadow_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/shadow' describe 'Inspec::Resources::Shadow' do let(:shadow) { load_resource('shadow') } diff --git a/test/unit/resources/ssh_conf_test.rb b/test/unit/resources/ssh_conf_test.rb index 110f08d81..52de9d781 100644 --- a/test/unit/resources/ssh_conf_test.rb +++ b/test/unit/resources/ssh_conf_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/ssh_config' describe 'Inspec::Resources::SshConfig' do diff --git a/test/unit/resources/ssl_test.rb b/test/unit/resources/ssl_test.rb index 7c5c73849..490b656e0 100644 --- a/test/unit/resources/ssl_test.rb +++ b/test/unit/resources/ssl_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/ssl' require 'sslshake' describe 'Inspec::Resources::SSL' do diff --git a/test/unit/resources/sys_info_test.rb b/test/unit/resources/sys_info_test.rb index 5dc846784..3d01cfe17 100644 --- a/test/unit/resources/sys_info_test.rb +++ b/test/unit/resources/sys_info_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/sys_info' describe 'Inspec::Resources::SysInfo' do describe 'sys_info' do diff --git a/test/unit/resources/toml_test.rb b/test/unit/resources/toml_test.rb index 382de9c7f..c2f671349 100644 --- a/test/unit/resources/toml_test.rb +++ b/test/unit/resources/toml_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/toml' describe 'Inspec::Resources::TOML' do describe 'when loading valid TOML' do diff --git a/test/unit/resources/vbscript_test.rb b/test/unit/resources/vbscript_test.rb index 2b043a28d..e638ec600 100644 --- a/test/unit/resources/vbscript_test.rb +++ b/test/unit/resources/vbscript_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/vbscript' describe 'Inspec::Resources::VbScript' do diff --git a/test/unit/resources/virtualization_test.rb b/test/unit/resources/virtualization_test.rb index 9d2f53137..1ee9b98f0 100644 --- a/test/unit/resources/virtualization_test.rb +++ b/test/unit/resources/virtualization_test.rb @@ -1,5 +1,8 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/file' +require 'inspec/resources/virtualization' describe 'Inspec::Resources::Virtualization' do def mock_proc(mocked_files) diff --git a/test/unit/resources/windows_feature_test.rb b/test/unit/resources/windows_feature_test.rb index e92fde57b..8622f8bd1 100644 --- a/test/unit/resources/windows_feature_test.rb +++ b/test/unit/resources/windows_feature_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/windows_feature' describe 'Inspec::Resources::WindowsFeature' do it 'can retrieve feature info using PowerShell' do diff --git a/test/unit/resources/windows_hotfix_test.rb b/test/unit/resources/windows_hotfix_test.rb index 35577c737..003e4be8e 100644 --- a/test/unit/resources/windows_hotfix_test.rb +++ b/test/unit/resources/windows_hotfix_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/windows_hotfix' describe 'Inspec::Resources::WindowsHotfix' do diff --git a/test/unit/resources/windows_task_test.rb b/test/unit/resources/windows_task_test.rb index 2ba283800..cc2345659 100644 --- a/test/unit/resources/windows_task_test.rb +++ b/test/unit/resources/windows_task_test.rb @@ -1,4 +1,6 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/windows_task' describe 'Inspec::Resources::WindowsTasks' do it 'verify parsing a windows task that does not exist' do diff --git a/test/unit/resources/wmi_test.rb b/test/unit/resources/wmi_test.rb index 6b5c2c859..926d25e36 100644 --- a/test/unit/resources/wmi_test.rb +++ b/test/unit/resources/wmi_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/wmi' describe 'Inspec::Resources::WMI' do diff --git a/test/unit/resources/x509_certificate_test.rb b/test/unit/resources/x509_certificate_test.rb index 7b82abdeb..053a3f8a8 100644 --- a/test/unit/resources/x509_certificate_test.rb +++ b/test/unit/resources/x509_certificate_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/x509_certificate' describe 'Inspec::Resources::X509Certificate' do let (:resource_cert) { diff --git a/test/unit/resources/xinetd_conf_test.rb b/test/unit/resources/xinetd_conf_test.rb index 908779b95..8295352ae 100644 --- a/test/unit/resources/xinetd_conf_test.rb +++ b/test/unit/resources/xinetd_conf_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/xinetd_conf' describe 'Inspec::Resources::XinetdConf' do let(:resource) { load_resource('xinetd_conf') } diff --git a/test/unit/resources/xml_test.rb b/test/unit/resources/xml_test.rb index 46b4b642b..f469b352c 100644 --- a/test/unit/resources/xml_test.rb +++ b/test/unit/resources/xml_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/xml' require 'rexml/document' describe 'Inspec::Resources::XML' do diff --git a/test/unit/resources/yaml_test.rb b/test/unit/resources/yaml_test.rb index 51dbeca4a..1e6b294eb 100644 --- a/test/unit/resources/yaml_test.rb +++ b/test/unit/resources/yaml_test.rb @@ -2,6 +2,8 @@ require 'helper' require 'inspec/resource' require 'inspec/resources/yaml' +require 'inspec/resource' +require 'inspec/resources/yaml' describe 'Inspec::Resources::YAML' do describe 'when loading a valid yaml' do diff --git a/test/unit/resources/yum_test.rb b/test/unit/resources/yum_test.rb index 350dbc2a9..7bcf54a00 100644 --- a/test/unit/resources/yum_test.rb +++ b/test/unit/resources/yum_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/yum' describe 'Inspec::Resources::YumRepo' do it 'get repository details' do diff --git a/test/unit/resources/zfs_dataset_test.rb b/test/unit/resources/zfs_dataset_test.rb index 0868b4d4d..dc8292156 100644 --- a/test/unit/resources/zfs_dataset_test.rb +++ b/test/unit/resources/zfs_dataset_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/zfs_dataset' describe Inspec::Resources::ZfsDataset do let(:loader) { MockLoader.new(:freebsd10) } diff --git a/test/unit/resources/zfs_pool_test.rb b/test/unit/resources/zfs_pool_test.rb index e438b92ab..233012ee1 100644 --- a/test/unit/resources/zfs_pool_test.rb +++ b/test/unit/resources/zfs_pool_test.rb @@ -1,5 +1,7 @@ require 'helper' +require 'inspec/resource' +require 'inspec/resources/zfs_pool' describe Inspec::Resources::ZfsPool do let(:loader) { MockLoader.new(:freebsd10) } From a8bcba780f6abf5976d3d827af1170a1bb5e2bd4 Mon Sep 17 00:00:00 2001 From: Ryan Davis Date: Sat, 25 May 2019 03:22:11 -0700 Subject: [PATCH 08/11] Got the rest of the functionals to pass. Signed-off-by: Ryan Davis --- lib/inspec/runner.rb | 1 + test/functional/inspec_report_test.rb | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/inspec/runner.rb b/lib/inspec/runner.rb index 15487f8f4..5c06c9293 100644 --- a/lib/inspec/runner.rb +++ b/lib/inspec/runner.rb @@ -9,6 +9,7 @@ require 'inspec/metadata' require 'inspec/config' require 'inspec/dependencies/cache' require 'inspec/dist' +require 'inspec/reporters' require 'inspec/runner_rspec' # spec requirements diff --git a/test/functional/inspec_report_test.rb b/test/functional/inspec_report_test.rb index 8471a5a2d..6a395a963 100644 --- a/test/functional/inspec_report_test.rb +++ b/test/functional/inspec_report_test.rb @@ -1,5 +1,6 @@ - require 'functional/helper' +require 'inspec/runner' +require 'inspec/resources/file' describe 'inspec report tests' do include FunctionalHelper From ec248217a7206fdf8160fb0e8dd90cbee63fa5ce Mon Sep 17 00:00:00 2001 From: Ryan Davis Date: Wed, 29 May 2019 02:24:44 -0700 Subject: [PATCH 09/11] Extra fix for utils move Signed-off-by: Ryan Davis --- test/integration/find_files/libraries/find_files.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/find_files/libraries/find_files.rb b/test/integration/find_files/libraries/find_files.rb index 6b6761cfe..9ccb0b44f 100644 --- a/test/integration/find_files/libraries/find_files.rb +++ b/test/integration/find_files/libraries/find_files.rb @@ -12,7 +12,7 @@ class TestFindFiles < Inspec.resource(1) end " - require 'utils/find_files' + require 'inspec/utils/find_files' include FindFiles attr_reader :results From be125598c8a4c24b13ddea4007fdcfef2a1defad Mon Sep 17 00:00:00 2001 From: Ryan Davis Date: Wed, 29 May 2019 02:25:12 -0700 Subject: [PATCH 10/11] Additional whitespace cleanup. Signed-off-by: Ryan Davis --- lib/plugins/inspec-compliance/lib/inspec-compliance/api.rb | 1 - lib/plugins/inspec-compliance/lib/inspec-compliance/cli.rb | 1 - test/unit/utils/bsd_mount_parser_test.rb | 1 - test/unit/utils/filter_array_test.rb | 1 - test/unit/utils/find_files_test.rb | 1 - test/unit/utils/object_traversal_test.rb | 1 - test/unit/utils/passwd_parser_test.rb | 1 - test/unit/utils/simpleconfig_test.rb | 1 - test/unit/utils/solaris_netstat_parser_test.rb | 1 - 9 files changed, 9 deletions(-) diff --git a/lib/plugins/inspec-compliance/lib/inspec-compliance/api.rb b/lib/plugins/inspec-compliance/lib/inspec-compliance/api.rb index bc30b7e46..7cb3ed470 100644 --- a/lib/plugins/inspec-compliance/lib/inspec-compliance/api.rb +++ b/lib/plugins/inspec-compliance/lib/inspec-compliance/api.rb @@ -1,4 +1,3 @@ - require 'net/http' require 'uri' require 'json' diff --git a/lib/plugins/inspec-compliance/lib/inspec-compliance/cli.rb b/lib/plugins/inspec-compliance/lib/inspec-compliance/cli.rb index cbe849471..41a79d601 100644 --- a/lib/plugins/inspec-compliance/lib/inspec-compliance/cli.rb +++ b/lib/plugins/inspec-compliance/lib/inspec-compliance/cli.rb @@ -1,4 +1,3 @@ - require 'inspec/dist' require_relative 'api' diff --git a/test/unit/utils/bsd_mount_parser_test.rb b/test/unit/utils/bsd_mount_parser_test.rb index ad63d8bbc..c0d780024 100644 --- a/test/unit/utils/bsd_mount_parser_test.rb +++ b/test/unit/utils/bsd_mount_parser_test.rb @@ -1,4 +1,3 @@ - require 'helper' require 'inspec/utils/parser' diff --git a/test/unit/utils/filter_array_test.rb b/test/unit/utils/filter_array_test.rb index 155143854..a4136b2c2 100644 --- a/test/unit/utils/filter_array_test.rb +++ b/test/unit/utils/filter_array_test.rb @@ -1,4 +1,3 @@ - require 'helper' require 'inspec/utils/filter_array' diff --git a/test/unit/utils/find_files_test.rb b/test/unit/utils/find_files_test.rb index a08120489..cb731f98d 100644 --- a/test/unit/utils/find_files_test.rb +++ b/test/unit/utils/find_files_test.rb @@ -1,4 +1,3 @@ - require 'helper' require 'inspec/utils/find_files' require 'inspec/resources/command' diff --git a/test/unit/utils/object_traversal_test.rb b/test/unit/utils/object_traversal_test.rb index 657b3da08..6f4992ed5 100644 --- a/test/unit/utils/object_traversal_test.rb +++ b/test/unit/utils/object_traversal_test.rb @@ -1,4 +1,3 @@ - require 'helper' require 'inspec/utils/object_traversal' diff --git a/test/unit/utils/passwd_parser_test.rb b/test/unit/utils/passwd_parser_test.rb index 345cb0c78..49723d9a4 100644 --- a/test/unit/utils/passwd_parser_test.rb +++ b/test/unit/utils/passwd_parser_test.rb @@ -1,4 +1,3 @@ - require 'helper' require 'inspec/utils/parser' diff --git a/test/unit/utils/simpleconfig_test.rb b/test/unit/utils/simpleconfig_test.rb index aa516e29f..689e0b01e 100644 --- a/test/unit/utils/simpleconfig_test.rb +++ b/test/unit/utils/simpleconfig_test.rb @@ -1,4 +1,3 @@ - require 'helper' require 'inspec/utils/simpleconfig' diff --git a/test/unit/utils/solaris_netstat_parser_test.rb b/test/unit/utils/solaris_netstat_parser_test.rb index c4d5cb6fb..64566eecd 100644 --- a/test/unit/utils/solaris_netstat_parser_test.rb +++ b/test/unit/utils/solaris_netstat_parser_test.rb @@ -1,4 +1,3 @@ - require 'helper' require 'inspec/utils/parser' From dfadc393b926c2d5b03e3d78c06183734e584467 Mon Sep 17 00:00:00 2001 From: Ryan Davis Date: Wed, 29 May 2019 02:42:26 -0700 Subject: [PATCH 11/11] Even more removals and moves! Turns out we don't even use CMD in any units... so why make it? Lots of other stuff got ripped out. Tests basically shouldn't need to require anything but 1 implementation file and a test framework. Anything more than that is a smell. Signed-off-by: Ryan Davis --- test/functional/helper.rb | 9 +++------ test/helper.rb | 13 +------------ 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/test/functional/helper.rb b/test/functional/helper.rb index e4872e877..63ecdbcf1 100644 --- a/test/functional/helper.rb +++ b/test/functional/helper.rb @@ -1,16 +1,13 @@ - require 'helper' -require 'rbconfig' -require 'json' -require 'fileutils' -require 'yaml' -require 'tmpdir' +require 'train' require 'minitest/hell' class Minitest::Test parallelize_me! end +CMD = Train.create('local', command_runner: :generic).connection + class Module include Minitest::Spec::DSL end diff --git a/test/helper.rb b/test/helper.rb index 479e054eb..bfe603510 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -75,25 +75,14 @@ end require 'webmock/minitest' require 'mocha/setup' -require 'fileutils' -require 'pathname' -require 'tempfile' -require 'tmpdir' -require 'zip' -require 'json' - -require 'inspec/version' require 'inspec/log' require 'inspec/backend' -require 'train' +require "helpers/mock_loader" -CMD = Train.create('local', command_runner: :generic).connection TMP_CACHE = {} Inspec::Log.logger = Logger.new(nil) -require "helpers/mock_loader" - def load_resource(*args) m = MockLoader.new(:ubuntu1404) m.send('load_resource', *args)