Commit graph

407 commits

Author SHA1 Message Date
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