mirror of
https://github.com/inspec/inspec
synced 2024-11-27 15:10:44 +00:00
2bbcdbde9b
* Remove deprecated yumrepo. (#3435) * Remove deprecations for cli `--format` and metadata.rb (#3452) * Remove deprecated database_helpers stderr/stdout methods. Update deprecation text for processes/apache. * Remove deprecations for `--format` and metadata.rb Remove deprecated `format` code. Remove deprecated code test and change json-config format test to use reporter. Remove deprecated metadata.rb code Remove deprecation notice for old supports syntax. Deprecate metadata.rb from source_reader Remove rubocop disables as they are no longer required for this code block. Remove deprecated legacy metadata.rb mock profiles. Remove deprecated metadata.rb profile tests. Remove deprecated yumrepo test. * Allow inspec-3.0 branch to be tested. * Allow appveyor to test inspec-3.0 branch * Change runner tests to use reporter rather than format. Remove deprecated `supports: linux` tests. * Remove skip from inherited profiles from showing up in reporting (breaking change) (#3332) * Skip loading dependency profiles if they are unsupported on the current platform. Skip loading dependencies if they are unsupported on the current platform. Wrap our log and next in a conditional checking if the platform is supported. Change a `if !` into a `unless` Check if the backend is a Train Mock Connection and if so say that the profile does support the platform. While iterating through tests being loaded skip when the platform is unsupported. We now log a WARN when a profile is skipped due to unsupported platform, so lets check that. Modified existing test to log that there are 0 skipped tests, instead of 2. Add functional test that loads profile-support-skip with a json reporter to check that our controls are not loaded and that stderr contains our warning. * Rather than iterating through each test return before recursion if the platform is unsupported. * Resolve tests using a supported platform different from testing platform Add a control to `test/unit/mock/profiles/complete-profile` that would work on any OS with a Internet connection. This allows the profile to execute on any OS with success. `filesystem_spec.rb` was a control that would only work on Linux and some BSD's. We want profile tests to consistently work across development and testing platforms, and not get 'skipped' in some cases. Travis-CI tests on Linux, Inspec Dev team uses Linux and MacOS, Appveyor tests on Windows Also Updated `file_provider_test.rb` for `complete-profile` content changes. If you `MockLoader.load_profile` on a unsupported platform you might not hit the usual skip. Lets handle situations where the tests array in Profile#load_checks_params could be nil. * Use safe navigation rather than checking if tests is nil. Update tests to point to unsupported_inspec and account for WARN changes. Make unsupported_inspec profile support os-family 'unsupported_inspec' * Fix skip bug when using include/require controls. (#3487) * Fix skip bug when using include/require controls. * fix test and feedback. * Remove need for UUID detection for Automate report (#3507) * Add json metadata for skipped profiles (#3495) * Add skip metadata to json reports * Unify skip messages. * Update with status field. * Add testing. * Fix tests. * lint * Add skip exit codes for profile skips. * Update website for 3.0 launch Add `plugins` to sidebar. Change 2.0 -> 3.0 in slim files. Update 3.0 features list. * Fix comments * Update float to numeric. * Change Float to numeric. * updated feature list and impact doc * Change "What's new in InSpec 3.0" -> "Announcing InSpec 3.0" * Bump VERSION to 3.0.0 (#3511) * Remove 3.0 testing checks. * Fix azure link.
78 lines
3.2 KiB
Ruby
78 lines
3.2 KiB
Ruby
# encoding: utf-8
|
|
# author: Christoph Hartmann
|
|
# author: Dominik Richter
|
|
|
|
require 'helper'
|
|
require 'inspec/resource'
|
|
|
|
describe 'Inspec::Resources::YumRepo' do
|
|
it 'get repository details' do
|
|
resource = MockLoader.new(:centos7).load_resource('yum')
|
|
_(resource.repositories).must_equal [{
|
|
'id'=>'base/7/x86_64',
|
|
'name'=>'CentOS-7 - Base',
|
|
'status'=>'enabled',
|
|
'revision'=>'1427842153',
|
|
'updated'=>'Tue Mar 31 22:50:46 2015',
|
|
'pkgs'=>'8652',
|
|
'size'=>'6.3 G',
|
|
'mirrors'=>'http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock',
|
|
'baseurl'=>'http://ftp.hosteurope.de/mirror/centos.org/7.1.1503/os/x86_64/ (9 more)',
|
|
'expire'=>'21600 second(s) (last: Sun Sep 6 10:20:46 2015)',
|
|
'filename'=>'/etc/yum.repos.d/CentOS-Base.repo',
|
|
}, {
|
|
'id'=>'base-debuginfo/x86_64',
|
|
'name'=>'CentOS-7 - Debuginfo',
|
|
'status'=>'disabled',
|
|
'baseurl'=>'http://debuginfo.centos.org/7/x86_64/',
|
|
'expire'=>'21600 second(s) (last: Unknown)',
|
|
'filename'=>'/etc/yum.repos.d/CentOS-Debuginfo.repo',
|
|
}, {
|
|
'id'=>'extras/7/x86_64',
|
|
'name'=>'CentOS-7 - Extras',
|
|
'status'=>'enabled',
|
|
'revision'=>'1441314199',
|
|
'updated'=>'Thu Sep 3 21:03:33 2015',
|
|
'pkgs'=>'181',
|
|
'size'=>'742 M',
|
|
'mirrors'=>'http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=stock',
|
|
'baseurl'=>'http://mirror.informatik.hs-fulda.de/centos7.1.1503/extras/x86_64/ (9 more)',
|
|
'expire'=>'21600 second(s) (last: Sun Sep 6 10:20:48 2015)',
|
|
'filename'=>'/etc/yum.repos.d/CentOS-Base.repo',
|
|
}]
|
|
_(resource.repos.length).must_equal 3
|
|
# get repository details
|
|
_(resource.repos).must_equal %w{base/7/x86_64 base-debuginfo/x86_64 extras/7/x86_64}
|
|
# test its syntax repo
|
|
_(resource.extras.exist?).must_equal true
|
|
_(resource.extras.enabled?).must_equal true
|
|
# test enabled extra repo
|
|
extras = resource.repo('extras/7/x86_64')
|
|
_(extras.exist?).must_equal true
|
|
_(extras.enabled?).must_equal true
|
|
_(extras.baseurl).must_include 'informatik'
|
|
# test enabled extra repo with short name
|
|
extras = resource.repo('extras')
|
|
_(extras.exist?).must_equal true
|
|
_(extras.enabled?).must_equal true
|
|
_(extras.baseurl).must_include 'informatik'
|
|
# test disabled extra-source repo
|
|
extras = resource.repo('base-debuginfo/x86_64')
|
|
_(extras.exist?).must_equal true
|
|
_(extras.enabled?).must_equal false
|
|
_(extras.to_s).must_equal 'YumRepo base-debuginfo/x86_64'
|
|
end
|
|
|
|
it 'provides methods for retrieving per-repo information' do
|
|
resource = MockLoader.new(:centos7).load_resource('yum')
|
|
repo = resource.repo('base/7/x86_64')
|
|
_(repo.baseurl).must_equal 'http://ftp.hosteurope.de/mirror/centos.org/7.1.1503/os/x86_64/ (9 more)'
|
|
_(repo.expire).must_equal '21600 second(s) (last: Sun Sep 6 10:20:46 2015)'
|
|
_(repo.filename).must_equal '/etc/yum.repos.d/CentOS-Base.repo'
|
|
_(repo.mirrors).must_equal 'http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock'
|
|
_(repo.pkgs).must_equal '8652'
|
|
_(repo.size).must_equal '6.3 G'
|
|
_(repo.status).must_equal 'enabled'
|
|
_(repo.updated).must_equal 'Tue Mar 31 22:50:46 2015'
|
|
end
|
|
end
|