Commit graph

2152 commits

Author SHA1 Message Date
Nick Schwaderer
acf2b2bbab Reverts without bug
Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
2020-11-23 15:49:52 +00:00
Nick Schwaderer
0860e631a7 Revert "Supply resource name, params to code_desc"
This reverts commit 345a832eb1.

Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
2020-11-23 15:46:19 +00:00
pacopal
28be72d967 Update oracledb_session.rb
Update format_options for sqlplus to support all versions.
Reference: Issue 5182

Signed-off-by: Francisco Palomares <fpalomares@hotmail.com>

Fixed Test Unit to compare with new values
2020-11-23 14:43:19 +01:00
Nick Schwaderer
345a832eb1 Supply resource name, params to code_desc
Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
2020-11-19 09:59:53 +00:00
superyarick
c653ce343a added platform-name wildcard support
added unit test for platform-name wildcard
added doc for release wildcard
added doc for platform-name wildcard

Signed-off-by: superyarick <yarick@yarick.net>
2020-11-08 15:24:43 -05:00
Nick Schwaderer
1f0bcd988f
Merge pull request #5278 from inspec/ns/waiver_message
Ensure that we populate information about waiver expiration regardless of `run: true/false`
2020-10-19 10:41:05 +01:00
Nick Schwaderer
4c4bfe0426 Update tests to handle waiver expiration message
Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
2020-10-14 12:55:39 +01:00
James Stocks
db5f6a1615 Tidy --help output slightly
Give `exec` a short description in the main help output. Hide the option to disable core plugins.

Signed-off-by: James Stocks <jstocks@chef.io>
2020-09-25 13:02:16 +01:00
James Stocks
7576ad8ff5 Add Chef patent URL to --help
Fixes #5248

Signed-off-by: James Stocks <jstocks@chef.io>
2020-09-25 13:02:16 +01:00
Clinton Wolfe
6e7e05e6b6 Adjust expected error count
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-09-22 11:40:01 +01:00
Clinton Wolfe
4e1c209d17 Make sure we test the legacy reporter in the unit test for junit
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-09-22 11:40:01 +01:00
Clinton Wolfe
b3f72f5854 Implement a corrected junit2 reporter that can be validated
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-09-22 11:40:01 +01:00
Clinton Wolfe
c602e53910 Update test to remove some skips due to outdated fixture
The tests depended on an old fixture profile that skipped a test,
which no longer happens. It also was targeting a test that does not exist.

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-09-22 11:40:01 +01:00
Clinton Wolfe
955ab36922 Update junit tests to use nokogiri
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-09-22 11:40:01 +01:00
IanMadd
c1da4f64c4 Updating links to inspec docs in ruby scripts
Signed-off-by: IanMadd <imaddaus@chef.io>
2020-09-14 14:09:30 -07:00
IanMadd
6a592a6db2 Update various readmes and docs
Signed-off-by: IanMadd <imaddaus@chef.io>
2020-09-14 14:09:23 -07:00
Nick Schwaderer
668197f726
Merge pull request #5213 from inspec/ns/windows
skip_windows! documentation and clearing
2020-09-14 16:53:15 +01:00
Nick Schwaderer
94224e0695
Merge pull request #5210 from Udyrfrykte/master
Improve handling of bracketed options in deb source
2020-09-14 15:56:25 +01:00
Nick Schwaderer
1a1205c729 Fixes many of the old skip_windows instances
Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
2020-09-14 15:55:10 +01:00
Raphael Geissert
b2e62b5b2f Run ps with an ulimited width on linux
On some systems the output of ps may be truncated, which may prevent
profiles from working as intended.

Some implementations specifically mention that the output width is
undefined "(it may be 80, unlimited, determined by the TERM variable,
and so on)".

This fixes #5226.

Signed-off-by: Raphael Geissert <atomo64@gmail.com>
2020-09-02 08:34:11 +02:00
Nick Schwaderer
1d71ce141a
Merge pull request #5185 from StylusEaterChef/amd/issue-5183
First pass at fixing issue #5183.
2020-08-27 12:43:18 +01:00
Nick Schwaderer
6a60b456ba
Merge pull request #5054 from inspec/cw/run-data-filters
RunData Filters; sensitive inputs; suppress diff; sorted output
2020-08-27 11:15:57 +01:00
Udyrfrykte
fe74f4fd5b Improve apt.rb's read_debs
Make it better at handling whitespace in bracketed options

