Commit graph

602 commits

Author SHA1 Message Date
Vasu1105
b4d319610a Fixing test cases
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-03-19 16:10:11 +05:30
Vasu1105
b984bbe960 Fixes #5215 : When we are using --controls option it was also evaluating the control block of not included controls in the controls option as it was filtering the controls from the list after evaluating updated the logic so that it gets evaluated after filtering. Removed filter_controls methods as no more using that
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-03-19 16:10:11 +05:30
Vasu1105
89e994c4b3 Fixed test file for syntax issues
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-03-19 16:10:11 +05:30
Vasu1105
e1e10732ae Revert "Updated test to match the exact string"
This reverts commit 2048c4dff6689342cd7ef42ea9ba98a4c6715723.
2021-03-19 16:10:11 +05:30
Vasu1105
75ca22c3ce Updated test to match the exact string
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-03-19 16:10:11 +05:30
Vasu1105
6853f6450e Added test to catch the control execution issue while using controls option
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-03-19 16:10:11 +05:30
Nick Schwaderer
cbe105bbe0 Handles edge cases for parallelization
Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
2021-03-16 15:41:55 -04:00
Nick Schwaderer
4c03ad4c55 Support 'clear_cache'
Helps with Customer Bug 236 (see there for repro)

Currently, when we run `inspec compliance upload my_profile` it is
cached locally in inspec when run. If we update the version in the core
code and run another upload, `inspec compliance upload my_profile` again
it will run the old cached version instead of running a new copy
from automate.

The current workaround is to specify the desired version with
`inspec exec compliance://my_profile/admin#0.1.1`.

The caching happens before we have forward sight into the profile's
contents and only the target name. So the text used to generate the
cache would be `compliance://my_profile/admin` which does not change
version to version.

A fix here could simply identify when we are doing a local `inspec exec
compliance://` (hitting local profiles does not generate a cache) and
skips the cache if there's no version specified. That would eliminate
the unexpected behavior. However, it is a breaking change for customers
as some current caching taking place would no longer take place.

Instead, we have included a `clear_cache` cli method for InSpec,
which should assist the core team and other developers in the future
when debugging edge case issues in InSpec.

Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
2021-03-16 15:41:55 -04:00
Alexander Stein
351a943b35 Put back passthrough automate reporter output.
Signed-off-by: Alexander Stein <astein@flexion.us>
2021-03-15 13:17:54 -04:00
Alexander Stein
6748c1d704 Clean up whitespace issues. 2021-03-15 11:54:23 -04:00
Alexander Stein
dbda2b8694 Merge branch 'master' of https://github.com/inspec/inspec into issue-3181-json-reporter-passthrough-data 2021-03-11 22:04:13 -05:00
Alexander Stein
827ce32eec Add passthrough tests to json reporter. 2021-03-11 22:03:50 -05:00
Alexander Stein
a75241fe1d More test cleanup. 2021-03-09 23:37:10 -05:00
Alexander Stein
8a017d5fd4 Remove passthrough test from json-automate. 2021-03-09 23:29:12 -05:00
Vasu1105
216306a219 removed unwanted README files from test fixtures and fixed some minor copy paste test
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-03-05 16:29:30 +05:30
Vasu1105
7dba4fa641 Fixes #5373 : Add option to filter empty profiles from report
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2021-03-04 22:09:48 +05:30
Clinton Wolfe
b07b85f582 Failing test case for deep skip_control issue 5300
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2021-02-16 17:59:14 -05:00
Clinton Wolfe
0cad164371
Truncate code_desc when truncating reports (5372) 2021-01-06 11:06:49 -05:00
Clinton Wolfe
8c62c5ea69 Add failing tests to truncate code_desc when reporter message truncation is used
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2021-01-05 18:09:51 -05:00
David Marshall
874ee77791 add test for when run is not specified in waiver
The existing documentation explicitly claims that not specifying “run” in a waiver is equivalent to specifying “run: false.” It turns out to be the case that the claim is completely false. This commit includes a test for a new control 18_waivered_no_expiry_default_run that behaves exactly like the control 04_waivered_no_expiry_ran_fails. That is, not specifying run in a waiver is the same as specifying “run: true.”

