* Fix systemd path for Leap image
Signed-off-by: Jeremy JACQUE <jeremy.jacque@algolia.com>
* Use vhef client version 17 as doocker cookbook do not support >= 18
Signed-off-by: Jeremy JACQUE <jeremy.jacque@algolia.com>
* Add nftables resource
Signed-off-by: Jeremy JACQUE <jeremy.jacque@algolia.com>
* Add nftables tests
Signed-off-by: Jeremy JACQUE <jeremy.jacque@algolia.com>
* Add fixtures for nftables tests
Signed-off-by: Jeremy JACQUE <jeremy.jacque@algolia.com>
* enable nftables only when attr is true - then disable iptables
Signed-off-by: Jeremy JACQUE <jeremy.jacque@algolia.com>
* By default test iptables, not nftables
Signed-off-by: Jeremy JACQUE <jeremy.jacque@algolia.com>
* Fix tests and lint errors
Signed-off-by: Jeremy JACQUE <jeremy.jacque@algolia.com>
* Increase unit test coverage for nftables
Signed-off-by: Jeremy JACQUE <jeremy.jacque@algolia.com>
* Do not use -nn nft option as behaviour changes based on nft version
Signed-off-by: Jeremy JACQUE <jeremy.jacque@algolia.com>
* Base nft params identification on its version, not os version
Signed-off-by: Jeremy JACQUE <jeremy.jacque@algolia.com>
* Make test more human friendly by reversing unless/if logic
Signed-off-by: Jeremy JACQUE <jeremy.jacque@algolia.com>
* Update mocked cmds with nft params
Signed-off-by: Jeremy JACQUE <jeremy.jacque@algolia.com>
* Fix quoting issue with rubocop
Signed-off-by: Jeremy JACQUE <jeremy.jacque@algolia.com>
* Fix uninitiallized class vars
Signed-off-by: Jeremy JACQUE <jeremy.jacque@algolia.com>
* Fix unit test by adding nft version mocking
Signed-off-by: Jeremy JACQUE <jeremy.jacque@algolia.com>
* Clean nftables doc
Signed-off-by: Jeremy JACQUE <jeremy.jacque@algolia.com>
---------
Signed-off-by: Jeremy JACQUE <jeremy.jacque@algolia.com>
* 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>
This does NOT include fixes for our dependencies that are also having
2.7 warnings (which cause our functional tests to fail because for
some reason we expect stderr to be empty, which is brittle).
I've got upstream PRs to fix all of those. My tests pass locally. I
could push a commit that modifies the Gemfile to use my forks, but I'd
like to see how this fares for now.
Signed-off-by: Ryan Davis <zenspider@chef.io>
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>
+ float? comparison can raise a TypeError
+ octal? comparison was allowing non-octal values (which cast to 0)
+ symbol comparison was casting to a string, but then doing an == check instead of casecmp.
The latter seems optional, but consistent with the intent of cmp.
Signed-off-by: Ryan Davis <zenspider@chef.io>
obj.method(name).call(*args) == obj.send(name, *args)
```
Calculating -------------------------------------
method+call 2.561M (± 2.2%) i/s - 12.816M in 5.006835s
send 6.299M (± 2.4%) i/s - 31.501M in 5.004045s
Comparison:
send: 6299002.5 i/s
method+call: 2560909.2 i/s - 2.46x slower
```
There aren't any direct tests for this? But I forcefully failed 2
functionals and then verified they passed after my change.
Not sure how (or if) to write tests against rspec matchers in a
meaningful way, even tho all I really want to test is a plain ole
method in it. I'll poke to see if it is possible / practical.
Signed-off-by: Ryan Davis <zenspider@chef.io>
This converts all current deprecation warnings/TODOs to use the
`Inspec.deprecate()` deprecation facility.
This also modifies `Inspec.deprecate()` to only require 1 argument.
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
This modifies the output of failed test when using the `cmp` matcher by
calling `.inspect` on the actual value passed.
This makes it easier to diagnose failed matches due to characters such
as `\n` not being visible.
Current behavior:
```
inspec> describe command('echo demo') do
inspec> its('stdout') { should cmp 'demo' }
inspec> end
Profile: inspec-shell
Version: (not specified)
Command: `echo demo`
× stdout should cmp == "demo"
expected: "demo"
got: demo
(compared using `cmp` matcher)
Test Summary: 0 successful, 1 failure, 0 skipped
```
New behavior:
```
inspec> describe command('echo demo') do
inspec> its('stdout') { should cmp 'demo' }
inspec> end
Profile: inspec-shell
Version: (not specified)
Command: `echo demo`
× stdout should cmp == "demo"
expected: "demo"
got: "demo\n"
(compared using `cmp` matcher)
Test Summary: 0 successful, 1 failure, 0 skipped
```
Many thanks to @jazaval for discovering this!
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
* Bump Rubocop to 0.49.1
This change bumps Rubocop to 0.49.1. There have been a lot of changes
since 0.39.0 and this PR is hopefully a nice compromise of turning off
certain cops and updating our codebase to take advantage of new Ruby
2.3 methods and operators.
Signed-off-by: Adam Leff <adam@leff.co>
* Set end-of-line format to line-feed only, avoid Windows-related CRLF issues
Signed-off-by: Adam Leff <adam@leff.co>
* Enhance cmp matcher to work with symbols
The `cmp` matcher will now stringify symbol actual values if the
expected value was passed in as a string. This will help with the file
resource `type` method where Train returns the file type as a symbol.
Signed-off-by: Adam Leff <adam@leff.co>
* Fix documentation for file type character_device
Signed-off-by: Adam Leff <adam@leff.co>
* Fix docs for block_device
Signed-off-by: Adam Leff <adam@leff.co>
* Fix file mtime docs
Signed-off-by: Adam Leff <adam@leff.co>
* New matcher 'be_in'
Fixes#2018
Signed-off-by: Rony Xavier <rx294@nyu.edu>
* small fixes to wording.
Signed-off-by: Aaron Lippold <lippold@gmail.com>
* Added code to use be_in for with the following use case:
describe nginx do
its(module_list) { should be_in AUTHORIZED_MODULE_LIST }
end
Fixes#2018
Signed-off-by: Rony Xavier <rx294@nyu.edu>
* Updates to the matcher
Fixes#2018
Signed-off-by: Rony Xavier <rx294@nyu.edu>
* Added tests for the be_in matcher
Signed-off-by: Rony Xavier <rx294@nyu.edu>
* Requested updates completed
Signed-off-by: Rony Xavier <rx294@nyu.edu>
* Remove any "All Rights Reserved" references
InSpec is licensed and released under the Apache 2.0 license. This
change removes all reference to legacy code files that still had
any Copyright or License lines referring to "All Rights Reserved".
Signed-off-by: Adam Leff <adam@leff.co>
* fix functional tests
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>