Commit graph

1190 commits

Author SHA1 Message Date
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
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
Ryan Davis
fdc82b7d12 Tests shouldn't output. Ever.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-31 14:09:16 -07:00
Ryan Davis
defe63dada Test for bug #4524 and bug #4587 to verify that resources are available w/in rspec constructs.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-31 14:09:16 -07:00
Miah Johnson
314715d9f8 let there be tests
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-30 19:11:38 -07:00
Miah Johnson
9173674ecd Unsure why old mocking system is broken.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-30 17:27:01 -07:00
Landy Chan
9e38bec396 Added wildcard and dot-prefixed identifier support. Combined regex identifier into standard identifier
Signed-off-by: Landy Chan <landychan92@gmail.com>
2019-10-30 16:39:38 -07:00
Landy Chan
e60179b91f Added regex identifier 2019-10-30 13:51:20 -07:00
Miah Johnson
66cb95b2ca Add tests to cover Linux/Windows differences in sqlplus execution
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-30 12:26:12 -07:00
Miah Johnson
9c953a0e68
Merge pull request #4638 from inspec/mj/eha
Add #to_s to etc_hosts_allow, and add tests
2019-10-24 13:24:46 -07:00
Miah Johnson
44579ab4b3
Merge pull request #4637 from inspec/mj/3921
Fix filesystem resource when device has long name
2019-10-24 13:24:23 -07:00
Miah Johnson
ac399b7af9 Add #to_s to etc_hosts_allow, and add tests
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-24 12:07:26 -07:00
Lance Albertson
dab91a321a Improve testing for yum.repo in CentOS 8
The output for ``yum -v repolist all`` changes slightly in CentOS 8. There are
two specific changes:

1. EL8 is no longer trailing the repo name with release version and arch (i.e.
   base instead of base/7/x86)
2. EL8 no longer adds a trailing newline on the last repo and instead has a line
   with ``Total packages:``. This means the repo listed last will never show up.

A fix was introduced in #4566 however the tests still use CentOS 7 yum output
instead of dnf repolist output. One issue was still discovered where it was
including the ``Total packages`` line in the last repository. This includes a
regex for to work around that and fixes for the tests.

Signed-off-by: Lance Albertson <lance@osuosl.org>
2019-10-24 08:22:42 -07:00
Miah Johnson
8e31367b51 Use new mock loader, update the command name
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-23 21:42:10 -07:00
Miah Johnson
e357232db1 Since our command is df -PT lets match it in name
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-23 21:33:29 -07:00
Ryan Davis
8d51d878f6 Fixed users resource when "Last password change" is "never".
Extended quick_resource to have platform methods and a new string
command mock. The named resource to mock may now be a symbol.

Added a new test that shows how to use quick_resource with multiple commands.

Fixes #4629.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-23 16:49:49 -07:00
Ryan Davis
dd3043a992
Merge pull request #4619 from inspec/zenspider/empty-tarball
Fix TarProvider when the tarball has empty files in it.
2019-10-21 12:31:29 -07:00
Ryan Davis
e4f4f5d1cc Fix TarProvider when the tarball has empty files in it.
Added a unit test that runs in ~0.1s. Let's avoid heavy integration
tests where possible.

Fixes #4616

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-18 14:30:00 -07:00
Ryan Davis
3d604348a4
Merge pull request #4566 from inspec/zenspider/mock
Refactored and added an alternative test mock resource system.
2019-10-18 13:36:42 -07:00
Ryan Davis
fc8ea79ad0 Fixed parsing yum output on centos8.
* Renamed and added extra test data to distinguish between centos 7 & centos 8.
* Renamed and added extra tests to cover centos 8.
* Fixed missing repo data by checking at the end if we were still in parse mode.

Fixes #4517

Signed-off-by: Ryan Davis <zenspider@chef.io>
Cc: Miah Johnson <miah@chia-pet.org>
2019-10-16 16:54:07 -07:00
Ryan Davis
201d98fd26 Refactored and added an alternative test mock resource system.
test/unit/resources/json_test.rb had the start of a setup to directly
instantiate resources. I've refactored that up to helper.rb and
extended it with some helper methods so we can directly specify what a
resource command should respond with. For many/most of our tests, this
should be sufficient.

Finally, I switched our yum tests over to use the new setup. This will
allow us to address #4517 and extend the tests for centos8 output
differences with ease. Ease, folks... ease.

Signed-off-by: Ryan Davis <zenspider@chef.io>
Cc: Miah Johnson <miah@chia-pet.org>
2019-10-16 16:54:07 -07:00
Miah Johnson
d48bb56087 Every other example has the value set to 1, so I changed this for consistency.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-16 10:15:49 -07:00
Miah Johnson
a40ec993e8 Rename files to remove references to gordon
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-16 10:13:24 -07:00