Signed-off-by: David Marshall <dmarshall@gmail.com>
2020-12-28 16:26:19 -08:00
Clinton Wolfe
cdfb325ca3 Apply chefstyle -a, and manually remove duplicate requires
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-12-21 13:25:04 -05:00
Clinton Wolfe
fcadb9792f Update functional tests to work with rspec 3.10+
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-12-21 12:24:24 -05:00
Nick Schwaderer
345a832eb1 Supply resource name, params to code_desc
Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
2020-11-19 09:59:53 +00:00
Nick Schwaderer
1f0bcd988f
Merge pull request #5278 from inspec/ns/waiver_message
Ensure that we populate information about waiver expiration regardless of `run: true/false`
2020-10-19 10:41:05 +01:00
Nick Schwaderer
4c4bfe0426 Update tests to handle waiver expiration message
Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
2020-10-14 12:55:39 +01:00
James Stocks
db5f6a1615 Tidy --help output slightly
Give `exec` a short description in the main help output. Hide the option to disable core plugins.

Signed-off-by: James Stocks <jstocks@chef.io>
2020-09-25 13:02:16 +01:00
James Stocks
7576ad8ff5 Add Chef patent URL to --help
Fixes #5248

Signed-off-by: James Stocks <jstocks@chef.io>
2020-09-25 13:02:16 +01:00
Clinton Wolfe
6e7e05e6b6 Adjust expected error count
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-09-22 11:40:01 +01:00
Clinton Wolfe
b3f72f5854 Implement a corrected junit2 reporter that can be validated
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-09-22 11:40:01 +01:00
Clinton Wolfe
c602e53910 Update test to remove some skips due to outdated fixture
The tests depended on an old fixture profile that skipped a test,
which no longer happens. It also was targeting a test that does not exist.

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-09-22 11:40:01 +01:00
Clinton Wolfe
955ab36922 Update junit tests to use nokogiri
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-09-22 11:40:01 +01:00
IanMadd
c1da4f64c4 Updating links to inspec docs in ruby scripts
Signed-off-by: IanMadd <imaddaus@chef.io>
2020-09-14 14:09:30 -07:00
Nick Schwaderer
1a1205c729 Fixes many of the old skip_windows instances
Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
2020-09-14 15:55:10 +01:00
Clinton Wolfe
a839d4602c Add ability to sort results in reporting phase
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-08-10 14:32:08 -04:00
Clinton Wolfe
3aca12d622 Add option to suppress diff output
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-08-10 14:31:28 -04:00
Clinton Wolfe
ceca77e118 Mark inputs as sensitive
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-08-10 14:30:11 -04:00
Nick Schwaderer
d8b06560a1 Ensure truncate message only returns on truncated values
At the moment we return the "Truncate" text whenever the setting is
utilized. This PR ensures that we only advise truncation when it's been
executed.

Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
2020-07-29 09:50:25 +01:00
Nick Schwaderer
2744ff43e5
Merge pull request #5128 from james-stocks/js/report_bad_profiles
Report faulty profiles instead of crashing
2020-07-15 13:28:17 +01:00
James Stocks
833aac3ef1 Add profile load failure message to CLI reporter
Signed-off-by: James Stocks <jstocks@chef.io>
2020-07-09 14:02:42 +01:00
Nick Schwaderer
6d340b323c Allow ‘=‘ character in CLI inputs
Fixes #5131

Due to the use of `#split(‘=‘)` against inputs supplied via the CLI we had an edge case where inputs with `’=‘` in the value would cause a breakage.

This PR supplies a test for the regression and fixes the bug with a regex solution.

Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
2020-07-09 12:50:21 +01:00
James Stocks
08398cc3c1 Address linting mistakes.
Signed-off-by: James Stocks <jstocks@chef.io>
2020-07-03 15:53:09 +01:00
James Stocks
fd4c501c70 Change profile skip_message to status_message
Keep a duplicate of the message in skip_message for the JSON reporters, for backwards compaibility.

