Commit graph

22 commits

Author SHA1 Message Date
Ryan Davis
a5309ea392 blindly applied chefstyle -a
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-06-11 18:52:03 -07:00
Ryan Davis
9b7c292d4c Use IO globals instead of IO constants.
Helps testing and lots of other things if we only use $stdout/$stderr.

STDOUT/STDERR should only be used to restore the globals.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-18 12:48:18 -07:00
Ryan Davis
40d74cb5be Turn off logging after the configure_logger tests.
Please do not increase the amount of noise our tests have from here on out.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-18 12:48:18 -07:00
Miah Johnson
659b4b373a Remove # encoding: utf8 magic comments
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-07 16:06:23 -07:00
Clinton Wolfe
b057b0dc01 Correct formatting test
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-01 14:24:26 -05:00
Clinton Wolfe
2f16146bce Fix a unit test
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-01 14:24:26 -05:00
Clinton Wolfe
f1f5b27237 Create config object and units tests
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-01 14:23:55 -05:00
Jared Quick
2bbcdbde9b
Inspec 3.0 (#3512)
* 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.
2018-10-15 18:25:27 -04:00
Jared Quick
cb12ada2fe
Move compliance to v2 plugin (#3423)
* Move compliance pluging to v2 system.
* Update kitchen-inspec to test.
* Add legacy require patsh.
* Fix unit test

Signed-off-by: Jared Quick <jquick@chef.io>
2018-10-04 14:31:39 -04:00
Jared Quick
76b453eee9
Allow target-id passthrough (#3320)
* Allow uuid passthrough
* Update flag to be target-id.
* Updated to use proper formatting for header.
* Fix empty line after cli banner.

Signed-off-by: Jared Quick <jquick@chef.io>
2018-09-05 15:07:34 -04:00
Jerry Aldrich
7098631d3e Infer --sudo when --sudo-password is used (#3313)
This does the following:
  - Adds `--sudo` if using `--sudo-password`
  - Warns the user if using `--sudo-password` without `--sudo`
  - Adds unit tests for `Inspec::BaseCLI#opts`

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2018-08-23 13:47:26 -04:00
Jared Quick
9f3e1c33a8
Suppress logs for json-automate reporter (#3324)
Signed-off-by: Jared Quick <jquick@chef.io>
2018-08-23 13:43:48 -04:00
Jared Quick
b246cf7d21
Add automate reporter (#2902)
* Add automate reporter.
* Add ssl flag for automate post.
* Rename ssl flag.

Signed-off-by: Jared Quick <jquick@chef.io>
2018-04-05 08:51:51 -04:00
Jared Quick
378e7c5048
Update shell detect to work with platforms (#2712)
* Update shell to use the same detect logic as cli detect.

Signed-off-by: Jared Quick <jquick@chef.io>
2018-02-20 07:37:23 -05:00
Franklin Webber
b9efb1d999 Fixes the deprecation warning text for report and output. (#2694)
* Fixes the deprecation warning text for report and output.

Remove an extra 'is being' from the 'is being is being'

Signed-off-by: Franklin Webber <franklin@chef.io>
2018-02-19 11:52:56 -05:00
Jared Quick
97dd0546c0 Fix legacy reporter output to file (#2667)
* Fix legacy reporter output.

Signed-off-by: Jared Quick <jquick@chef.io>

* Wrap test in a proc to catch warnings.

Signed-off-by: Jared Quick <jquick@chef.io>

* Add output deprecation.

Signed-off-by: Jared Quick <jquick@chef.io>
2018-02-18 12:17:00 +01:00
Jared Quick
b5b0713fe2 Fix json-config format not overriding reporter.
Signed-off-by: Jared Quick <jquick@chef.io>
2018-02-09 11:51:49 -05:00
Jared Quick
fc99ec553d Add log format tests.
Signed-off-by: Jared Quick <jquick@chef.io>
2018-02-09 11:19:52 -05:00
Jared Quick
145604549b This fixes the audit issue expecting a report hash output.
Signed-off-by: Jared Quick <jquick@chef.io>
2018-02-09 10:59:39 -05:00
Jared Quick
9930e40a76 Add new "reporter" system (replacement for "formatters"), support multiple reporters per run (#2464)
* Formatter and reporter refactor.

Signed-off-by: Jared Quick <jquick@chef.io>

* Add exception and backtrace to json-min report.

Signed-off-by: Jared Quick <jquick@chef.io>

* Add sha to json-min and include generator version for json profile.

Signed-off-by: Jared Quick <jquick@chef.io>

* Fix deprecated typo and add fallback for cli resource title.

Signed-off-by: Jared Quick <jquick@chef.io>

* Update to build json report and clean up cli logic.

Signed-off-by: Jared Quick <jquick@chef.io>

* Add tests for json reporter.

Signed-off-by: Jared Quick <jquick@chef.io>

* Add cli suppress_log_output? and a fallback for invalid reporter type.

Signed-off-by: Jared Quick <jquick@chef.io>

* Update suppress_log_output? to check if we are outputting to stdout.

Signed-off-by: Jared Quick <jquick@chef.io>

* Update reporter cli optoins to work with json_config.

Signed-off-by: Jared Quick <jquick@chef.io>

* Refactor some safe-navigation and variable names.

Signed-off-by: Jared Quick <jquick@chef.io>

* Add thor banner to show reporter file output syntax.

Signed-off-by: Jared Quick <jquick@chef.io>
2018-02-08 10:06:58 +01:00
Jared Quick
72af4a96f1 Update default cli options to be per command. (#2378)
Signed-off-by: Jared Quick <jquick@chef.io>
2017-12-07 13:19:36 +01:00
Jared Quick
4c592f49c1 Resolve merge issue with json-config vs thor defaults (#2377)
* Add debug for caching and fix cli merge bug.

Signed-off-by: Jared Quick <jquick@chef.io>

* Update options merge to take cli options over json.

Signed-off-by: Jared Quick <jquick@chef.io>
2017-12-06 22:22:11 +01:00