Commit graph

1143 commits

Author SHA1 Message Date
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
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
Miah Johnson
df7efefc9d mostly a search and replace for gordon -> example
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-16 10:13:24 -07:00
Clinton Wolfe
bde308f72d
Replace input to_hash method, and add unit test for it (#4545)
Replace input to_hash method, and add unit test for it
2019-10-11 10:50:27 -07:00
Clinton Wolfe
b09edbbbf9 And the YAML fixture too.
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-10-09 20:49:33 -07:00
Clinton Wolfe
8f4ff8923e Add functional test to exercise waivers during profile inheritance
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-10-09 19:10:48 -07:00
Ryan Davis
f9ec3053aa Refactored unit test to be more like the other one.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-09 17:41:03 -07:00
Ryan Davis
26ffea8d39 Make my diffs pretty for jsonmin tests.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-09 17:40:53 -07:00
Ryan Davis
f3fc535fee Changed formatting and ordering of test data to reduce diffs on failing tests.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-09 17:40:31 -07:00
Clinton Wolfe
d150a568cd More test fixes
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-10-09 17:20:24 -07:00
Clinton Wolfe
01991cc347 Update some failing test fixtures
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-10-08 21:00:11 -07:00
Clinton Wolfe
0f5fde9729 Modify waiver input file to use 'run' subfield instead of 'skip'
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-10-08 01:03:40 -07:00
Clinton Wolfe
88ed1794cb Revert to a small amount of duplicating to_hash in inspec/input.rb
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-10-06 19:30:37 -04:00
Miah Johnson
e48d08343b
Merge pull request #4452 from mhackethal/user-windows-fix
User windows fix
2019-10-04 15:30:37 -07:00
Clinton Wolfe
11074bb7ce Adjust indentation
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-10-04 14:06:49 -04:00
Clinton Wolfe
36db8b9a7b Rely on copy of to_hash in objects/input.rb to avoid duplication
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-10-04 14:05:19 -04:00
Clinton Wolfe
51812a9e4e Replace to_hsh method, and add unit test for it
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-10-04 14:05:19 -04:00
Miah Johnson
416c33e056 Add name property to interface resource
Also some general cleanup.

Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-03 14:53:43 -07:00
Ryan Davis
6fd2db256d
Merge pull request #4560 from inspec/zenspider/apt
Fixed apt resource incorrectly parsing deb files w/ quoted URIs.
2019-10-03 14:50:48 -07:00
Ryan Davis
07dc5e3192 First pass at cleaning deprecations for old minitest/spec-style tests.
3 files left to go, and they're behaving oddly so I'm leaving them out
in this pass. Looks like 21 deprecations left.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-03 13:45:19 -07:00
Ryan Davis
09392943f5 Fixed apt resource incorrectly parsing deb files w/ quoted URIs.
Fixes #4559.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-03 12:55:15 -07:00
Ryan Davis
708a319ce8 Fixed tests to work with rspec-expectations 3.8.5+.
We were using a "private" method in our tests and they changed the
signature.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-02 18:08:19 -07:00
Ryan Davis
866efdf141
Merge pull request #4531 from inspec/mj/wtf_rake
Remove maintainers task from require
2019-09-27 14:45:21 -07:00
Ryan Davis
984e02e312 Quick fix for faraday_middleware bug introduced when bumping to faraday 0.16.0.
Namespacing changed in faraday from Faraday::Error::* to Faraday::*
but was not reflected in faraday_middleware (which hasn't released
since February). I will file an issue and/or PR with them later.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-27 14:19:45 -07:00
Ryan Davis
ca4844210d Fixed Inspec::Plugin::V2::Registry#detect_system_plugins
+ Falls back to checking for inspec-core if inspec not found.
+ Fails gracefully if neither are found.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-25 16:10:00 -07:00
Irving Popovetsky
bbb927e3dd Remove invalid test cases for tags
Signed-off-by: Irving Popovetsky <irving@chef.io>
2019-09-17 15:58:12 -07:00
Irving Popovetsky
4aebe87c2e Update unit tests to match
Signed-off-by: Irving Popovetsky <irving@chef.io>
2019-09-17 15:58:12 -07:00
Ryan Davis
a0a7917faa
Merge pull request #4485 from inspec/zenspider/objects-inputs
Split out Inspec::Input functional code from the code generation code.
2019-09-16 17:03:49 -07:00
Ryan Davis
e375ea30c8 Split out Inspec::Input functional code from the code generation code.
Includes moving errors into Inspec::Input and Inspec::InputRegistry.

Fixes #4456.
Fixes #4473.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-13 17:12:20 -07:00
mhackethal
c3270b537a update user_test.rb
Signed-off-by: mhackethal <mh@it31.de>
2019-09-13 21:19:20 +02:00
mhackethal
0b76859728 adjust user_test.rb 2019-09-13 20:45:54 +02:00
mhackethal
9e06f02e27
Update user_test.rb
adjust expectation of methods to be "nil" on windows
2019-09-13 13:14:34 +02:00
Miah Johnson
008ac9705b
Merge pull request #4484 from timgates42/feature/typo_becuase
Fix simple typo: becuase -> because
2019-09-12 17:25:37 -07:00
Tim Gates
f1e88ca65f
Fix simple typo: becuase -> because
Obvious Fix.
2019-09-13 09:30:00 +10:00
Clinton Wolfe
8132aaf85c
Merge pull request #3844 from inspec/ja/add-error-output-to-json-command
json resource: Add handling for `command:` error
2019-09-11 11:12:26 -04:00
Ryan Davis
a2b6517f9a skip a test when on windows
(and make it more compatible for when it does work)

Blocked by #4465.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-10 14:19:42 -07:00
Ryan Davis
fcfcc354fe Reworked test cases and impl to only respond to output, not exit code.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-10 14:19:42 -07:00
Ryan Davis
dfce5e722f
Merge pull request #4427 from inspec/cw/waivers-overlay
waivers: functional test fixture and eval-time skipping
2019-09-09 18:41:37 -07:00
Ryan Davis
f5bbfe5fac
Merge pull request #4365 from inspec/zenspider/the-need-for-speed
Make inspec much faster for most commands.
2019-09-09 18:02:10 -07:00
Jerry Aldrich
0e1b3fa65a json resource: Add handling for command: error
This provides the user with messages if `json(command: 'command_that_errors')`
exits non-zero and/or has STDERR.

Without this the resource will report "No output from command" when really the
output is contained in STDERR.

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-09-09 15:16:34 -07:00
Ryan Davis
79b9c3cbad
Merge pull request #4451 from inspec/zenspider/fix-tarball-decoding
Try to decode archive contents to UTF-8 to avoid encoding corruption.
2019-09-09 11:13:48 -07:00
Clinton Wolfe
43bc7e0343 Modify @__skip_rule to distinguish only_if and waiver, and force waiver to win
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-09-09 11:29:26 -04:00
Clinton Wolfe
0db0a2bfdc Don't assume waiver_ prefix in waiver files
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-09-09 11:29:26 -04:00
Clinton Wolfe
718e205cf2 Alter expiration_date behavior to match spec
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-09-09 11:29:26 -04:00