Commit graph

1288 commits

Author SHA1 Message Date
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
Clinton Wolfe
b2bb8c062b Last polish on the unit tests, all pass
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
f5ab0d9125 Config file validation in place
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-01-10 23:54:50 -08:00
Clinton Wolfe
2121667e31 Starting implementation, global method is wired up
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-01-10 23:54:50 -08:00
Clinton Wolfe
916000d10f Sketch of unit tests
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-01-10 23:54:50 -08:00
Clinton Wolfe
aea7052a5c
Fix extra '&&' in windows functional tests, add diagnostics (#3717)
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-01-10 23:52:22 -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
Miah Johnson
15162bf920 Add resources for aws_billing_report and aws_billing_reports. (#2838)
Signed-off-by: Miah Johnson <miah@chia-pet.org>
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-01-09 16:06:48 -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
Tim Smith
b5ff949059 Update Ruby versions used for testing; fix Travis CI issues (#3678)
Signed-off-by: Tim Smith <tsmith@chef.io>
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2018-12-20 22:17:07 -05:00
Amit Saha
bbc07f5f11 aws_sqs_queue - new resource (#3674)
Signed-off-by: Amit Saha <amitsaha.in@gmail.com>
2018-12-20 14:33:21 -05:00
Jerry Aldrich
91fe4ad03b Fix labels on Docker containers (#3673)
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2018-12-20 12:31:13 -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
Jerry Aldrich
8019b2c487 Modify URL fetcher to accept URI (#3633)
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2018-12-12 13:05:51 -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
b3fafab1e6 Add aws_eks_cluster resource (#3582)
* add aws_eks_cluster

Signed-off-by: Timothy van Zadelhoff
timothy.inspec@theothersolution.nl

* disable ABC check on fetch_from_api

Signed-off-by: Timothy van Zadelhoff <timothy.inspec@theothersolution.nl>

* add status predicates

* Change docs for status attribute

Signed-off-by: Timothy van Zadelhoff <timothy.inspec@theothersolution.nl>

*     Add integration tests

    Signed-off-by: Timothy van Zadelhoff <timothy.inspec@theothersolution.nl>

* Adjust EKS build code to almost work

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* EKS only uses private subnets - integration tests pass

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Correct AWS Exception class for resource search miss in unit test

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Update unit test to reflect AWS resource-standard miss behavior, returning nil for most properties

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2018-11-27 16:54:47 -05:00
mhackethal
b67236e485 package: fix package detection on windows (#3607)
* Update package.rb to solve issue #3361

Update the windows package search regex.
According to issue #3361

* Update package.rb
Fix trailing spaces
* Update helper.rb

update sha for get-item-package. To fix the issue #3361
Signed-off-by: markus hackethal <mh@it31.de>
2018-11-27 13:21:25 -05:00
mhackethal
86cf55382b filesystem: improve Windows support (#3606)
* Improve filesystem.rb to support windows

improve filesystem.rb to support windows.
Split into 2 classes LinuxFileSystemResource / WindowsFileSystemResource
Add filesystem to verify a FS-type ( currently not for linux because missing test server )
Size on Windows is converted to GB - discussion about this welcome

update to reflect also windows os

* Create get-wmiobject-filesystem
* Delete get-wmiobject-filesystem

* Fix the testing code for filesystem.
Change its 'filesystem' to 'type' according to recommendation from @miah
Signed-off-by: Markus Hackethal <mh@it31.de>
2018-11-19 13:32:59 -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
Harold Dost
202bec7641 Adds protection against zipslip vulnerability (#3604)
- Adds associated tests to validate paths can't be used.

Relates to: #3599
Signed-off-by: Harold Dost <h.dost@criteo.com>
2018-11-13 14:33:34 -05:00
Fernando Alexandre
8b089ea1e1 Fixes #3546 (#3592)
* When pty is used not having --no-pager makes inspec hang during the test
* Updated tests

Signed-off-by: Jose Alexandre <jose.alexandre@worldfirst.com>
2018-11-13 14:33:08 -05:00
Timothy van Zadelhoff
5739cb2d6b aws_security_group: Query against other security group ids in allow_* matchers (#3576)
* add security-group to security-group rules
* update docs
* Add integration tests for security-group to security-group rules
* rubocop fix
*     Add one security group rule, with position.
* make control fit description

Signed-off-by: Timothy van Zadelhoff <timothy.inspec@theothersolution.nl
2018-11-13 13:25:33 -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
mrshanahan
cebe044a68 Update iis_site bindingInformation construction and add tests. (#3490) (#3492)
Signed-off-by: Matt Shanahan <mrshanahan11235@gmail.com>
2018-11-08 13:42:59 -05:00
Rachel Rice
de5b332feb Allow add_test to accept negation (#3586)
* Allow add_test to accept negation
This will allow for negated tests to be generated with add_tests.
* Fix rubocop violation
* Add optional options hash

Signed-off-by: Rachel Rice <rrice@chef.io>
2018-11-08 12:48:12 -05:00
Mark Hughes
45926ef63a Added xml resource support for ints, bools, and string responses (#3583)
Methods like…

* `count()` return `Integer` values
* `boolean()` return `TrueClass`/`FalseClass` values
* `concat()` return `String` values

…but threw exceptions because those types weren't supported.

This adds support to the `xml` resource, and adds tests to verify some of those examples.

Signed-off-by: Mark Hughes <greenantdotcom@users.noreply.github.com>
2018-11-08 12:47:18 -05:00
James Stocks
5da1180780 Add only_if to Inspec objects (#3577)
* Add only_if attr to Inspec::test
* Add only_if attr to Inspec::Control

Signed-off-by: James Stocks <jstocks@chef.io>
2018-11-08 12:46:19 -05:00
Jared Quick
d33d189d93
Create appvayor workers for Windows functional tests. (#3397)
* Add more windows functional tests and create some appvayor workers.
* Fix uuid test for automate

Signed-off-by: Jared Quick <jquick@chef.io>
2018-11-08 12:00:14 -05:00
Clinton Wolfe
7c611a4c24 Silence RSpec 'should' Warning (#3560)
* Failing functional test for RSpec should deprecation
* Configure RSpec to allow .should calls
* Remove cruft from test files where we needed to filter deprecation warning

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2018-11-07 13:59:48 -05:00
Ksenia
c07ec59070 Add 17 hexadecimal characters support aws_vpc (#3518) (#3564)
aws_vpc: accept 17 hexadecimal characters for vpc_id 

Signed-off-by kchistova <kchistova@gmail.com>
2018-11-05 10:01:16 -05:00
David Alexander
83d382c965 Fixes (some) ruby warnings related to functional tests (#3561)
* Fixes (some) ruby warnings related to functional tests
* Removes unneeded `Dir.tmpdir` from test

Signed-off-by: David Alexander <opensource@thelonelyghost.com>
2018-11-05 09:59:01 -05:00
David Grizzanti
d8c90df4df Doc typo fix (#3551)
Signed-off-by: Dave Grizzanti <david_grizzanti@comcast.com>
2018-11-05 09:11:23 -05:00