At the moment we return the "Truncate" text whenever the setting is
utilized. This PR ensures that we only advise truncation when it's been
executed.
Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
Fixes#5131
Due to the use of `#split(‘=‘)` against inputs supplied via the CLI we had an edge case where inputs with `’=‘` in the value would cause a breakage.
This PR supplies a test for the regression and fixes the bug with a regex solution.
Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
We have 72 `skip_windows` that need addressing. This PR removes
confirmed instances where the tests now work on windows. It also marks
tests with a comment where they are confirmed to still break. Unmarked
instances still need review.
It also updates the `skip_windows` expiration date.
72 `skip_windows` needing resolution OR alternative documentation upon investigation
Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
This is technically incorrect YAML, but if you transcode YAML between several tools you may end up with a date/time value being an explicit string.
It would be helpful if InSpec supported any string value that easily translates to a Time.
Signed-off-by: James Stocks <jstocks@chef.io>
Fixes#5037
The YAML parser may parse a waiver timestamp as a Time rather than a Date. Even when the user doesn't care about time, they may be using a tool that outputs YAML with trailing zeroes for hour, minutes, seconds etc.
Signed-off-by: James Stocks <jstocks@chef.io>
I removed the skip to see what would break, and on my Windows laptop
these tests pass OK. The TODO didn't explain what wasn't applicable to
Windows, so I'm just going to remove it.
Signed-off-by: James Stocks <jstocks@chef.io>
In https://github.com/inspec/inspec/issues/4936 the issue was reported that naming an input the same as a control caused an unexpected failure.
In that particular case, the naming was a result of a pre-waivers workaround which is no longer necessary, but ultimately a breakage of that name clash is an unexpected occurrance.
Due to how inputs are named and registered, `__apply_waivers` thinks that an object is a waiver that is not a waiver and tries to process it. On the micro level, it breaks when trying to pass a variable to a string as if it were a Hash.
It is imperative that we preserve 100% of the current featureset, pass our tests, and fix this edge case along with new test coverage for the failure.
This PR updates the code to do a slightly more elegant and small ‘waiver check’ to stop the namespace clash from breaking our code.
Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
They don't need to be json specific, they should apply to any reporter if the user has chosen these settings.
Signed-off-by: James Stocks <jstocks@chef.io>
Changing to localhost resolves immediately but assumes you're NOT
running a git server on http locally.
This seems more valid to me than assuming you know how DNS is going to
resolve everywhere.
Signed-off-by: Ryan Davis <zenspider@chef.io>
* 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>
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>
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.
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>
+ 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>
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>
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>
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>
I think this is probably in contention with my other PR on resource
initialization. We definitely need to change that, so this might fall
to the side. Or maybe just the test needs to be redone. We'll discuss
and see.
Signed-off-by: Ryan Davis <zenspider@chef.io>
This is a first pass at fixing the failure found by @scottvidmar where
file resource was raising undefined_method on nil. The problem was
that the initialize method for file was not being called at all
because Resource#initialize was returning early without reporting
anything.
This fix causes a failure in test/functional/inspec_exec_test.rb where
it is testing a similar scenario but for some reason the unsupported
resources get reported. We need to figure that part out, but in the
meantime this will at least report an error at the root cause rather
than down the road.
Fixes#4208
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>