Signed-off-by: James Stocks <jstocks@chef.io>
2020-07-03 15:53:09 +01:00
James Stocks
41087c5ec6 Set profiles that fail to load as failed
Signed-off-by: James Stocks <jstocks@chef.io>
2020-07-02 13:33:07 +01:00
Nick Schwaderer
480567564b Review skip_windows violations and expiration
We have 72 `skip_windows` that need addressing. This PR removes
confirmed instances where the tests now work on windows. It also marks
tests with a comment where they are confirmed to still break. Unmarked
instances still need review.

It also updates the `skip_windows` expiration date.

72 `skip_windows` needing resolution OR alternative documentation upon investigation

Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
2020-07-02 11:53:38 +01:00
Nick Schwaderer
dca57b61c0
Merge pull request #4907 from inspec/cw/telemetry-run-context
Telemetry - determine run context from stack introspection
2020-06-17 18:17:09 +01:00
Clinton Wolfe
09bbc7e2e7 Remove a ruby expression-based test
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-06-05 17:40:49 -04:00
Clinton Wolfe
925363766e Document and test to verify that it skips resources in describe blocks
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-06-05 17:40:49 -04:00
Clinton Wolfe
f39cf8c904 Tests to exercise only_if functionality
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-06-05 17:39:54 -04:00
James Stocks
d5f825e716
Merge pull request #5026 from inspec/cw/silence-deprecations
CLI Option to silence deprecations
2020-06-05 14:10:50 +01:00
Nick Schwaderer
fb1aeb0655
Merge pull request #5011 from inspec/cw/complex-cli-inputs
Boolean, Numeric, and Structured CLI inputs
2020-06-05 04:23:48 -07:00
Clinton Wolfe
88da919558 Fix exit code check for windows
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-25 23:27:00 -04:00
Clinton Wolfe
439c93b115 Add a functional test to check Thor run context detection
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-25 21:00:24 -04:00
Clinton Wolfe
dcc70bc541 Trim log message, make boolean check case insensitive
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-23 00:25:08 -04:00
James Stocks
32fa14f1b0
Merge pull request #5039 from james-stocks/js/issue_5037
Allow for waiver time as well as date
2020-05-22 16:52:23 +01:00
James Stocks
23ed9bcf06
Merge pull request #5007 from inspec/cw/reporters-as-plugins
Reporters as Plugins
2020-05-22 16:10:29 +01:00
James Stocks
350c0bfe8f Handle waiver expiration dates being YAML strings
This is technically incorrect YAML, but if you transcode YAML between several tools you may end up with a date/time value being an explicit string.
It would be helpful if InSpec supported any string value that easily translates to a Time.

Signed-off-by: James Stocks <jstocks@chef.io>
2020-05-20 15:00:43 +01:00
James Stocks
35e36ad40a Allow for waiver time as well as date
Fixes #5037

The YAML parser may parse a waiver timestamp as a Time rather than a Date. Even when the user doesn't care about time, they may be using a tool that outputs YAML with trailing zeroes for hour, minutes, seconds etc.

Signed-off-by: James Stocks <jstocks@chef.io>
2020-05-20 14:59:07 +01:00
Nick Schwaderer
989d86c2ce Stores output of inspec json to archive and artifact
Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
2020-05-20 12:34:17 +01:00
Clinton Wolfe
6a59618d2b Add a failing test case for silencing deprecations
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-13 22:45:58 -04:00
Clinton Wolfe
ee095a244a Soften the exception to a warning when the input is not parseable
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-07 10:47:57 -04:00
James Stocks
ba99226baf Remove TODO Windows skip
I removed the skip to see what would break, and on my Windows laptop
these tests pass OK. The TODO didn't explain what wasn't applicable to
Windows, so I'm just going to remove it.