Signed-off-by: Benoît Gastinne <Udyrfrykte@users.noreply.github.com>
2020-08-17 11:38:40 +02:00
Tim Smith
303f530850 Update to Chefstyle 1.2.1
Update a few cop names
Remove redundant returns

Signed-off-by: Tim Smith <tsmith@chef.io>
2020-08-12 13:12:26 -07:00
Adam M Dutko
04c3aef004 Fix Issue #5183.
Signed-off-by: Adam M Dutko <adutko@chef.io>
2020-08-11 10:34:13 -04:00
Clinton Wolfe
a839d4602c Add ability to sort results in reporting phase
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-08-10 14:32:08 -04:00
Clinton Wolfe
3aca12d622 Add option to suppress diff output
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-08-10 14:31:28 -04:00
Clinton Wolfe
ceca77e118 Mark inputs as sensitive
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-08-10 14:30:11 -04:00
Nick Schwaderer
cc521b5400
Merge pull request #5084 from inspec/cw/reporter-plugin-junit
Convert JUnit Reporter to a Plugin
2020-08-07 18:06:43 +01:00
Nick Schwaderer
71e141e10a Move windows bomb forward pre-emptively
These tests are being worked on, and there has been internal discussion
about the value of this bomb. I am not taking a stance on that at this
point. However, when we do hit a bomb that requires all repo PRs (
including community ) to do a rebase after we do a fixing PR.

To prevent this while our team resource is somewhat limited I am going
to pre-emptively push this out.

Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
2020-08-03 10:57:29 +01:00
Nick Schwaderer
986dd1aafb
Merge pull request #5165 from inspec/ns/messages_should_only_be_noted_as_trunncated_if_they_were_actually_truncated
Ensure truncate message only returns on truncated values
2020-07-29 11:55:39 +01:00
Nick Schwaderer
3129af9db9
Merge pull request #5123 from Perceptyx/fix-freebsd-osfamily-user-group-tests
Fix freebsd osfamily user group tests
2020-07-29 10:12:13 +01:00
Nick Schwaderer
d8b06560a1 Ensure truncate message only returns on truncated values
At the moment we return the "Truncate" text whenever the setting is
utilized. This PR ensures that we only advise truncation when it's been
executed.

Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
2020-07-29 09:50:25 +01:00
Felipe Zipitria
dd8960dbf6
feat(sensitive): add sensitive output to mysql and postgres sessions
Signed-off-by: Felipe Zipitria <fzipitria@perceptyx.com>
2020-07-22 14:20:17 -03:00
Felipe Zipitria
d2ae7a7fbf
fix(osfamily): use corresponding family or name for bsd/freebsd
Signed-off-by: Felipe Zipitria <fzipitria@perceptyx.com>
2020-07-22 08:43:25 -03:00
Nick Schwaderer
2744ff43e5
Merge pull request #5128 from james-stocks/js/report_bad_profiles
Report faulty profiles instead of crashing
2020-07-15 13:28:17 +01:00
Nick Schwaderer
934aa8d49a
Merge pull request #5138 from jrbeilke/bug-apt-cdrom
skip apt-cdrom repos in apt resource when parsing lists
2020-07-14 11:49:21 +01:00
James Stocks
833aac3ef1 Add profile load failure message to CLI reporter
Signed-off-by: James Stocks <jstocks@chef.io>
2020-07-09 14:02:42 +01:00
Nick Schwaderer
6d340b323c Allow ‘=‘ character in CLI inputs
Fixes #5131

Due to the use of `#split(‘=‘)` against inputs supplied via the CLI we had an edge case where inputs with `’=‘` in the value would cause a breakage.

