Commit graph

1424 commits

Author SHA1 Message Date
Clinton Wolfe
7328e82ae6 Implement credential set loading
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-27 15:14:27 -05:00
Clinton Wolfe
07ee1c3bb5
Merge pull request #3814 from inspec/tas50/kitchen
Update the integration tests to use dokken-images and newer Chef technologies
2019-02-27 14:43:21 -05:00
Clinton Wolfe
ef18081dfe Merge branch 'cw/attrs-rename-classes-methods'
Accidentally merged cw/attrs-rename-default-attribute into cw/attrs-rename-classes-methods, intended to go to master.
2019-02-26 15:38:20 -05:00
Clinton Wolfe
ac41a6ae20
Merge pull request #3811 from inspec/cw/attrs-rename-classes-methods
Attribute->Input Rename:  Rename Classes and Methods
2019-02-25 18:02:11 -05:00
Clinton Wolfe
c9e8716310 Change two more mentions of DEFAULT_ATTRIBUTE
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-22 10:10:50 -05:00
Clinton Wolfe
24e8c0a6dd Replace DEFAULT_ATTRUBUTE, unit test for it passes
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-22 10:05:31 -05:00
Jerry Aldrich
0684cda6c6 Suppress warnings in unit test output
This does the following:
  - Captures warning for lack of `--sudo` with `--sudo-password`
  - Captures warnings for transformation of URL target in url fetcher
  - Changes deprecated `supports:` syntax to use new syntax

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-02-22 00:10:39 -08:00
Clinton Wolfe
947cf32307 Fix version test
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-20 20:44:25 -05:00
Clinton Wolfe
491ec001a2 Fix bad class name in unit test
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-20 20:41:10 -05:00
Clinton Wolfe
1dab1c1bd5 Skip a test related to input override and profile inheritance; we know this is in flux
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-20 20:41:10 -05:00
Clinton Wolfe
c28c244f16 Fix a handful of functional tests
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-20 20:41:10 -05:00
Clinton Wolfe
f7d58ad92c Replace most mentions of attribute with input in test/
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-20 20:41:10 -05:00
Clinton Wolfe
4f361bfc56 Replace most mentions of Attribute (titlecase) in lib and test
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-20 20:41:10 -05:00
Clinton Wolfe
ce99624095 Renamed AttributeRegistry->InputRegistry
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-20 20:41:09 -05:00
Clinton Wolfe
a1982a5f8b First pass on renaming attribute->input, unit test passes
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-20 20:41:09 -05:00
Tim Smith
0fe5880c5d Add comment regarding the postgresql pin
Basically this avoids sous-chefs breaking inspec tests by accident

Signed-off-by: Tim Smith <tsmith@chef.io>
2019-02-14 14:02:06 -08:00
Clinton Wolfe
cbf1b665f8 Fix typo in require
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-14 12:37:27 -05:00
Clinton Wolfe
fc448ed6f1 Rename attribute_registry to input_registry
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-14 12:37:27 -05:00
Clinton Wolfe
c538eae2df Rename objects/attribute to objects/input
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-14 12:37:27 -05:00
Tim Smith
68ff8d8b43 Update what we expect for the x509 request
The new built in chef resource creates it a bit differently than the legacy cookbook resource did

Signed-off-by: Tim Smith <tsmith@chef.io>
2019-02-13 22:00:00 -08:00
Tim Smith
4b3095dac2 Further modernize the cookbook and remove legacy setup
Remove container setup that comes for free with the dokken containers now
Use the new openssl resource names
Remove all the encoding statements that even rubocop doesn't recommend anymore
Remove some compatibility with centos-5 and ubuntu 15.10

Signed-off-by: Tim Smith <tsmith@chef.io>
2019-02-13 21:50:33 -08:00
Tim Smith
772244c12a Use the latest Chef 14 in testing and nuke windows/openssl cookbooks
All the windows / openssl resources are built into Chef now.