Signed-off-by: James Stocks <jstocks@chef.io>
2020-05-07 14:01:32 +01:00
James Stocks
1510ff1078 Remove Windows skip from test/functional/inspec_exec_jsonmin_test.rb
Signed-off-by: James Stocks <jstocks@chef.io>
2020-05-07 13:16:22 +01:00
James Stocks
2103b52dbe
Merge pull request #4994 from james-stocks/js/json
Reporter options to truncate message and suppress stacktrace
2020-05-07 12:54:34 +01:00
Clinton Wolfe
12f3f313cb Don't try to test JSON input under powershell
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-06 16:33:50 -04:00
Clinton Wolfe
786e3728d7 Failing tests for #4799
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-05 18:09:11 -04:00
Clinton Wolfe
970f583764 Tighten up tests
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-05 17:59:50 -04:00
Clinton Wolfe
c683c4d64d Failing test cases for 4963
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-05 17:37:23 -04:00
Clinton Wolfe
824018efa3 Failing test cases for #4977
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-05 17:37:23 -04:00
Clinton Wolfe
5a7a48bb62 Basics of a working reporter plugin system
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-05 16:51:31 +01:00
Nick Schwaderer
a1129f9efc Allows input and control to have the same name
In https://github.com/inspec/inspec/issues/4936 the issue was reported that naming an input the same as a control caused an unexpected failure.

In that particular case, the naming was a result of a pre-waivers workaround which is no longer necessary, but ultimately a breakage of that name clash is an unexpected occurrance.

Due to how inputs are named and registered, `__apply_waivers` thinks that an object is a waiver that is not a waiver and tries to process it. On the micro level, it breaks when trying to pass a variable to a string as if it were a Hash.

It is imperative that we preserve 100% of the current featureset, pass our tests, and fix this edge case along with new test coverage for the failure.

This PR updates the code to do a slightly more elegant and small ‘waiver check’ to stop the namespace clash from breaking our code.

Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
2020-05-05 10:00:19 +01:00
James Stocks
69fb6e0782 Move reporter option handling to base
They don't need to be json specific, they should apply to any reporter if the user has chosen these settings.

Signed-off-by: James Stocks <jstocks@chef.io>
2020-05-04 15:24:50 +01:00
James Stocks
ae66aee2b2 (WIP) Reporter options to truncate message and suppress stacktrace
TODO: Option names are not JSON specific but only json reporter has been implemented.

Signed-off-by: James Stocks <jstocks@chef.io>
2020-05-04 15:24:50 +01:00
Clinton Wolfe
58e8bc5167 Divide tests into undeclared and required groups
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-04-24 16:38:11 -04:00
Clinton Wolfe
a12dfcfdc0 Add a failing test case for 4769
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-04-24 13:57:28 -04:00
Clinton Wolfe
a38100a185 Update GCP and azure tests to reflect no-creds errors as seen on CI server
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-03-02 14:32:12 -05:00
Clinton Wolfe
2d9c443a04 Add functional tests that try each of the cloud resource packs with bad creds
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-02-26 14:41:38 -05:00
Miah Johnson
7bb0bb2188
Merge pull request #4865 from inspec/jh/schema-improvements
Jh/schema improvements
2020-02-10 18:38:28 -08:00
Miah Johnson
4f642e0942 Clean up schema PR.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2020-02-05 17:06:55 -08:00
Jacob Henry
724f82237b Revision of schema to JSON Schema draft 7
Signed-off-by: Jacob Henry <jchenry@mitre.org>
2020-02-05 17:05:47 -08:00
Ryan Davis
99f86c8a0b These tests don't pass on a network cafe and just hang forever.
Changing to localhost resolves immediately but assumes you're NOT
running a git server on http locally.

