Commit graph

249 commits

Author SHA1 Message Date
Clinton Wolfe
e0fe3f1876 Add version to list of exempt commands
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-04-11 10:30:46 -04:00
Clinton Wolfe
30e5c39e74 tmpdir and mktmpdir are two verry different things
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-04-11 10:30:46 -04:00
Clinton Wolfe
023bfefc67 Add ungated invocations
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-04-11 10:30:46 -04:00
Clinton Wolfe
7d81f93496 Add test for interactively answering no
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-04-11 10:30:46 -04:00
Clinton Wolfe
fb73b39976 Add tests for interactively answering yes
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-04-11 10:30:46 -04:00
Clinton Wolfe
2f3adf6176 Add tests for when persistence file already exists
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-04-11 10:30:46 -04:00
Clinton Wolfe
1c9533087d Test when --accept-license is used
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-04-11 10:30:46 -04:00
Clinton Wolfe
e3857a8783 Sketch of functional test
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-04-11 10:30:46 -04:00
Clinton Wolfe
066ed01259 Update winrm no-such-transport test to not use kerberos, which we do now support
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-04-09 15:43:37 -04:00
Clinton Wolfe
b701317616
Merge pull request #3879 from inspec/cw/attrs-rename-cli-option
Attribute->Input Rename: Rename cli option
2019-04-09 11:46:29 -04:00
Clinton Wolfe
2f5c063e08 Add 'passthrough' field
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-03-28 01:10:25 -04:00
Clinton Wolfe
a616205dfc Add failing tests for moving the passthru logic to json-automate
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-03-28 01:07:41 -04:00
Clinton Wolfe
4b96929bf5 Modernize automate output test
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-03-26 10:44:01 -04:00
devoptimist
2d49f39adc moved example tests into their own sub dir, and reused examples_path variable
Signed-off-by: devoptimist <sbrown@chef.io>
2019-03-18 15:15:32 +00:00
devoptimist
94d80f6c8f Decoupling test profiles from example profiles
Signed-off-by: devoptimist <sbrown@chef.io>
2019-03-14 00:32:13 +00:00
Clinton Wolfe
3cce8ba705 Replace attrs with input-files in remaining tests
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-03-08 12:40:33 -05:00
Clinton Wolfe
04b26dd417 Add failing functional tests for --attrs -> --input-file
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-03-08 11:37:38 -05:00
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
947cf32307 Fix version test
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-20 20:44:25 -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
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
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
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
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
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
Jerry Aldrich
94d8d11120 Respond to feedback
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-30 09:26:04 -08: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
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
0a131e4945
Centralized Deprecation Facility #3690
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-01-17 15:08:16 -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
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
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
Clinton Wolfe
642d8d61b6 Funcitonal tests pass; some unit tests fail
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-01-10 23:54:50 -08:00
Clinton Wolfe
ad84987357 Fix spurious ampersands in windows invocation
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-01-09 17:16:44 -08:00
Clinton Wolfe
d6b5bdef09 Add diagnostics to the functional test helper
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-01-09 17:14:42 -08:00
Clinton Wolfe
25119168de
Testing: aim json export inheritance test at a local child profile that we control (#3696)
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-01-05 12:21:34 -05:00
Noel Georgi
f1fbd518e5 Expose additional WinRM options for transport, basic auth, and SSPI (#3669)
Signed-off-by: Noel Georgi <git@frezbo.com>
2018-12-20 11:57:53 -05:00
Clinton Wolfe
c0a46cf841
UI Object for for CLI work (#3618)
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2018-12-12 11:44:16 -05:00
Clinton Wolfe
fefa6c2ecd
Plugin Type: DSLs (#3557)
This PR adds 5 closely related plugin types, which allow a plugin to implement new DSL methods / keywords. The mechanism to activate the plugins are all very similar - basically, in a particular location in the code, `method_missing` is implemented, and is used to activate the particular type of DSL being requested.

4 of the DSL plugin types relate to code that could appear in a profile control file.

* outer_profile_dsl plugins allow you to extend the code in profile Ruby files that appear outside `control` or `describe` blocks.
* control_dsl plugins allow you to extend the code within `control` blocks.
* describe_dsl plugins allow you to extend the code within `describe` blocks.
* test_dsl plugins allow you to extend the code within `it`/`its` blocks.

Finally, the `resource_dsl` plugin allows you to extend the code used within custom resources.

Basic unit tests are provided to prove that the plugin types are properly defined.

A simple plugin fixture defining DSL hooks (based on favorite foods) is included, and is exercised through a set of functional tests.

The plugin developer docs are updated to describe the 5 DSLs.

*Note*: Implementing a plugin using any of the DSL plugin types is experimental.  The contexts that are exposed to the DSL methods are private and poorly documented. The InSpec project does not claim the APIs used by these plugin types are covered by SemVer.  Plugin authors are encouraged to pin tightly to the `inspec` gem in their gemspecs.

Motivation for this plugin comes from the desire to allow passionate community members to implement things like "2 out of 3" tests, example groups, improved serverspec compatibility, "they/their" and other "fluency" changes, as well as make it possible for future work by the InSpec team to be implemented as a core plugin, rather than a direct change to the main codebase.
2018-11-29 14:14:06 -05:00
Clinton Wolfe
e4afadfc3f Revert setting RSpec expectation syntax to 'should' mode (#3620)
* Revert "Silence RSpec 'should' Warning (#3560)"

This reverts commit 7c611a4c24.

* Add comment with link to reverted fix

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2018-11-16 17:04:04 -05:00
Clinton Wolfe
35ad5d5528 Improvements to the functional helper run_inspec_process (#3603)
* Add run_inspec_process, with JSON handling, to functional helper
* Add ability to run a plugin to functional helper
* CWD fix for run_inspec_process
* Add support for running a plugin within a functional test
* Move plugin functional helper code to main func helper file
* FuncHelper: Do not send reporter or lock options if command is not exec

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2018-11-16 17:03:40 -05:00
Clinton Wolfe
3c8697e5e2 Create a class to handle the plugins.json file (#3575)
* unit tests for plugin conf file class, all skip
* File path stuff works
* Validation works
* Add works
* Added remove_entry
* Save works - ready to refactor others
* Rework Loader to use ConfigFile
* Modify loader and installer to use the config file class
* linting

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2018-11-16 17:03:09 -05:00
Jerry Aldrich
6ba4aaf630 Add Git SSH and HTTP basic auth support to inspec exec (#3562)
* Add support for `git@` and HTTP basic auth

This adds support for the following:

```
inspec exec git@github.com:private/example_profile
inspec exec https://username:token@github.com/private/example_profile
inspec exec https://username:password@webserver/private/example_profile
```

This also uses the Git fetcher when the URL ends in `.git`. Example:

```
git config credential.helper cache
git ls-remote https://github.com/private/example_profile.git
inspec exec https://github.com/private/example_profile.git
```

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>

* Add documentation for `inspec exec` usage

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>

* Add tests for Git fetcher and `inspec exec`

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>

* Add `opts` to branch of Git fetcher resolve logic

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>

* Modify Git example comments

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>

* Force `parse_uri` to attempt a parse

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2018-11-08 15:55:15 -05:00