Signed-off-by: Tim Smith <tsmith@chef.io>
2019-02-13 18:04:43 -08:00
Tim Smith
097e2deedc Don't include the apt recipe over and over again in the recipes
We run apt_update once with chef and we already update the cache directly on the container at start. We don't need to try to do the same thing 3 other times.

Signed-off-by: Tim Smith <tsmith@chef.io>
2019-02-13 17:19:55 -08:00
Tim Smith
55a8f752f9 Remove deps from the Berksfile that are in the metadata
There's no need for this. Never has been.

Signed-off-by: Tim Smith <tsmith@chef.io>
2019-02-13 16:28:16 -08:00
Tim Smith
b07aed1c73 Use the platform_family? helper
It's much simpler than listing every single possible platform and it makes this actually work on Oracle

Signed-off-by: Tim Smith <tsmith@chef.io>
2019-02-13 16:06:30 -08:00
Tim Smith
ec29727838 Let Chef handle the root_group itself
We have node['root_group'] and Chef will apply this on its own.

Signed-off-by: Tim Smith <tsmith@chef.io>
2019-02-13 16:04:53 -08:00
Tim Smith
6c706f0715 Don't use apt/yum in the kitchen configs either
There's really no need for this. It just slows down the run

Signed-off-by: Tim Smith <tsmith@chef.io>
2019-02-13 16:03:53 -08:00
Tim Smith
2f89081f53 Remove direct usage of apt/yum cookbooks in the os_prepare cookbook
We have an apt_update resource now
Yum cookbook was never needed
dnf is now supported on Fedora out of the box

Signed-off-by: Tim Smith <tsmith@chef.io>
2019-02-13 16:02:41 -08:00
Tim Smith
e826eae292 Move the template out of the default directory
This is a Chef 11 thing.

Signed-off-by: Tim Smith <tsmith@chef.io>
2019-02-13 16:01:17 -08:00
Clinton Wolfe
66d0d146b2 Rename test control files
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-11 12:10:08 -05:00
Clinton Wolfe
785888a209 Rename functional tests, unit tests, and test fixtures
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-08 18:23:01 -05:00
Clinton Wolfe
fd3c3df8c1 Add failing functional tests for more piped config subcommands
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-08 13:18:08 -05:00
Jerry Aldrich
273597d371 Remove encoding: utf-8
Thanks @miah

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-02-07 13:04:58 -08:00
Jerry Aldrich
7134989eba Respond to @clintoncwolfe's feedback
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-02-07 11:15:01 -08:00
Jerry Aldrich
a6f74a33b2 Fix Inspec::Config regression in Inspec::Backend
With the changes in PR #3750, `Inspec::Backend.create` needs to support
both being passed a Hash and being passed an Inspec::Config. This adds
a line to convert a passed Hash to an Inspec::Config.