This seems more valid to me than assuming you know how DNS is going to
resolve everywhere.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-02-03 13:18:56 -08:00
Ryan Davis
a3060c4ca8
Merge pull request #4860 from inspec/cw/win-func-input-tests
Remove skips from windows testing in 'inputs' and 'archive' functional tests
2020-01-31 17:51:36 -08:00
Ryan Davis
c70f73dc96
Merge pull request #4864 from inspec/zenspider/resource/inspect
Added --inspect option to inspect shell command.
2020-01-31 16:42:00 -08:00
Ryan Davis
8bd2528ef8 Added --inspect option to inspect shell command.
* Removed Resource#inspect (calling to_s) to make debugging a happy experience.
* Added ResourceBehavior.toggle_inspect to add/remove a basic inspect.
* Added `--inspect` flag to `shell` command. Call toggle_inspect unless --inspect used.
* Cleaned up matchers.rb and removed most explicit calls to inspect.
* Added ResourceInspector to rspec's INSPECTOR_CLASSES.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-01-28 14:52:04 -08:00
Clinton Wolfe
3d5226fb68 Q-quote the args to the train plugin
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-28 13:48:10 -05:00
Clinton Wolfe
28f8d6cc5f Removing skip in archive test just seems to work, too
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-28 12:24:29 -05:00
Clinton Wolfe
6290ee0190 Just remove skips, it seems to work
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-28 11:57:25 -05:00
Clinton Wolfe
ef9ef919fc Linting
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-03 14:15:05 -05:00
Clinton Wolfe
3e3398ff29 Switch to using tmpdir option during testing to avoid rm calls
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-03 14:15:05 -05:00
Clinton Wolfe
ba4fa9832c parallelize fetcher tests, conditionalize automate fetcher
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-03 14:15:05 -05:00
Clinton Wolfe
913c066be9 Test fixture and functional test for compliance fetcher
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-03 14:15:05 -05:00
Clinton Wolfe
82ae3b5fa1 Test fixtures and functional test for local fetcher
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-03 14:15:05 -05:00
Clinton Wolfe
ed209643f3 Test fixture for url fetcher
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-03 14:15:05 -05:00
Clinton Wolfe
928cf6f05e Functional test and fixtures for git fetcher fallback
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-03 14:15:04 -05:00
Ryan Davis
04581d2270
Merge pull request #4771 from inspec/zenspider/rspec-3.9
Bump rspec to 3.9 and fix broken tests.
2019-12-09 12:09:32 -08:00
Ryan Davis
f67171fa6b Bump rspec to 3.9 and fix broken tests.
Tests are STILL brittle, but this at least lets us drop old rspec.

Fixes #4575

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-12-06 16:52:35 -08:00
Clinton Wolfe
b34d489f5c Add .invalid TLD to test hostanmes
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-12-04 13:32:58 -05:00
Clinton Wolfe
6b0877591f Refactor functional test to DRY up
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-12-04 13:32:19 -05:00
Clinton Wolfe
8679443698 Functional test for git fetcher failure handling
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-12-04 13:32:19 -05:00
Clinton Wolfe
c1d1e6d12f functional test for URL fetcher
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-12-04 13:32:19 -05:00
Clinton Wolfe
0ddf1687f5 A functional test for the local fetcher
I hate to do this, but unit testing this reveals odd behavior
in the fetcher - fetching in a unit harness appears to always succeed.
I'd like to make this into a unit test, but for now I want to focus on
the fetchers.

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-12-04 13:30:08 -05:00
Ryan Davis
865e0d43c0 Fixed a race condition in the tests on windows.
Second test would always fail, resumably because the GC kicks in and
the tempfile gets obliterated before the subprocess can read it.

Don't do tempfiles via let. Do them via ivars so they can persist.
2019-11-12 14:51:56 -08:00
Ryan Davis
efc51c44d9 Fixes to get inspec_exec_test.rb green on Windows. 2019-11-12 14:51:56 -08:00
Ryan Davis
f8ea33de8f Added test command caching and refactored inspec helper to run_cmd.
Helps with some of the tests that want to run ruby directly.

