Commit graph

1801 commits

Author SHA1 Message Date
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
3c266655ee Refactor exec-json functional tests to reduce subprocesses
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-10-08 21:04:58 -07:00
Clinton Wolfe
ba61cd3f45 Update JSON schema to reflect new waiver keys
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-10-08 21:01:19 -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
7516f959d1 If there is no data, alwaya return an empty hash.
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-10-08 00:31:23 -07:00
Clinton Wolfe
56c2416c57 Move waiver JSON data from per-result to per-control
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-10-08 00:25:06 -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
e070f151b9
Merge pull request #4557 from inspec/zenspider/rspec-expectations
Fixed tests to work with rspec-expectations 3.8.5+.
2019-10-03 12:51:08 -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
d1fbbada4d Yet another bump of our skip_windows! due date.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-30 12:23:15 -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
fd1ab6fff0
Merge pull request #4513 from inspec/zenspider/plugin_loader
Fixed Inspec::Plugin::V2::Registry#detect_system_plugins
2019-09-26 12:29:29 -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
Ryan Davis
90c4904a55
Merge pull request #4490 from inspec/zenspider/split-long-functional
Split and parallelize some tests to make them faster
2019-09-24 17:45:57 -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
fc1ad67ffc More parallelization for functionals.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-17 11:50:31 -07:00
Ryan Davis
a473a94303
Merge pull request #4493 from inspec/mj/waiver3
Waivers Phase 3
2019-09-16 17:50:02 -07:00
Ryan Davis
d3f81f1194 Turn on parallelism for inspec_shell_test.rb
Seems safe after several runs.

Takes the time down from ~180s to 22s.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-16 17:19:32 -07:00
Ryan Davis
ba462724db Turn on parallelism for inspec_exec_test.rb
Seems safe after several runs.

Takes the time down from ~275s to 35s.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-16 17:19:32 -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
1d3c9341ec Finished up the phase 3 waiver json output tests.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-16 16:39:34 -07:00
Miah Johnson
5d94b0d709 Add waiver_data to json output, update assertion to show where waiver_data lives.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-09-16 14:49:05 -07:00
Miah Johnson
168c77e472 Refactor tests.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-09-16 14:49:05 -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
mhackethal
7ac468df5b first test. Signed-off-by: mhackethal <mh@it31.de> 2019-09-12 21:44:13 +02: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
5d94440823 Fix logic error for future expiring waivers
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-09-09 11:29:26 -04: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
Clinton Wolfe
ff209b4bae Refactor control_id lookup in waiver test file
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-09-09 11:29:26 -04:00
Clinton Wolfe
eb1ec437d7 Linting and test number corrections
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-09-09 11:29:26 -04:00
Clinton Wolfe
5891c9aee9 A failing functional test to skip waivered controls
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-09-09 11:29:26 -04:00
Clinton Wolfe
77b4e45175 Test fixture profile and input file for waivers
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-09-09 11:29:26 -04:00
mhackethal
6772f0b301
Update user_test.rb 2019-09-06 11:42:51 +02:00
Ryan Davis
d19d0bfd7c Refactor tests for TarProvider and ZipProvider a bit.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-06 00:42:36 -07:00
Ryan Davis
6e821e787e Save off supports[:os] and restore it after each test.
This fixes some other tests that require supports[:os] to be correct.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-04 15:44:26 -07:00
Ryan Davis
6296fdc688 Replace backticks in test descriptions with single-quotes.
Backticks means you can't selectively run one of these tests w/o
subshelling out to `brew`, or having to edit first.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-04 15:44:26 -07:00
Ryan Davis
3b69967cc8 Fixed a bug in checking supports (strings vs symbols)
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-04 15:44:26 -07:00
Ryan Davis
b6bfeffd9e Make inspec much faster for most commands.
Removes pre-loading and registration of resources by adding
method_missing to a couple key areas.

This still drops the ball in some areas, but it is a start.
2019-09-04 15:44:26 -07:00
Lance Albertson
1e94e3503e Fix for postfix_conf when using a non-standard config location
Pass the first argument of the opts array instead of the whole array which
confuses the SimpleConfig parser. Also added a test which verifies this fixes
the issue.

In addition, change the base_name to something that matches other resource base
names.