This also adds unit tests for Inspec::Backend because they were missing.

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-02-07 01:00:05 -08:00
Clinton Wolfe
4cf9e23e9d Move most test fixture profiles under attributes/
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-06 18:10:19 -05:00
Clinton Wolfe
05a011f6ff
Merge pull request #3629 from inspec/cw/init-plugin
inspec-init plugin: generate inspec plugins
2019-02-06 17:40:59 -05:00
Clinton Wolfe
02cb799ee6 Rename free to free_kb
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-06 14:01:04 -05:00
Clinton Wolfe
5bbd4c16d6 Add size_kb, and correct Powershell code to return KB for both total size and free space, rather than total in GB and free space in bytes
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-06 14:01:04 -05:00
Clinton Wolfe
fef637a6c6 Add percent_free property
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-06 14:01:04 -05:00
James Massardo
c1a9de7003 update helpers and mocks so tests run successfully
Signed-off-by: James Massardo <jmassardo@chef.io>
2019-02-06 14:01:04 -05:00
James Massardo
83c0c18fca Add free space and type to filesystem resource
Signed-off-by: James Massardo <jmassardo@chef.io>
2019-02-06 14:01:04 -05:00
Clinton Wolfe
5a5eb4a9a5
Merge pull request #3750 from inspec/cw/cred-set-support-02
Formalize Config File
2019-02-06 13:28:30 -05:00
Clinton Wolfe
f760c54cba Move plugin activate() method into Activator class
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-06 12:18:18 -05:00
Clinton Wolfe
a349f91e52 Make UI not print emphasis by default
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-06 11:58:10 -05:00
Clinton Wolfe
cb3e0aca60 Test for piped config, and fix to make it work
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-01 14:27:49 -05:00
Clinton Wolfe
d31a13efc6 Two more test files needed mock updates
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-01 14:24:26 -05:00
Clinton Wolfe
ea78e2f3c5 Skip test that had always been broken; how was this every passing?
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-01 14:24:26 -05:00
Clinton Wolfe
2186179061 Allow passing opts to mock Config; and use mock config in one more place in test helper
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-01 14:24:26 -05: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
4507af4c29 More things
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-01 14:24:26 -05:00
Clinton Wolfe
e054be7d0d Comment on doubt of truthiness
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-01 14:24:26 -05:00
Clinton Wolfe
6c20f312fd Add bang to validate_reporters in tests, too
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-01 14:24:26 -05:00
Clinton Wolfe
06399fbc0f Add clarifying comments to unit test for malformed json 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
bb6a73d7d4 Create config object and units tests
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-01 14:24:26 -05:00
Clinton Wolfe
6ed046bb23 More things
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-01 14:24:26 -05:00
Clinton Wolfe
102505a937 Use new config file system to read config
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
Clinton Wolfe
36ce34be98 Passing functional tests for using plugin disable options
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-01-31 22:52:19 -05:00
Clinton Wolfe
761944b3ce
Merge pull request #3770 from inspec/ja/fix-bad-name-check
More meaningful error when including controls from a missing dependency
2019-01-31 16:14:35 -05:00
Clinton Wolfe
253f7f8c72
Merge pull request #3757 from inspec/ja/fix-plugin-load-on-help
Add `--help` to CLI plugin activation criteria
2019-01-31 15:54:04 -05:00
Clinton Wolfe
a1af115e26 Add eval to unit tests; break up codegen test into individual elements
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-01-30 14:29:18 -05:00
Jerry Aldrich
94d8d11120 Respond to feedback
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-30 09:26:04 -08:00
James Stocks
5868eb52e7 Fix Inspec::Attribute.to_ruby and add unit test
Signed-off-by: James Stocks <jstocks@chef.io>
2019-01-30 17:15:22 +00:00
Jerry Aldrich
f0c207dad9 Fix undefined method error from inspec check
This changes the error message from using a bad reference in
`include_controls` from:

```
NoMethodError: undefined method `profile' for nil:NilClass
```

To one detailing that the profile cannot be loaded since it isn't listed
as a dependency.

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-29 22:36:27 -08:00
Clinton Wolfe
4d7cbc624c Test and fix case in which both :default and :value are provided
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-01-28 00:42:27 -05:00
Clinton Wolfe
6b5a951ccf Update value/default usage in test files
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-01-28 00:42:27 -05:00
Jerry Aldrich
b801bbca1c Consolidate tests and verify output contents
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-27 17:46:42 -08:00
Jerry Aldrich
7f4560ea7c Add --help to CLI plugin activation criteria
This ensures that all the following result in the same CLI output:
  - `inspec`
  - `inspec help`
  - `inspec --help`

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-26 12:47:27 -08:00
Clinton Wolfe
ee76c5bb54
Merge pull request #3740 from inspec/ja/adopt-3419
iis_app_pool:  Fixes error with 'should not exist'
2019-01-25 11:56:10 -05:00
Jerry Aldrich
71eca8c4ed Add \n to @TheLonelyGhost's mocked command
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-22 15:08:25 -08:00
David Alexander
d5dbae2efd Updates stub for IIS App Pool unit test
Signed-off-by: David Alexander <opensource@thelonelyghost.com>
2019-01-22 15:08:25 -08:00
David Alexander
53e3533b8c Fixes unit test for to_s of iis_app_pool
Signed-off-by: David Alexander <opensource@thelonelyghost.com>
2019-01-22 15:08:25 -08:00
Jerry Aldrich
e80e7d872e Mock files used for virtualization resource tests
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-22 13:09:17 -08:00
Jerry Aldrich
f7e8a0c80c Add deprecation check for processes.list
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-22 13:09:17 -08:00
Jerry Aldrich
3b8da7957d Mock missing_file in NGINX resource tests
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-22 13:09:17 -08:00
Jerry Aldrich
62cfcf0ebe Add mock command for oracledb_session
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-22 13:09:17 -08:00
Jerry Aldrich
4c0a582539 Mock mysql related command
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-22 13:09:17 -08:00
Jerry Aldrich
3fe7091254 Wrap deprecated ServerSpec matchers in procs
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-22 13:09:17 -08:00
Jerry Aldrich
5ea640a2cd Remove nil check in chocolatey_package test
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-22 13:09:17 -08:00
Jerry Aldrich
c1547ee898 Remove deprecated methods from shadow test
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-22 13:09:17 -08:00
Jerry Aldrich
a0b76defb0 Evaluate runner.run in a proc
This removes the following line from the test output:

```
Test Summary: 0 successful, 0 failures, 0 skipped
```

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-22 13:09:17 -08:00
Jerry Aldrich
2f20370426 Change .must_equal nil to .must_be_nil
`.must_equal nil` is deprecated

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-22 13:09:17 -08:00
Jerry Aldrich
bc56b2275a Use mocked file instead of an empty file call
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-22 13:09:17 -08:00
Jerry Aldrich
b440e3f132 Change DLS to DSL
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-22 13:09:17 -08:00
Jerry Aldrich
c348a2032a Remove test that uses deprecated ppa resource
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-22 13:09:17 -08:00
Clinton Wolfe
2f42803a90
inspec check: Allow 'Proprietary' as a valid license term.
Signed-off-by: James Stocks <jstocks@chef.io>
2019-01-22 15:50:38 -05:00
Clinton Wolfe
ed460c7869
Fix SSL tests by allowing multiple cipher counts
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-22 15:00:49 -05:00
Jerry Aldrich
5c4be8de87 Fix SSL tests by allowing multiple cipher counts
The value of `ciphers` is 681 on my localhost, but 993 on Travis.

This modifies the test to allow both values.

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-21 15:02:58 -08:00
Jerry Aldrich
10f0393683 Fix AWS tests found during ChefStyle spike
This fixes some style issues and fixes a duplicated test method name.

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-21 13:05:46 -08:00
Clinton Wolfe
0a131e4945
Centralized Deprecation Facility #3690
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-01-17 15:08:16 -05:00
James Stocks
ad4df90912 Allow 'Proprietary' as a valid license term.
Currently our supported profiles output a warning for every instance of `inspec check` because our license metadata `Proprietary, All rights reserved` is not considered valid.
This commit allows for a string beginning with `Proprietary` to be considered valid, as well as any valid SPDX value.

Signed-off-by: James Stocks <jstocks@chef.io>
2019-01-16 11:19:55 +00:00
Clinton Wolfe
48e2188047 Remove class var for testing, replace with tramp data
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-01-16 00:24:19 -05:00
Clinton Wolfe
212fe36b76 Add debug output to ignore actions
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-01-15 23:49:20 -05:00
Jerry Aldrich
f5ec7c9c65 Fix style/RuboCop on cw/deprecation-facility
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-14 13:57:59 -08:00
Clinton Wolfe
3c5a26ecfa Move attribute unit tests to a more expectced location
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-01-11 17:23:57 -08:00
Clinton Wolfe
066fde854d Allow empty opts to functional test helper run_inspec_process
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-01-11 16:42:46 -08:00
Clinton Wolfe
c169119895 linting
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-01-10 23:54:50 -08:00
Clinton Wolfe
c43e401dda Fix default exit code logic to properly use value in Inspec::UI
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-01-10 23:54:50 -08:00