This PR supplies a test for the regression and fixes the bug with a regex solution.

Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
2020-07-09 12:50:21 +01:00
Jon Beilke
bedef776a6 skip apt-cdrom repos in apt resource when parsing lists
Signed-off-by: Jon Beilke <Jonathan.Beilke@windlogics.com>
2020-07-08 14:19:09 -05:00
James Stocks
08398cc3c1 Address linting mistakes.
Signed-off-by: James Stocks <jstocks@chef.io>
2020-07-03 15:53:09 +01:00
James Stocks
fd4c501c70 Change profile skip_message to status_message
Keep a duplicate of the message in skip_message for the JSON reporters, for backwards compaibility.

Signed-off-by: James Stocks <jstocks@chef.io>
2020-07-03 15:53:09 +01:00
Bryan McLellan
dada8ea074 Add the generic 'darwin' to the service resource
macOS 11 Big Sur will be released later this year. Current beta versions
return 10.16 as the version, but the product name has changed from 'Mac
OS X' to 'macOS'. Train probably needs to be modified to deprecate
'mac_os_x' as a platform in favor of 'macos' but that would be a
significant downstream change. Train does fall back to 'darwin' on macOS
10.16, so by adding darwin to the list of platform names for the service
resource we are able to work around this for the moment.

This is the only location where mac_os_x is currently being used in
InSpec. Because we're in a case statement on platform rather than the
more generic platform family, we can't simply remove mac_os_x in favor
of darwin.

Signed-off-by: Bryan McLellan <btm@loftninjas.org>
2020-07-02 09:36:27 -04:00
James Stocks
41087c5ec6 Set profiles that fail to load as failed
Signed-off-by: James Stocks <jstocks@chef.io>
2020-07-02 13:33:07 +01:00
Nick Schwaderer
480567564b Review skip_windows violations and expiration
We have 72 `skip_windows` that need addressing. This PR removes
confirmed instances where the tests now work on windows. It also marks
tests with a comment where they are confirmed to still break. Unmarked
instances still need review.

It also updates the `skip_windows` expiration date.

72 `skip_windows` needing resolution OR alternative documentation upon investigation

Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
2020-07-02 11:53:38 +01:00
James Stocks
af5fd7bd03
Merge pull request #5036 from inspec/cw/interface-improvements
Additions to the interface resource
2020-06-25 11:27:53 +01:00
Clinton Wolfe
ad673fa570 Do not include CIDR range on ipv4_address and ipv6_address
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-06-18 15:37:19 -04:00
Clinton Wolfe
d9007588a6 Add an heuristic-based IP lookup property
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-06-18 15:37:19 -04:00
Clinton Wolfe
52468e470e Barebones plural interfaces resource
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-06-18 15:37:19 -04:00
Clinton Wolfe
c386828e7a Add properties for ipv4 and ipv6 ipaddresses for compat
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-06-18 15:37:19 -04:00
Clinton Wolfe
a4000d6912 Adds support for interface on BSD and MacOS
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-06-18 15:37:19 -04:00
Clinton Wolfe
aa824d1b49 Fix a bad interaction involving clearing the plugin registry in unit testing
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-06-18 14:23:54 -04:00
Nick Schwaderer
7068694885 Revert "Make CLI reporter into a plugin"
Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
2020-06-18 12:30:15 +01:00
James Stocks
6c9cb23808 Update sslshake test for sslshake 1.13.1
There are now 1003 ciphers.