Signed-off-by: Lance Albertson <lance@osuosl.org>
2019-09-03 15:28:44 -07:00
Ryan Davis
49330e8a8e Extended skip_windows to the end of September.
This is getting depressing...

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-03 12:08:41 -07:00
kekaichinose
d33870b635
Merge pull request #4214 from inspec/zenspider/fix_nil_file
Fixed file resource raising UndefinedMethod on source_path
2019-08-30 13:19:54 -07:00
mhackethal
204c41bfd1 Update users.rb to include new attributes 2019-08-30 22:07:36 +02:00
Clinton Wolfe
a6bd7ec4b5
Merge pull request #4401 from inspec/cw/input-from-cli
inputs: Accept bare input from the command line
2019-08-28 15:41:21 -04:00
Clinton Wolfe
51de566d93 Assert adjustments
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-28 13:25:49 -04:00
Clinton Wolfe
82acec957e Add API for fetching plugin vconfig values.
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-28 13:25:49 -04:00
Clinton Wolfe
38f3469ee3 Validation for the plugins area of the config file
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-28 13:25:49 -04:00
Clinton Wolfe
c6d355e4f7 Accept version 1.2 for config file format
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-28 13:25:49 -04:00
Clinton Wolfe
e346b16114 Tighten help listing assertion and adjust chomp
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-28 13:03:42 -04:00
Clinton Wolfe
296158c447 Implementation and functional tests for the --input CLI option
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-28 13:03:42 -04:00
Clinton Wolfe
512189a06b Add CLI option and check in help
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-28 12:53:27 -04:00
Clinton Wolfe
777f1a1bff Adjust checking for version when installing latest in unit test
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-27 21:29:42 -04:00
Clinton Wolfe
18640dd70c We do now include the version in the float fixture, for one thing
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-27 21:29:42 -04:00
Clinton Wolfe
16fecbefb5 Return version number when listing plugins; correct UX coloration
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-27 21:29:42 -04:00
Clinton Wolfe
f90a4c633d
Merge pull request #4419 from inspec/cw/check-enforce-version
inspec check: warn if inspec_version is not supported by current inspec
2019-08-27 20:03:19 -04:00
Clinton Wolfe
c6f33b3526 Add functional test for inspec check with runtime constraint
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-26 23:19:18 -04:00
Clinton Wolfe
714dc26006 Add unit test and include runtime version check in metadata.valid
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-26 23:05:49 -04:00
Clinton Wolfe
424318defa Stringify expected test outcomes for inputs
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-26 14:56:39 -04:00
Clinton Wolfe
f59497d982 Don't open a new train connect, and make an issue for improving helper support
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-26 13:12:30 -04:00
Clinton Wolfe
fffb776982 Add newline
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-22 21:53:02 -04:00
Clinton Wolfe
d462ac3de5 Convert runner api script layout ot heredoc
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-22 21:51:50 -04:00
Ryan Davis
1dd1efa03f test change for bad resource/backend combo.
I think this is probably in contention with my other PR on resource
initialization. We definitely need to change that, so this might fall
to the side. Or maybe just the test needs to be redone. We'll discuss
and see.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-08-20 13:25:21 -07:00
Ryan Davis
7273a7380f Fixed file resource raising UndefinedMethod on source_path
This is a first pass at fixing the failure found by @scottvidmar where
file resource was raising undefined_method on nil. The problem was
that the initialize method for file was not being called at all
because Resource#initialize was returning early without reporting
anything.

This fix causes a failure in test/functional/inspec_exec_test.rb where
it is testing a similar scenario but for some reason the unsupported
resources get reported. We need to figure that part out, but in the
meantime this will at least report an error at the root cause rather
than down the road.

Fixes #4208

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-08-20 13:25:21 -07:00
Clinton Wolfe
1f49ae4046 Skip runner API tests on windows
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-19 18:15:50 -04:00
Clinton Wolfe
cc4aa16212 Add test framework to run Runner API input tests
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-19 13:51:51 -04:00
Clinton Wolfe
8dc350bc6c
Add a Postfix-specific configuration testing resource (#4378)
Add a Postfix-specific configuration testing resource
2019-08-19 12:38:17 -04:00
Ryan Davis
4b3f11697d Removing ParallelTest so as to not encourage anyone from using it.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-08-09 16:17:13 -07:00
Ryan Davis
1266a65f28 Moved the osx? guard below minitest/autorun.
I didn't hit this because I use `minitest` to run my tests, not `m`.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-08-09 16:16:26 -07:00
David Gasper
ee2806a342 Fix RuboCop issues
Signed-off-by: David Gasper <dmgasper@osuosl.org>
2019-08-08 14:32:19 -07:00