Fixes #4416.
2019-11-12 14:51:56 -08:00
Ryan Davis
bb7e69d145 Fixes for some of the inspec exec tests under Windows. 2019-11-12 14:51:56 -08:00
Ryan Davis
4242937bea Changed a bunch of profiles to use / instead of /tmp for Windows compat. 2019-11-12 14:51:56 -08:00
Ryan Davis
d1f67c02d0 Get the license_tests passing
...mostly by skipping

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-12 14:51:56 -08:00
Ryan Davis
e60dc84188 Cleaned up inspec artifact testing.
Removed redundant test/functional/inspec_artifact_test.rb
Cleaned up lib/plugins/inspec-artifact/test/functional/inspec_artifact_test.rb
Made an error on windows (install-profile fails) raise instead of just print.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-12 14:50:39 -08:00
Ryan Davis
c3fe1697bb Fix the way we determine (and clean) the repo_path in functionals.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-12 14:50:39 -08:00
Ryan Davis
ee327094fb Strip all ANSI color codes from output in inspec_shell_test.rb
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-12 14:50:39 -08:00
Ryan Davis
b3b8336620 Get inspec_exec_test.rb passing on windows w/o skips.
+ Clean up lockfiles in profiles. (we shouldn't be creating these!)
+ Fix some exit code assertions based on platform.
+ Had to skip 2 tests (with timebombs) because this is rebased off of my performance branch which has 2 failures.

signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-12 14:50:39 -08:00
Ryan Davis
bfc8b357bf Clean up testing in inspec exec by stripping ansi color codes from output.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-12 14:50:39 -08:00
Ryan Davis
b1c2af209b Corresponding fixes for the move from test/unit/mock to test/fixtures.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-08 19:20:12 -08:00
Ryan Davis
244c7bbed4
Merge pull request #4677 from inspec/zenspider/bump-chefstyle
Bump chefstyle and fix up flagged code.
2019-11-08 16:07:42 -08:00
Ryan Davis
bb49d58cd9 Switched chefstyle back to Layout/AlignArguments=with_first_argument.
Fixed the flags mostly with `chefstyle -a` but also refactored/cleaned
some stuff by hand.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-08 12:57:43 -08:00
Clinton Wolfe
c045de4399 Temporarily add functional test for input in describe.one in isolated commit
As there is a team desire to move away from functional tests,
this commit is intended to be easily reverted once a facility for
running test fixture policies as unit tests in a clear way.

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-11-01 16:52:21 -04:00
Ryan Davis
d201d1fbc2 Fixed the rest of the minitest deprecations by removing FuncTestRunResult.
Folded the json & other payloads into plain ivars on the test.
Found and removed some unused code while I was there.

Fixes #4533.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-22 12:15:28 -07:00
Ryan Davis
8d4e8c1d96
Merge pull request #4627 from inspec/zenspider/json-and-resource-cleanup
JSON processing and resource cleanup
2019-10-21 14:26:37 -07:00
Ryan Davis
e5e1a745cc Fixed run_inspec_with_plugin to merge run options properly.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-21 13:30:14 -07:00
Ryan Davis
b626c37386 Improve debugging of json parse failures in functional tests.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-21 13:30:14 -07:00
Ryan Davis
fdaea02427 Clean up testing in inspec exec by stripping ansi color codes from output.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-21 12:46:37 -07:00
Miah Johnson
23f31a0a72 Use a good profile with inspec check test
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-17 14:55:58 -07:00
Miah Johnson
6f460b9c3b Remove this. It slows things down.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-16 20:57:31 -07:00
Miah Johnson
4ec9f302b0 example -> example.tmp
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-16 10:15:49 -07:00
Miah Johnson
c3eb686b51 Remove debug
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-16 10:15:49 -07:00
Miah Johnson
301905e8de b0rk b0rk
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-16 10:15:49 -07:00
Miah Johnson
41bc8fd7a0 Clean up some tests
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-16 10:15:49 -07:00
Miah Johnson
ae3ee6f657 Finish rename of example -> example-tmp.rb
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
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
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
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
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
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
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
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
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
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
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