Extended quick_resource to have platform methods and a new string
command mock. The named resource to mock may now be a symbol.
Added a new test that shows how to use quick_resource with multiple commands.
Fixes#4629.
Signed-off-by: Ryan Davis <zenspider@chef.io>
* Renamed and added extra test data to distinguish between centos 7 & centos 8.
* Renamed and added extra tests to cover centos 8.
* Fixed missing repo data by checking at the end if we were still in parse mode.
Fixes#4517
Signed-off-by: Ryan Davis <zenspider@chef.io>
Cc: Miah Johnson <miah@chia-pet.org>
test/unit/resources/json_test.rb had the start of a setup to directly
instantiate resources. I've refactored that up to helper.rb and
extended it with some helper methods so we can directly specify what a
resource command should respond with. For many/most of our tests, this
should be sufficient.
Finally, I switched our yum tests over to use the new setup. This will
allow us to address #4517 and extend the tests for centos8 output
differences with ease. Ease, folks... ease.
Signed-off-by: Ryan Davis <zenspider@chef.io>
Cc: Miah Johnson <miah@chia-pet.org>
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>
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>
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>
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>
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.
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>
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>
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>