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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
+ 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>
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>
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>