Signed-off-by: James Stocks <jstocks@chef.io>
2020-06-18 11:25:35 +01:00
Nick Schwaderer
dca57b61c0
Merge pull request #4907 from inspec/cw/telemetry-run-context
Telemetry - determine run context from stack introspection
2020-06-17 18:17:09 +01:00
Nick Schwaderer
82c6472444
Merge pull request #5069 from inspec/cw/reporter-plugin-cli
Make CLI reporter into a plugin
2020-06-17 17:02:07 +01:00
Clinton Wolfe
98ae89e6cc Convert JUnit reporter to plugin, RunData is still Hash-based
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-06-11 16:46:04 -04:00
James Stocks
070823122d
Merge pull request #5062 from inspec/cw/reporter-plugin-jsonmin
Make the JSON-min Reporter into Plugin
2020-06-11 12:30:18 +01:00
Clinton Wolfe
09bbc7e2e7 Remove a ruby expression-based test
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-06-05 17:40:49 -04:00
Clinton Wolfe
925363766e Document and test to verify that it skips resources in describe blocks
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-06-05 17:40:49 -04:00
Clinton Wolfe
f39cf8c904 Tests to exercise only_if functionality
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-06-05 17:39:54 -04:00
James Stocks
d5f825e716
Merge pull request #5026 from inspec/cw/silence-deprecations
CLI Option to silence deprecations
2020-06-05 14:10:50 +01:00
Nick Schwaderer
fb1aeb0655
Merge pull request #5011 from inspec/cw/complex-cli-inputs
Boolean, Numeric, and Structured CLI inputs
2020-06-05 04:23:48 -07:00
Clinton Wolfe
458a5c4410 Replace Hash RunData access with method calls
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-06-03 21:51:21 -04:00
Clinton Wolfe
76033c03ff Convert CLI reporter to plugin, RunData is still Hash-based
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-06-03 21:13:27 -04:00
Clinton Wolfe
afc6e59e95 Update run_data fixture to include correct statistics structure
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-06-03 20:30:29 -04:00
Clinton Wolfe
99ec27b337 Fix json-min reporter unit test
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-06-02 21:35:16 -04:00
Clinton Wolfe
26e5ae3410 Update run_data fixture to include correct statistics structure
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-06-02 21:34:42 -04:00
Clinton Wolfe
88da919558 Fix exit code check for windows
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-25 23:27:00 -04:00
Clinton Wolfe
d5be4c2927 Test kitchen setup to test detection of audit-cookbook
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-25 21:00:24 -04:00
Clinton Wolfe
43a5fd7945 Test kitchen setup to verify Telemetry RunContext detection under TestKitchen
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-25 21:00:24 -04:00
Clinton Wolfe
09cfcedcd4 Refactor os_prepare cookbook to split out inspec installation
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-25 21:00:24 -04:00
Clinton Wolfe
439c93b115 Add a functional test to check Thor run context detection
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-25 21:00:24 -04:00
Clinton Wolfe
dcc70bc541 Trim log message, make boolean check case insensitive
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-23 00:25:08 -04:00
James Stocks
32fa14f1b0
Merge pull request #5039 from james-stocks/js/issue_5037
Allow for waiver time as well as date
2020-05-22 16:52:23 +01:00
James Stocks
23ed9bcf06
Merge pull request #5007 from inspec/cw/reporters-as-plugins
Reporters as Plugins
2020-05-22 16:10:29 +01:00
Clinton Wolfe
6dfb37befa typo
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-21 18:57:30 -04:00
Clinton Wolfe
3184d5ca9e Add an object model for run_data
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-20 13:27:20 -04:00
James Stocks
350c0bfe8f Handle waiver expiration dates being YAML strings
This is technically incorrect YAML, but if you transcode YAML between several tools you may end up with a date/time value being an explicit string.
It would be helpful if InSpec supported any string value that easily translates to a Time.

Signed-off-by: James Stocks <jstocks@chef.io>
2020-05-20 15:00:43 +01:00
James Stocks
35e36ad40a Allow for waiver time as well as date
Fixes #5037

The YAML parser may parse a waiver timestamp as a Time rather than a Date. Even when the user doesn't care about time, they may be using a tool that outputs YAML with trailing zeroes for hour, minutes, seconds etc.

Signed-off-by: James Stocks <jstocks@chef.io>
2020-05-20 14:59:07 +01:00
Nick Schwaderer
989d86c2ce Stores output of inspec json to archive and artifact
Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
2020-05-20 12:34:17 +01:00
Clinton Wolfe
6a59618d2b Add a failing test case for silencing deprecations
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-13 22:45:58 -04:00
Clinton Wolfe
ee095a244a Soften the exception to a warning when the input is not parseable
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-07 10:47:57 -04:00
James Stocks
ba99226baf Remove TODO Windows skip
I removed the skip to see what would break, and on my Windows laptop
these tests pass OK. The TODO didn't explain what wasn't applicable to
Windows, so I'm just going to remove it.

