Commit graph

32 commits

Author SHA1 Message Date
Nick Schwaderer
6d340b323c Allow ‘=‘ character in CLI inputs
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>
2020-07-09 12:50:21 +01:00
Clinton Wolfe
09bbc7e2e7 Remove a ruby expression-based test
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-06-05 17:40:49 -04:00
Clinton Wolfe
925363766e Document and test to verify that it skips resources in describe blocks
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-06-05 17:40:49 -04:00
Clinton Wolfe
f39cf8c904 Tests to exercise only_if functionality
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-06-05 17:39:54 -04:00
Nick Schwaderer
fb1aeb0655
Merge pull request #5011 from inspec/cw/complex-cli-inputs
Boolean, Numeric, and Structured CLI inputs
2020-06-05 04:23:48 -07:00
Clinton Wolfe
dcc70bc541 Trim log message, make boolean check case insensitive
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-23 00:25:08 -04:00
James Stocks
350c0bfe8f Handle waiver expiration dates being YAML strings
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>
2020-05-20 15:00:43 +01:00
James Stocks
35e36ad40a Allow for waiver time as well as date
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>
2020-05-20 14:59:07 +01:00
James Stocks
2103b52dbe
Merge pull request #4994 from james-stocks/js/json
Reporter options to truncate message and suppress stacktrace
2020-05-07 12:54:34 +01:00
Clinton Wolfe
786e3728d7 Failing tests for #4799
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-05 18:09:11 -04:00
Clinton Wolfe
970f583764 Tighten up tests
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-05 17:59:50 -04:00
Clinton Wolfe
c683c4d64d Failing test cases for 4963
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-05 17:37:23 -04:00
Clinton Wolfe
824018efa3 Failing test cases for #4977
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-05-05 17:37:23 -04:00
Nick Schwaderer
a1129f9efc Allows input and control to have the same name
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>
2020-05-05 10:00:19 +01:00
James Stocks
ae66aee2b2 (WIP) Reporter options to truncate message and suppress stacktrace
TODO: Option names are not JSON specific but only json reporter has been implemented.

Signed-off-by: James Stocks <jstocks@chef.io>
2020-05-04 15:24:50 +01:00
Clinton Wolfe
58e8bc5167 Divide tests into undeclared and required groups
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-04-24 16:38:11 -04:00
Clinton Wolfe
a12dfcfdc0 Add a failing test case for 4769
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-04-24 13:57:28 -04:00
Clinton Wolfe
2d9c443a04 Add functional tests that try each of the cloud resource packs with bad creds
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-02-26 14:41:38 -05:00
Miah Johnson
7bb0bb2188
Merge pull request #4865 from inspec/jh/schema-improvements
Jh/schema improvements
2020-02-10 18:38:28 -08:00
Miah Johnson
4f642e0942 Clean up schema PR.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2020-02-05 17:06:55 -08:00
Ryan Davis
99f86c8a0b These tests don't pass on a network cafe and just hang forever.
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>
2020-02-03 13:18:56 -08:00
Clinton Wolfe
913c066be9 Test fixture and functional test for compliance fetcher
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-03 14:15:05 -05:00
Clinton Wolfe
82ae3b5fa1 Test fixtures and functional test for local fetcher
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-03 14:15:05 -05:00
Clinton Wolfe
ed209643f3 Test fixture for url fetcher
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-03 14:15:05 -05:00
Clinton Wolfe
928cf6f05e Functional test and fixtures for git fetcher fallback
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-03 14:15:04 -05:00
Clinton Wolfe
b34d489f5c Add .invalid TLD to test hostanmes
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-12-04 13:32:58 -05:00
Clinton Wolfe
4bda0ddeeb fixture and implementation for git fetcher failure handling
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-12-04 13:32:19 -05:00
Clinton Wolfe
8a3213861a Fixture and implementation for URL fetcher
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-12-04 13:32:19 -05:00
Clinton Wolfe
72f1011979 Fixture and implementation for local fetcher error handling
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-12-04 13:30:08 -05:00
Ryan Davis
4242937bea Changed a bunch of profiles to use / instead of /tmp for Windows compat. 2019-11-12 14:51:56 -08:00
Ryan Davis
b1c2af209b Corresponding fixes for the move from test/unit/mock to test/fixtures.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-08 19:20:12 -08:00
Ryan Davis
db8e6e7415 Moved test/unit/mock/* to test/fixtures
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-08 16:29:03 -08:00