Commit graph

1755 commits

Author SHA1 Message Date
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
David Gasper
52ae5e434b Add docs and unit tests, remove .travis.yml
Signed-off-by: David Gasper <dmgasper@osuosl.org>
2019-08-08 13:54:35 -07:00
Clinton Wolfe
95e6bcb317
Modified DarwinGroup to collect all users properly. (#4343)
group resource: Modified DarwinGroup to collect all users properly on macos
2019-08-08 11:55:48 -04:00
Clinton Wolfe
c28dd8f9ec
Add startuser windows service (#4363)
Add startuser windows service
2019-08-08 11:32:39 -04:00
Ryan Davis
374e365c02 Modified DarwinGroup to collect all users properly.
I noticed that my profile targeting group "staff" on OSX wasn't
returning *me*. I'm awesome! So that seemed wrong. And it turns out it
is wrong. We were not collecting any users whose primary group was
that group. (almost all regular users are in group staff and they're
all missing).

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-08-07 20:27:13 -07:00
Mendy Baitelman
4d990865a1 Add to mock_loader
Signed-off-by: Mendy Baitelman <mendy@baitelman.com>
2019-08-06 19:44:02 -07:00
Mendy Baitelman
988357aad1 Fix tests
Signed-off-by: Mendy Baitelman <mendy@baitelman.com>
2019-08-06 18:58:03 -07:00
Ryan Davis
d295455df6 Fix license functional tests when run on buildkite.
BK currently runs our tests on ruby:X.Y-stretch docker images, which
use root. This puts license files it /etc/chef instead of the current
user's home and broke our tests.

This adds cleanup to /etc/chef AND checks both locations, so it should
continue to work even if we switch to docker images with non-root users.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-08-06 15:50:01 -07:00
Ryan Davis
55f2747ee1 Remove timebombs from 2 functional license tests.
These were put in place because they pass locally and fail on
buildkite. We didn't care at the time, but now we should investigate.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-08-06 15:02:37 -07:00
Ryan Davis
b570e0cc74 Bump skipped license tests until 8/16.
I've got this under debug in docker but this is a problem on the
license_acceptance gem on BK, not with inspec. And it is blocking a
release, so I'm bumping this out 2 weeks.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-31 16:44:49 -07:00
Ryan Davis
99638d8de9 Remove timebomb on skip_until.
It has been valuable and should push up to minitest.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-31 12:24:57 -07:00
Clinton Wolfe
88898ce7a9 Linting
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:42:24 -04:00
Clinton Wolfe
f00e741999 PR feedback
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:38:02 -04:00
Clinton Wolfe
c03862fe7b Code climate updates
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:38:02 -04:00
Clinton Wolfe
4f6d296a22 The error case in which the path does not exist
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:38:02 -04:00
Clinton Wolfe
860d21a370 Test for ./
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:38:02 -04:00
Clinton Wolfe
31bedf7b37 Empty-string edge case
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:38:02 -04:00
Clinton Wolfe
fab58b590e Combo relative test in place
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:38:02 -04:00
Clinton Wolfe
e9ef8e25a3 Deep dependency works
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:38:02 -04:00
Clinton Wolfe
80241ec971 Passing basic test harness
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:38:02 -04:00
Clinton Wolfe
c257763de6 Linting
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:38:02 -04:00
Clinton Wolfe
aa81012013 Rework tests to be fixture-based, not generated per-run
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:38:02 -04:00
Clinton Wolfe
12fcb24932 Experiment with git subrepo storage
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:36:20 -04:00
Clinton Wolfe
0e32d2429f Rename path_within_repo option to relative_path
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:36:20 -04:00
Clinton Wolfe
f1a892c857 Move existing git fixture profile to a directory for git-fetchers
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:36:20 -04:00
Clinton Wolfe
9c1fa967fd Rename profile_path to path_within_repo
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:36:20 -04:00
Jerry Aldrich
3e1d08cafe Add support for relative paths to the Git fetcher
This adds support for specifying a path to a profile in a Git repo.

For example, you could have a Git repo containing multiple profiles and
you want to specify a single one like below:

```yaml
depends:
  - name: profile-1
    git: https://github.com/myorg/all-my-profiles.git
    profile_path: profiles/my-specific-profile-1
  - name: profile-2
    git: https://github.com/myorg/all-my-profiles.git
    profile_path: profiles/my-specific-profile-2
```
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-07-30 13:36:20 -04:00
Ryan Davis
2d5fdabf86
Merge pull request #4337 from inspec/zenspider/remove-version-checking
Removed lib/inspec/utils/latest_version.rb and associated code.
2019-07-29 12:47:37 -07:00
Ryan Davis
3d6a4143a1 Removed lib/inspec/utils/latest_version.rb and associated code.
There is no reason why our tests should be failing because we deploy a
new version. That test shouldn't even be hitting the network for real.

Besides, the functionality has no place in our codebase. It's
functionality provided via `gem outdated` so why did we re-implement
it? And we expect most people to be running via omnibus, so they're
pinned to a specific version in the first place. Even if they updated,
they still couldn't run it and that would be more confusing.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-29 11:57:08 -07:00
Ryan Davis
1e2da6acc2 Moved another non-test to test/unit/mock/files
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-29 11:42:30 -07:00
Ryan Davis
4df8072665 These tests probably never passed.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-29 11:42:30 -07:00
Ryan Davis
be11d8898d Found more tests that we've probably never actually run.
*sigh*

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-29 11:42:30 -07:00
Clinton Wolfe
be91550343
windows_task: Fix handling of multiple triggers (#4242)
windows_task: Fix handling of multiple triggers
2019-07-29 13:00:16 -04:00
Ryan Davis
bcf3aa841c Skip failures from BK run.
Not sure why these failures come up in a unified run (versus my
running all test files separately). Might be test infection. Might be
environmental.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-24 18:59:01 -07:00
Ryan Davis
917a531a92 Skipped all failing tests on windows AT the failures site.
This activates a BUNCH of tests but keeps us green.

Whether these tests are valid or not is not being addressed here.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-24 18:09:08 -07:00
Ryan Davis
bd16b766fa Renamed do_shell_c to assert_shell_c to make failures point to the right place.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-24 18:06:25 -07:00
Ryan Davis
c6837a3915 Moved skip_windows! to top helper and extended date to end of next month.
Fixed up requires in v2/installer_test.rb so it sees the top helper.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-24 18:06:25 -07:00
Ryan Davis
6dfa1d8310 Um. No.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-24 18:06:25 -07:00
Ryan Davis
18ce4850f0 Initial pass to clean up functional testing wrt exit codes and output.
This should get windows tests running again? Hopefully? They're
running SO slowly on my vagrant box that I'm just pushing for now.
They're clean on the mac side.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-24 18:06:25 -07:00
Ryan Davis
bd79e9c895
Merge pull request #4316 from inspec/zenspider/fix-file-aws
Fix exceptions when resources are used with incompatible transports
2019-07-23 11:47:13 -07:00
Ryan Davis
7a1e1bb775
Merge pull request #4230 from yeoldegrove/sys_info
add resource sys_info.manufacturer and sys_info.model
2019-07-22 14:39:28 -07:00
Ryan Davis
7de549577c Return keys are really nice.
They make code more readable by visually separating different sections
of text.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-22 14:19:15 -07:00
Ryan Davis
d3df69213b Fix handling using resources with incompatible resources (eg file + aws).
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-22 14:19:15 -07:00
Ryan Davis
14c245eccb Refactoring inspec_exec_test.rb
+ Moved exit checks to be last.
+ Refactored the IO parts. WHY do the same thing over and over?!?

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-22 14:19:15 -07:00
Clinton Wolfe
12b577fccd linting
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-22 15:17:30 -04:00
Clinton Wolfe
b37d165878 Unit test for suppressing doc install
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-22 15:17:30 -04:00
Eike Waldt
da4168f83d
add darwin/OSX tests
Signed-off-by: Eike Waldt <waldt@b1-systems.de>
2019-07-16 21:53:19 +02:00
Eike Waldt
b47cf6e80e
change from dmidecode to /sys/class/dmi/id/*
(kudos to Seife)

Signed-off-by: Eike Waldt <waldt@b1-systems.de>
2019-07-16 21:53:03 +02:00
Eike Waldt
9c06a0c8e2
refactor tests for resource sys_info.manufacturer and sys_info.model
Signed-off-by: Eike Waldt <waldt@b1-systems.de>
2019-07-16 21:02:52 +02:00
Eike Waldt
9278d8109d
add tests for resource sys_info.manufacturer and sys_info.model
Signed-off-by: Eike Waldt <waldt@b1-systems.de>
2019-07-16 21:02:45 +02:00
Eike Waldt
474d70b78d
fix description on sys_info.hostname tests
Signed-off-by: Eike Waldt <waldt@b1-systems.de>
2019-07-16 20:39:38 +02:00
Ryan Davis
f5d0d93121 This should get buildkite green for now.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-15 20:34:59 -07:00
Clinton Wolfe
398e984a14 Push back timebomb by one month
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-12 13:10:38 -04:00
Clinton Wolfe
f4b9bc4b0b rework filtertable call and add rubocop exception
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-11 15:04:38 -04:00
Miah Johnson
a4f4fe5231 chefstyle -a; https://github.com/chef/chefstyle/pull/74
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-07-08 17:22:50 -07:00
Miah Johnson
dc0ef8421e chefstyle recent pr
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-07-08 13:39:46 -07:00
Miah Johnson
8272d0184b
Merge pull request #4236 from ramereth/ip6tables
Add ip6tables resource
2019-07-08 11:45:33 -07:00
Clinton Wolfe
e4e7c255de Automated chefstyle application for rubocop 0.72 compatibility
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-03 17:24:41 -04:00
Jerry Aldrich
5e93c4b12e Appease RuboCop
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-07-01 22:45:04 -07:00
Jerry Aldrich
dafa4f4165 Try to appease Code Climate
I...I don't know how to make it better.

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-07-01 22:39:12 -07:00
Jerry Aldrich
668b8d82bf windows_task: Fix handling of multiple triggers
When using `schtasks` a list is returned if the task has multiple
triggers. This merges that list with the last item taking precedence.
This is how `Get-ScheduledTask` behaves.

Initially, I was going to rewrite this resource to use
`Get-ScheduledTask` but the original author purposely did not do this
so that PowerShell v3 would be supported. We only support PowerShell
v5, but I don't want to break any current users and this change didn't
seem to controversial to me.

If it gives us trouble, I recommend rewriting it to use
`Get-ScheduledTask`.

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-06-28 00:27:53 -07:00
Lance Albertson
3263d76627 Add ip6tables resource
This should resolve #1011 which provides an ip6tables resource to test IPv6
iptables rules. This is essentially a copy of the iptables resource with a few
renames.

In addition, I've pulled in the integration tests for iptables into ip6tables
and enabled it on docker so that it properly gets tested regularly. The test
cookbook recipe has been updated to support all of the current platforms that
are being tested.

Signed-off-by: Lance Albertson <lance@osuosl.org>
2019-06-24 17:01:34 -07:00
Jared Ledvina
45713b2627
Service add Debian 10 test
Signed-off-by: Jared Ledvina <jared@techsmix.net>
2019-06-22 13:23:32 -04:00
Miah Johnson
26e73f4326 Update date on our timebomb.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-06-21 12:56:53 -07:00
Ryan Davis
902d7b563c Set the umask on travis in before_install.
https://travis-ci.community/t/file-permissions-just-gone-up-to-664/1547/5

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-06-19 16:40:24 -07:00
Jerry Aldrich
80c595ba3d nginx_conf: Fix commented/empty file parsing
This fixes `nginx_conf.params` when:
  - Given an empty file
  - Given a file with only comments
  - Given a file that has an include for a file that:
    - Is empty
    - Has all lines commented out

This also fixes a test where a missing file is actually empty

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-06-17 21:57:26 -08:00
Miah Johnson
b21bcfabc4 Lets discuss this next week when we're all around =)
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-06-14 15:04:26 -07:00
Clinton Wolfe
4ce2192678 Impactful KPI upswing
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-06-12 19:09:11 -04:00
Clinton Wolfe
0b8da5bb01 update test expectation with improved log message
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-06-12 19:05:48 -04:00
Clinton Wolfe
dea323fa52 Test fixtures and failing functional test for input rename
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-06-12 19:00:53 -04:00
Clinton Wolfe
ab6933fcc7 A key value-add use of company time
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-06-12 13:05:49 -04:00
Clinton Wolfe
d8e485eb62 Edit the masrshalling code more carefully to match
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-06-12 12:51:02 -04:00
Clinton Wolfe
0023906812 Update test code regarding input marshalling
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-06-12 12:25:45 -04:00
Clinton Wolfe
00d497fd09 Remove kitchen-inspec testing code - it is tested in that project, not here
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-06-12 12:17:19 -04:00
Clinton Wolfe
46624396c7 Bulk edit of test files to use input() in DSL
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-06-12 12:17:19 -04:00
Ryan Davis
dd7f9abb20 Revamped test/functional/ui_test.rb to check output before exit codes.
Helps with debugging.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-06-11 21:32:22 -07:00
Ryan Davis
fae4230a41 Removing inspec/profile_vendor from inspec/base_cli.
This was the next most expensive require in the analysis.

Also rearranged the way that ui handled tables to be lazy.

```
% SLOW=1 time rake test:functional

before: Finished in  681.514579s, 0.5136 runs/s, 2.9919 assertions/s.
after : Finished in  642.655918s, 0.5446 runs/s, 3.1728 assertions/s.
```

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-06-11 19:16:58 -07:00
Ryan Davis
692d6a9ab8 hand applied one that is now marked as unsafe in rubocop
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-06-11 18:52:38 -07:00
Miah Johnson
68e540a15a Ignore Rubocop checks
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-06-11 18:52:38 -07:00
Miah Johnson
c579ed3097 Disable rubocop check on TMP_CACHE
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-06-11 18:52:38 -07:00
Miah Johnson
729177f3c6 chefstyle -a
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-06-11 18:52:38 -07:00
Miah Johnson
649ed9aca5 This cache needs to be writable. Its a problem.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-06-11 18:52:38 -07:00
Miah Johnson
e46018a517 chefstyle -a cleanup
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-06-11 18:52:38 -07:00
Ryan Davis
a5309ea392 blindly applied chefstyle -a
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-06-11 18:52:03 -07:00
Clinton Wolfe
ec1baf6237
New plugin type: Input (#4019)
New plugin type: Input
2019-06-10 15:13:57 -04:00
Miah Johnson
390d006311 Fix indent
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-06-06 13:44:18 -07:00
Miah Johnson
b176012abf Maybe stop coverage from running early.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-06-06 13:43:19 -07:00
Miah Johnson
6b3d96e8a9 Wrap coverage in environment variable CI_ENABLE_COVERAGE
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-06-06 13:41:57 -07:00
Clinton Wolfe
1628383c8f Mis-spelled a method name
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-06-06 12:51:22 -04:00
Clinton Wolfe
9366804335 PR Feedback
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-06-06 12:51:22 -04:00
Clinton Wolfe
4b1ee722b4 Functional test for event log
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-06-06 12:51:22 -04:00
Clinton Wolfe
4eb815fdd7 syntaxo
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-06-06 12:51:22 -04:00
Clinton Wolfe
90da768ef0 Move event creation to input_registry to simplify plugin authorship
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-06-06 12:51:22 -04:00
Clinton Wolfe
53beaff372 Input plugin types work
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-06-06 12:51:22 -04:00
Clinton Wolfe
9e2e569d85 Add input plugin type API
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-06-06 12:51:21 -04:00
Clinton Wolfe
962dfc8d90 Failing tests for input plugin
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-06-06 12:51:21 -04:00
Clinton Wolfe
82f910e320 Plugin type declaration and unit test
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-06-06 12:51:21 -04:00
Ryan Davis
6bed51d69a Fixed up interactions between minitest & simplecov.
Sometime during the 2.x's, `at_exit` changed its ordering. As a result,
a lot of things that were stacking `at_exit`'s broke. This is one of
those since both simplecov and minitest do their thing via `at_exit`.
This switches to simplecov w/ no defaults on, then replicates their
simplecov/defaults.rb with our own.

I'm going to try to get that entire file back upstream but it can live
here for now.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-06-05 15:16:42 -07:00
Ryan Davis
5e71a6b787 oops
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-06-04 00:19:26 -07:00
Ryan Davis
58fa148773 Stabilize windows functional testing.
Skip most everything.

After some digging, in those tests that didn't have 100% failures, of
the ~10+% passing, those tests weren't checking enough. So I skip them
too in the hopes that we improve testing across the board.

At this point, we need appveyor to be green more than we need these
tests to be fixed. If that means we skip them, so be it.

These tests will time-bomb at the end of July.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-06-03 23:27:26 -07:00
Ryan Davis
5573957c52 Go back to cmd from powershell.
Apparently it is too much of a shift and I tested too small of a
sample.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-06-03 23:11:26 -07:00
Ryan Davis
22635157b5
Merge pull request #4177 from inspec/zenspider/thread_safety_is_hard
Turn off parallel testing (for now?)
2019-06-03 23:04:03 -07:00
Ryan Davis
c40f541a54
Merge pull request #4172 from inspec/mj/jsa
Replace jsonschema with json-schema
2019-06-03 23:03:23 -07:00
Ryan Davis
11638d36dd Now that we aren't parallelizing, start bringing back skipped tests.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-06-03 14:12:06 -07:00
Ryan Davis
45ef0d84d0 Remove minitest/hell in favor of stable (but sloooow) tests.
Added InspecTest (which we should use across the board) and
ParallelTest (which we should use selectively and with metrics) to
helper.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-06-03 14:12:06 -07:00
Ryan Davis
d2edd3ce68 Move minitest/hell to test/helper.
Probably going to remove this next and focus on opting-in to parallelization.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-06-03 14:12:06 -07:00
Ryan Davis
bba9434600 Change the way we load rspec so it never exposes globally.
Essentially, the way rspec does stuff is pretty rude. By injecting
singleton methods into main (instead of Kernel, where all top-level
methods go) and "cleaning" them up using undef_method instead of
remove_method makes it pretty hard for anything else in the testing
arena to operate. I've already fixed the case where rspec would
overwrite minitest's `describe` in a way that made it very hard to put
back, but my fix didn't prevent rspec from doing it _AGAIN_.

This fixes the case where after some rspec interactions, mocha's
`any_instance` method would just disappear. I never did figure out
where or why this was happening, but I did address the how.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-06-03 14:12:06 -07:00
Ryan Davis
a2f2cd5087
Merge pull request #4109 from inspec/zenspider/helper_cleanup
Minor cleanup on test/helper.rb
2019-06-03 13:39:31 -07:00
Miah Johnson
0aea548dd8 Update tests to use json-schema, and test something.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-06-01 23:17:53 -07:00
Miah Johnson
9a580407e6 brittle tests
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-31 11:43:44 -07:00
Miah Johnson
a5c8021227 don't remove this leading newline =)
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-31 11:43:44 -07:00
Miah Johnson
2a1b1d8e88 Remove all leading newlines.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-31 11:43:44 -07:00
Ryan Davis
d10591dc19 Some of our license tests fail if we have CHEF_LICENSE set, so wrap them up.
This still doesn't fix our parallelization issues. I think

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-30 11:17:19 -07:00
Ryan Davis
4790e288a0
Merge pull request #4142 from inspec/zenspider/clean_unnecessary_requires
Clean unnecessary requires
2019-05-29 18:33:06 -07:00
Ryan Davis
dfadc393b9 Even more removals and moves!
Turns out we don't even use CMD in any units... so why make it?

Lots of other stuff got ripped out. Tests basically shouldn't need to
require anything but 1 implementation file and a test framework.
Anything more than that is a smell.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 17:58:02 -07:00
Ryan Davis
be125598c8 Additional whitespace cleanup.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 17:58:02 -07:00
Ryan Davis
ec248217a7 Extra fix for utils move
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 17:58:02 -07:00
Ryan Davis
a8bcba780f Got the rest of the functionals to pass.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 17:58:02 -07:00
Ryan Davis
82c9aa6ed6 Got the rest of the tests to pass.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 17:58:02 -07:00
Ryan Davis
9ec91484fc Get all non-resource tests fixed again.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 17:58:02 -07:00
Ryan Davis
de8258c9f7 Get yaml_test.rb working
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 17:58:02 -07:00
Ryan Davis
761f48e63c Get user_test.rb working
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 17:58:02 -07:00
Ryan Davis
69f2927983 Stripping test/helper.rb of all the big inspec requires.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 17:58:02 -07:00
Ryan Davis
61585de0f0 Moved out all of the requires for inspec/resources/* from inspec/resource.rb
All requires moved to inspec/resources.rb

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 17:58:02 -07:00
Ryan Davis
adaf2bc364 Removed aws resource requiring from test/helper and inspec/resource.
This speeds up parallel unit test runs from a very consistent 2:49 to
a very consistent 1:53, or a 33% reduction.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 17:58:02 -07:00
Ryan Davis
56924dbee1 Fix some of our functional failures on windows.
+ Add CHEF_LICENSE env variable.
+ Switch to using powershell to invoke inspec.

I still think we should look into using `spawn`, but this is a good
start.

This probably doesn't fix the rest of the tests, but they're SO slow
locally that I'm gonna start this PR.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 15:48:37 -07:00
Ryan Davis
23f8a1e30c Explicitly set default_external to UTF-8 for windows testing.
This fixes 4 failures having to do with encoding mismatch.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 15:48:37 -07:00
Miah Johnson
6c19e81a06 Remove authors tags from source files.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-28 12:47:39 -07:00
Ryan Davis
ad12e601bf Minor cleanup on test/helper.rb
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-28 12:02:06 -07:00
Clinton Wolfe
c8f0de05af
inspec check: Send log to STDERR when running with --format json (#4001)
inspec check: Send log to STDERR when running with --format json
2019-05-28 14:44:44 -04:00
Miah Johnson
2215bb0570 Update all requires pointing to util/
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-28 11:30:16 -07:00
Clinton Wolfe
db66eb0ad1
Extracting mock_loader to its own helper file. (#4141)
Extracting mock_loader to its own helper file.
2019-05-28 14:08:21 -04:00
Miah Johnson
5ae79a5b42
Merge pull request #4140 from inspec/zenspider/supermakert
supermakert -> supermarket
2019-05-28 11:01:20 -07:00
Ryan Davis
f36a7c8061 No tabs.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-25 03:40:36 -07:00
Ryan Davis
09e892032b Extracting mock_loader to its own helper file.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-25 02:59:31 -07:00
Ryan Davis
9e9cc42bf8 Another typo fixed.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-24 15:53:03 -07:00
Ryan Davis
4e5ddc051e Fixed typo in filename
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-24 15:51:57 -07:00
Miah Johnson
fb0993e0f2
Merge pull request #4089 from mirskiy/github_url_regex_bug
Fix github url regex. Add period for repo
2019-05-21 12:45:18 -07:00
Miah Johnson
27ee7a1a63
Merge pull request #4107 from inspec/zenspider/telemetry_requires
Minor require cleanup for telemetry.
2019-05-20 13:10:30 -07:00
Ryan Davis
9c6965b2ed Minor require cleanup for telemetry.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-20 13:09:38 -07:00
Miah Johnson
c7218a991a
Merge pull request #4108 from inspec/zenspider/remove_test_unit_helper
Delete test/unit/helper.rb
2019-05-20 13:08:07 -07:00
Miah Johnson
36029da0a3
Merge pull request #4116 from inspec/zenspider/clean_more_requires
Clean more requires
2019-05-20 13:07:04 -07:00
Ryan Davis
e1061f41f2 Clean more requires
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-20 13:01:18 -07:00
Ryan Davis
8c56477f02 Fixes a test interaction bug between installer and loader.
Not sure how it was supposed to work in the first place. The plugin in
question depends on ordinal_array and that wasn't in that fixture dir.
Switching to 2 is all it apparently needed.

This does cause yet another double-load warning (VERSION already
defined). I don't know how we're supposed to get around that with the
way we've set up these tests.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-18 15:45:22 -07:00
Ryan Davis
8ea1889001
Merge pull request #4079 from inspec/mj/cli_warn
Fix @unique_controls uninitialized warning
2019-05-18 15:00:47 -07:00
Ryan Davis
892641f69d Delete test/unit/helper.rb
I isn't used anywhere.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-18 14:21:33 -07:00
Ryan Davis
9b7c292d4c Use IO globals instead of IO constants.
Helps testing and lots of other things if we only use $stdout/$stderr.

STDOUT/STDERR should only be used to restore the globals.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-18 12:48:18 -07:00