Signed-off-by: James Stocks <jstocks@chef.io>
2020-05-07 14:01:32 +01:00
James Stocks
1510ff1078 Remove Windows skip from test/functional/inspec_exec_jsonmin_test.rb
Signed-off-by: James Stocks <jstocks@chef.io>
2020-05-07 13:16:22 +01:00
James Stocks
2103b52dbe
Merge pull request #4994 from james-stocks/js/json
Reporter options to truncate message and suppress stacktrace
2020-05-07 12:54:34 +01:00
Clinton Wolfe
12f3f313cb Don't try to test JSON input under powershell
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-06 16:33:50 -04:00
Clinton Wolfe
786e3728d7 Failing tests for #4799
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-05 18:09:11 -04:00
Clinton Wolfe
970f583764 Tighten up tests
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-05 17:59:50 -04:00
Clinton Wolfe
c683c4d64d Failing test cases for 4963
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-05 17:37:23 -04:00
Clinton Wolfe
824018efa3 Failing test cases for #4977
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-05 17:37:23 -04:00
Clinton Wolfe
5accb27224 Linting, and a thinko
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-05 16:51:31 +01:00
Clinton Wolfe
5a7a48bb62 Basics of a working reporter plugin system
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-05 16:51:31 +01:00
Nick Schwaderer
a1129f9efc Allows input and control to have the same name
In https://github.com/inspec/inspec/issues/4936 the issue was reported that naming an input the same as a control caused an unexpected failure.

In that particular case, the naming was a result of a pre-waivers workaround which is no longer necessary, but ultimately a breakage of that name clash is an unexpected occurrance.

Due to how inputs are named and registered, `__apply_waivers` thinks that an object is a waiver that is not a waiver and tries to process it. On the micro level, it breaks when trying to pass a variable to a string as if it were a Hash.

It is imperative that we preserve 100% of the current featureset, pass our tests, and fix this edge case along with new test coverage for the failure.

This PR updates the code to do a slightly more elegant and small ‘waiver check’ to stop the namespace clash from breaking our code.

Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
2020-05-05 10:00:19 +01:00
James Stocks
69fb6e0782 Move reporter option handling to base
They don't need to be json specific, they should apply to any reporter if the user has chosen these settings.

Signed-off-by: James Stocks <jstocks@chef.io>
2020-05-04 15:24:50 +01:00
James Stocks
ae66aee2b2 (WIP) Reporter options to truncate message and suppress stacktrace
TODO: Option names are not JSON specific but only json reporter has been implemented.

Signed-off-by: James Stocks <jstocks@chef.io>
2020-05-04 15:24:50 +01:00
James Stocks
e4fd110ff4 Push Windows test skipping for 2 more months
There are open issues for the failng cases and they are in our priority list.

https://github.com/inspec/inspec/issues?q=is%3Aopen+label%3A%22Aspect%3A+Testing%22+label%3A%22Platform%3A+Windows%22

