Commit graph

1311 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
99ec27b337 Fix json-min reporter unit test
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-06-02 21:35:16 -04: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
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
63d95b6b6b Basics of a working reporter plugin system
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-01 23:48:05 -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
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
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
Miah Johnson
7bb0bb2188
Merge pull request #4865 from inspec/jh/schema-improvements
Jh/schema improvements
2020-02-10 18:38:28 -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
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
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
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
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
Clinton Wolfe
357cf051b1 PR feedback part 1
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-28 11:06:12 -05:00
Ryan Davis
df31f744f4 Fix up platform on filesystem resource.
From linux to unix. This should work fine even on AIX, according to
the man pages.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-01-27 15:34:33 -08:00
Clinton Wolfe
76a9c3e590 Install-path based install context detection
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-27 13:29:37 -05:00
Noel Georgi
7ac25401bb
Add: content option for x509_certificate
Signed-off-by: Noel Georgi <git@frezbo.com>
2020-01-22 13:49:35 +05:30
Michael Lihs
edd93eea81 Add support for yocto linux in service resource
Signed-off-by: Michael Lihs <michael.lihs@thoughtworks.com>
2020-01-18 01:26:16 +01:00
Miah Johnson
0d57612103 Update references to use new namespace
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2020-01-07 15:12:42 -08:00
Ryan Davis
f09595c33d
Merge pull request #4821 from inspec/zenspider/mocha2
Found and fixed more mocha/setup deprecations.
2020-01-02 16:07:35 -08:00
Ryan Davis
c57a0e1f13 Found and fixed more mocha/setup deprecations.
This level of duplication is not good.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-12-31 15:46:47 -08:00
Ryan Davis
73cccd8681 Cache the backend in profile_context_test.rb
And this speeds it up from 0.5s to 0.07s.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-12-31 15:27:12 -08:00
Ryan Davis
6426feeeb4 Removed the last of the metaprogramming from ControlEvalContext.
* Merged CEC.create args into CEC#initialize
* Converted the only call site of CEC.create to just call new.
* Added profile_context and resources_dsl accessors to CEC.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-12-31 15:27:12 -08:00
Ryan Davis
8e281e007e oops
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-12-24 04:11:17 -08:00
Felipe Zipitria
bff3fa960d
Add suport for freebsd package resource
Signed-off-by: Felipe Zipitria <fzipitria@perceptyx.com>
2019-12-17 08:39:43 -03:00
Trevor Vaughan
21edc712bd
Fix auditd resource processing of action and list
Per auditctl(8), the -a option can have either list,action or
action,list. This PR matches against valid actions for the action field
and passed the remainder off to the list field.

Closes #4664

Signed-off-by: Trevor Vaughan <tvaughan@onyxpoint.com>
2019-12-12 17:38:47 -05:00
Clinton Wolfe
bba6d70b3b Raise FetcherFailure for url headers missing
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-12-04 13:32:58 -05:00
Miah Johnson
b174273034
Merge pull request #4724 from mbaitelman/add_last_login_user
Add last login date to WindowsUser
2019-12-02 13:27:45 -08:00
Ryan Davis
fe3c49e705
Merge pull request #4743 from inspec/zenspider/fixtures
Suppress output from rubygems installs.
2019-12-02 10:41:04 -08:00
Ryan Davis
f2e4fb549c Address and fix all our ruby 2.7 warnings & errors.
This does NOT include fixes for our dependencies that are also having
2.7 warnings (which cause our functional tests to fail because for
some reason we expect stderr to be empty, which is brittle).

I've got upstream PRs to fix all of those. My tests pass locally. I
could push a commit that modifies the Gemfile to use my forks, but I'd
like to see how this fares for now.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-27 15:42:52 -08:00
Ryan Davis
d4b3a5c149 Suppress output from rubygems installs.
I still wish this wouldn't fetch or install... but in the meantime,
leave my dots alone.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-27 13:42:43 -08:00
Clinton Wolfe
9792bae00d Move the registry cache object
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-11-22 10:09:51 -05:00
Clinton Wolfe
d9f55bf85c Singularize the fetchers directory name
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-11-22 09:57:28 -05:00
Clinton Wolfe
7807c3fa01 Re-namespace core Fetchers
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-11-18 13:20:35 -05:00
Clinton Wolfe
80ef0eeeba Take back the Inspec::Fetcher namespace
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-11-15 16:23:00 -05:00
Mendy Baitelman
6baf0f8a1c Fix tests
Signed-off-by: Mendy Baitelman <mendy@baitelman.com>
2019-11-14 21:22:07 -08:00
Clinton Wolfe
b39d47bda7 Move fetcher files
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-11-14 15:25:43 -05:00
Mendy Baitelman
4ba95a0236 Fix syntax, start tests
Signed-off-by: Mendy Baitelman <mendy@baitelman.com>
2019-11-13 23:08:23 -08:00
Ryan Davis
2eaebe510c Fixed installer_test by testing subsets of the paths.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-12 14:51:56 -08:00
Ryan Davis
b1c2af209b Corresponding fixes for the move from test/unit/mock to test/fixtures.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-08 19:20:12 -08:00
Ryan Davis
e8ca7d3cd3 Suppress output from rubygems installs.
I still wish this wouldn't fetch or install... but in the meantime,
leave my dots alone.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-08 18:35:23 -08:00
Ryan Davis
db8e6e7415 Moved test/unit/mock/* to test/fixtures
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-08 16:29:03 -08:00
Ryan Davis
244c7bbed4
Merge pull request #4677 from inspec/zenspider/bump-chefstyle
Bump chefstyle and fix up flagged code.
2019-11-08 16:07:42 -08:00
Ryan Davis
bb49d58cd9 Switched chefstyle back to Layout/AlignArguments=with_first_argument.
Fixed the flags mostly with `chefstyle -a` but also refactored/cleaned
some stuff by hand.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-08 12:57:43 -08:00
Clinton Wolfe
d9f34dda58
Make input() work in describe.one (#4666)
Make input() work in describe.one
2019-11-07 11:58:11 -05:00
Mendy Baitelman
1a9a47ee96 Merge remote-tracking branch 'upstream/master' into add-startuser-systemd-service
Signed-off-by: Mendy Baitelman <mendy@baitelman.com>
2019-11-04 21:07:56 -08:00
Clinton Wolfe
f9b65cc54c Test fixture profile for inputs in describe.one
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-11-01 16:52:21 -04:00
Ryan Davis
e54f0b3646 Fixed runner tests for windows.
Passes on my side and only fails on buildkite's windows. I have no
idea why / how it differs. This should be neutral enough that it works
on both.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-31 15:20:58 -07:00
Miah Johnson
1b93755410
Merge pull request #4653 from landychan/lchan/bug-fix-3611
Nginx Resource: Add parsing support for wildcard, dot prefix, and regex
2019-10-31 14:20:08 -07:00
Miah Johnson
7a68d58904
Merge pull request #4654 from inspec/mj/oracle
oracledb_session fixes
2019-10-31 14:13:56 -07:00
Miah Johnson
de4139aff8
Merge pull request #4568 from ramereth/yum-el8-support
Improve testing for yum.repo in CentOS 8
2019-10-31 14:13:05 -07:00
Ryan Davis
74c692c9eb Pushed unmock up to helper.rb
Also switched osx group test to use quick_resource since it is cleaner.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-31 14:09:16 -07:00