Signed-off-by: James Stocks <jstocks@chef.io>
2020-05-04 14:55:51 +01:00
Clinton Wolfe
58e8bc5167 Divide tests into undeclared and required groups
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-04-24 16:38:11 -04:00
Clinton Wolfe
a12dfcfdc0 Add a failing test case for 4769
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-04-24 13:57:28 -04:00
James Stocks
951fcc9553
Merge pull request #4954 from tecracer-theinen/feature/virtualization-detection
Improve virtualization resource
2020-04-06 10:23:58 +01:00
James Stocks
6b11089789 Add 1 more month to Windows test skipping
Signed-off-by: James Stocks <jstocks@chef.io>
2020-04-02 17:19:16 +01:00
Thomas Heinen
be120e13b1 Fix deprecation warning on auditd test
Signed-off-by: Thomas Heinen <theinen@tecracer.de>
2020-03-11 17:24:39 +00:00
Thomas Heinen
6a90c10ae3 Improve virtualization resource
Signed-off-by: Thomas Heinen <theinen@tecracer.de>
2020-03-11 17:46:32 +01:00
Clinton Wolfe
a38100a185 Update GCP and azure tests to reflect no-creds errors as seen on CI server
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-03-02 14:32:12 -05:00
Clinton Wolfe
2d9c443a04 Add functional tests that try each of the cloud resource packs with bad creds
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-02-26 14:41:38 -05:00
Ross Moles
e7f01151f0 Merge branch 'master' into oracledb_session_resource 2020-02-14 10:50:10 +00:00
Clinton Wolfe
03d394a51b
Fix auditd resource processing of action and list (#4665)
Fix auditd resource processing of action and list
2020-02-13 15:12:47 -05:00
Ross Moles
351c4e3651 update unit test
Signed-off-by: Ross Moles <rmoles@chef.io>
2020-02-12 18:17:04 +00:00
Ryan Davis
d2e1c3a463
Merge pull request #4905 from inspec/zenspider/artifact
Fix artifact-habitat testing for inspec.
2020-02-10 18:57:20 -08:00
Miah Johnson
7bb0bb2188
Merge pull request #4865 from inspec/jh/schema-improvements
Jh/schema improvements
2020-02-10 18:38:28 -08:00
Ryan Davis
947365719a Fix artifact-habitat testing for inspec.
Needed a fallback on `ENV["project_root"]` not being defined.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-10 18:34:00 -08:00
Clinton Wolfe
774b5944fb
Detect install type via install path (#4856)
Detect install type via install path
2020-02-10 15:36:04 -05:00
Clinton Wolfe
73b3336e30 Test feedback
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-02-10 15:12:32 -05:00
Miah Johnson
4f642e0942 Clean up schema PR.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2020-02-05 17:06:55 -08:00
Jacob Henry
724f82237b Revision of schema to JSON Schema draft 7
Signed-off-by: Jacob Henry <jchenry@mitre.org>
2020-02-05 17:05:47 -08:00
Clinton Wolfe
f52b195d7d ...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-02-05 12:21:14 -05:00
Clinton Wolfe
f8d99eabb9 Move path_exist test code into test file
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-02-05 12:15:48 -05:00
Ryan Davis
ee2401cb13
Merge pull request #4884 from inspec/zenspider/mocha/quiet
Please stop warning about mocha.
2020-02-04 12:59:47 -08:00
Clinton Wolfe
64c35b78f9
issue 4807: test for inputs in profiles (#4883)
issue 4807: test for inputs in profiles
2020-02-04 14:54:29 -05:00
Ryan Davis
6330fa486f Please also stop warning about VERSION being defined.
This removes ::InspecPlugins::TestFixture in installer_test and
loader_test on every test.

Please... no more output in our test runs...

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 16:38:25 -08:00
Ryan Davis
327e571ce9 Please stop warning about mocha.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 14:49:47 -08:00
Ryan Davis
07d5e84eb7 Improved the unit/profiles/* tests.
Use better assertions for better failure messages.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 14:41:37 -08:00
Ryan Davis
89a0b44c64 Refactored and moved Resource.create_dsl to ProfileContext.
ProfileContext#to_resources_dsl is the only usage of it.
The responsibility for this code should be on ProfileContext.

Refactored a majority of #create_dsl to be a 2-line long Module.new
instead of 36 lines. Much less magic. Still has an anonymous module
but it is now much easier to address and debug.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 14:41:37 -08:00
Ryan Davis
fa3122cbff Removed metaprogramming in Inspec::Backend.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 14:41:37 -08:00
Ryan Davis
cea752a01d Tweak for aws resources to determine if they're still under test.
Everyone now has an `inspec` method, but the AWS ones still return
nil as their backend hasn't been set up.

This seems wrong...

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 14:41:37 -08:00
Ryan Davis
ae0dead7be This is all dead. Removed.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 14:41:37 -08:00
Ryan Davis
43f520b4a8 Merged Inspec::Plugins::Resource to Inspec::Resource.
This also removes Inspec::ResourceBehaviors and Inspec::ResourceDSL.

All class methods look like class methods.
All instance methods look like instance methods.

There is still too much clever going on with __register creating
another anonymous subclass, but I think I can work that out/down too.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 14:41:37 -08:00
Ryan Davis
44a006a05a Rename Inspec::Resource.supports to support_registry.
To fix an already existing name collision between Inspec::Resource and
Inspec::Plugins::Resource.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 13:19:32 -08:00
Ryan Davis
99f86c8a0b These tests don't pass on a network cafe and just hang forever.
Changing to localhost resolves immediately but assumes you're NOT
running a git server on http locally.

This seems more valid to me than assuming you know how DNS is going to
resolve everywhere.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 13:18:56 -08:00
Ryan Davis
51b65f6c2e Overhaul Platform#supported?
+ State normal path first.
+ Use Enumerable to state your logic up front, don't build it into
  loops with breaks/returns.
+ Remove nonsensical duplication of key formats. (should push up or remove)
+ Had to add an extra test case that wasn't covered here but was in
  metadata_test.rb (why?!?)

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 13:18:56 -08:00
Ryan Davis
2490a88b9c Minor test improvements
We need to track down `x.must_equal true`.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 13:18:56 -08:00
Ryan Davis
99ded5a132 Improve test expressiveness by using more direct assertions.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 13:18:56 -08:00
Ryan Davis
06ceba3f3d Add test for LEC to expose second-level libraries require.
Not the best test in the world, but it is better than nothing.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 13:18:56 -08:00
Ryan Davis
ddb0db12ef Completely refactored profile_resource_exceptions_test.rb
Half... half.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 13:18:56 -08:00
Nazli Beitollahpour
8a03d38b4b issue 4807: test for inputs in profiles
Signed-off-by: Nazli Beitollahpour <nazli.beitollahpour@umontreal.ca>
2020-02-02 21:43:41 -05:00
Ryan Davis
a3060c4ca8
Merge pull request #4860 from inspec/cw/win-func-input-tests
Remove skips from windows testing in 'inputs' and 'archive' functional tests
2020-01-31 17:51:36 -08:00
Ryan Davis
c70f73dc96
Merge pull request #4864 from inspec/zenspider/resource/inspect
Added --inspect option to inspect shell command.
2020-01-31 16:42:00 -08:00
Ryan Davis
cc1393bb9a
Merge pull request #4822 from PiQuer/master
make command.exist? POSIX conform
2020-01-31 16:41:27 -08:00
Ryan Davis
f2155a64ed
Merge pull request #4843 from michaellihs/master
Add support for yocto linux in service resource
2020-01-29 16:19:27 -08:00
Ryan Davis
19ce5df589
Merge pull request #4827 from inspec/mj/namespaces
Move parsers under Utils
2020-01-29 16:18:43 -08:00
Ryan Davis
10406545ca
Merge pull request #4862 from inspec/zenspider/resources
Fix up the platform on etc_hosts, virtualization, ini, and xml resources to fix OS disparity.
2020-01-29 16:07:47 -08:00
Ryan Davis
2ae2bcf6fb
Merge pull request #4818 from JackChance/master
replaced instances of `have_protocols` with `have_protocol` in docume…
2020-01-29 15:46:25 -08:00
Clinton Wolfe
37455bdd11 Parallelize unit tests
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-29 16:15:58 -05:00
Clinton Wolfe
3419c84233 Make predicates private to reduce namespace pollution; added dockerenv check for docker mode
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-29 11:28:52 -05:00
Ryan Davis
9c051da22b Fix platform on apache_conf to include all unix.
Now discovers the first available conf file from a list of known
paths. Might have to expand based on various distros.

Had to tweak the tests because the mock loader mocks EVERYTHING every
time. :/

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-01-28 14:53:37 -08:00
Ryan Davis
8bd2528ef8 Added --inspect option to inspect shell command.
* Removed Resource#inspect (calling to_s) to make debugging a happy experience.
* Added ResourceBehavior.toggle_inspect to add/remove a basic inspect.
* Added `--inspect` flag to `shell` command. Call toggle_inspect unless --inspect used.
* Cleaned up matchers.rb and removed most explicit calls to inspect.
* Added ResourceInspector to rspec's INSPECTOR_CLASSES.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-01-28 14:52:04 -08:00
Clinton Wolfe
3d5226fb68 Q-quote the args to the train plugin
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-28 13:48:10 -05:00
Clinton Wolfe
28f8d6cc5f Removing skip in archive test just seems to work, too
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-28 12:24:29 -05:00
Clinton Wolfe
6290ee0190 Just remove skips, it seems to work
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-28 11:57:25 -05:00
Clinton Wolfe
357cf051b1 PR feedback part 1
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-28 11:06:12 -05:00