Clinton Wolfe
46ade02401
Use an archive if possible when fetching fails and --airgap is… ( #4806 )
...
Use an archive if possible when fetching fails and --airgap is provided
2020-01-28 10:02:57 -05:00
Ryan Davis
df31f744f4
Fix up platform on filesystem resource.
...
From linux to unix. This should work fine even on AIX, according to
the man pages.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2020-01-27 15:34:33 -08:00
Clinton Wolfe
76a9c3e590
Install-path based install context detection
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-27 13:29:37 -05:00
Noel Georgi
7ac25401bb
Add: content option for x509_certificate
...
Signed-off-by: Noel Georgi <git@frezbo.com>
2020-01-22 13:49:35 +05:30
Raimar Sandner
fa2f2c2caa
make command.exist? POSIX conform
...
With the current implementation, on a Linux system without bash
command.exist? always returns false. 'sh -c' is guaranteed to exist on a
POSIX-conform system [1] whereas 'bash -c' only works if bash is
actually installed.
[1] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html
Obvious fix.
2020-01-19 00:05:33 +01:00
Michael Lihs
edd93eea81
Add support for yocto linux in service resource
...
Signed-off-by: Michael Lihs <michael.lihs@thoughtworks.com>
2020-01-18 01:26:16 +01:00
Miah Johnson
0d57612103
Update references to use new namespace
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2020-01-07 15:12:42 -08:00
Clinton Wolfe
ef9ef919fc
Linting
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-03 14:15:05 -05:00
Clinton Wolfe
3e3398ff29
Switch to using tmpdir option during testing to avoid rm calls
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-03 14:15:05 -05:00
Clinton Wolfe
ba4fa9832c
parallelize fetcher tests, conditionalize automate fetcher
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2020-01-03 14:15:05 -05: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
Ryan Davis
f09595c33d
Merge pull request #4821 from inspec/zenspider/mocha2
...
Found and fixed more mocha/setup deprecations.
2020-01-02 16:07:35 -08:00
Ryan Davis
c57a0e1f13
Found and fixed more mocha/setup deprecations.
...
This level of duplication is not good.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-12-31 15:46:47 -08:00
Ryan Davis
73cccd8681
Cache the backend in profile_context_test.rb
...
And this speeds it up from 0.5s to 0.07s.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-12-31 15:27:12 -08:00
Ryan Davis
313f3462ca
Cache MockLoader.connection.
...
Speeds up test/unit/profile/profile_context_test from 7-8s to 0.5s.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-12-31 15:27:12 -08:00
Ryan Davis
6426feeeb4
Removed the last of the metaprogramming from ControlEvalContext.
...
* Merged CEC.create args into CEC#initialize
* Converted the only call site of CEC.create to just call new.
* Added profile_context and resources_dsl accessors to CEC.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-12-31 15:27:12 -08:00
Clinton Wolfe
2409e8fb99
Set test skip bomb date to end of 2020Q1
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-12-31 12:19:27 -05:00
Cameron Straka
8b037fa9c2
replaced instances of have_protocols
with have_protocol
in documentation and examples
...
Signed-off-by: Cameron Straka <strakacameron@hotmail.com>
2019-12-31 10:51:55 -05:00
Ryan Davis
8e281e007e
oops
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-12-24 04:11:17 -08:00
Ryan Davis
83f7504d7c
Merge pull request #4789 from Perceptyx/add-freebsd-package
...
Add suport for freebsd package resource
2019-12-17 14:05:40 -08:00
Felipe Zipitria
bff3fa960d
Add suport for freebsd package resource
...
Signed-off-by: Felipe Zipitria <fzipitria@perceptyx.com>
2019-12-17 08:39:43 -03:00
Ryan Davis
e49efa2619
This should fix the mocha deprecations.
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-12-16 15:01:38 -08:00
Trevor Vaughan
21edc712bd
Fix auditd resource processing of action and list
...
Per auditctl(8), the -a option can have either list,action or
action,list. This PR matches against valid actions for the action field
and passed the remainder off to the list field.
Closes #4664
Signed-off-by: Trevor Vaughan <tvaughan@onyxpoint.com>
2019-12-12 17:38:47 -05:00
Ryan Davis
04581d2270
Merge pull request #4771 from inspec/zenspider/rspec-3.9
...
Bump rspec to 3.9 and fix broken tests.
2019-12-09 12:09:32 -08:00
Ryan Davis
f67171fa6b
Bump rspec to 3.9 and fix broken tests.
...
Tests are STILL brittle, but this at least lets us drop old rspec.
Fixes #4575
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-12-06 16:52:35 -08:00
Clinton Wolfe
bba6d70b3b
Raise FetcherFailure for url headers missing
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-12-04 13:32:58 -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
6b0877591f
Refactor functional test to DRY up
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-12-04 13:32:19 -05:00
Clinton Wolfe
8679443698
Functional test for git fetcher failure handling
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-12-04 13:32:19 -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
c1d1e6d12f
functional test for URL fetcher
...
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
0ddf1687f5
A functional test for the local fetcher
...
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>
2019-12-04 13:30:08 -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
c5e38d81c4
Merge pull request #4759 from inspec/zenspider/windows-again-and-again
...
Bump windows deadline AGAIN.
2019-12-03 18:43:31 -08:00
Ryan Davis
2fdd68c805
Bump windows deadline AGAIN.
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-12-03 18:41:48 -08:00
Miah Johnson
b174273034
Merge pull request #4724 from mbaitelman/add_last_login_user
...
Add last login date to WindowsUser
2019-12-02 13:27:45 -08:00
Miah Johnson
7a837e16d1
Merge pull request #4745 from inspec/mj/cc-coverage
...
Enable Codeclimate Test Coverage
2019-12-02 13:27:00 -08:00
Ryan Davis
fe3c49e705
Merge pull request #4743 from inspec/zenspider/fixtures
...
Suppress output from rubygems installs.
2019-12-02 10:41:04 -08:00
Miah Johnson
fe8f868504
dont set a default simplecov format; we do that elsewhere.
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-11-28 00:53:22 -08:00
Miah Johnson
9db7b70e30
remove coveralls; all we need is simplecov
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-11-27 22:12:48 -08:00
Ryan Davis
5a0be99ffb
Added 2.7.0 gem repos to our fixtures.
...
This is NOT THE RIGHT WAY to do this... but it fixes a ton of tests. :(
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-27 15:42:52 -08:00
Ryan Davis
f2e4fb549c
Address and fix all our ruby 2.7 warnings & errors.
...
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>
2019-11-27 15:42:52 -08:00
Ryan Davis
d4b3a5c149
Suppress output from rubygems installs.
...
I still wish this wouldn't fetch or install... but in the meantime,
leave my dots alone.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-27 13:42:43 -08:00
Clinton Wolfe
6adf7b13be
Merge pull request #4734 from inspec/cw/move-fetchers
...
Move lib/fetchers to lib/inspec/fetchers and re-namspace
2019-11-25 14:56:06 -05:00
Miah Johnson
a636f6bdc9
Merge pull request #4678 from inspec/mj/artifact_tests
...
Add several tests to our artifact suite
2019-11-25 11:53:57 -08:00
Miah Johnson
c993f91ca6
rubocop is on the beat
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-11-22 12:48:56 -08:00
Clinton Wolfe
9792bae00d
Move the registry cache object
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-11-22 10:09:51 -05:00
Clinton Wolfe
d9f55bf85c
Singularize the fetchers directory name
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-11-22 09:57:28 -05:00
Miah Johnson
45070c15c0
Fixup tests
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-11-21 17:01:10 -08:00
Clinton Wolfe
7807c3fa01
Re-namespace core Fetchers
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-11-18 13:20:35 -05:00
Clinton Wolfe
80ef0eeeba
Take back the Inspec::Fetcher namespace
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-11-15 16:23:00 -05:00
Mendy Baitelman
6baf0f8a1c
Fix tests
...
Signed-off-by: Mendy Baitelman <mendy@baitelman.com>
2019-11-14 21:22:07 -08:00
Ryan Davis
89888be944
Removing the osx? guard that has been pushed to minitest and released.
...
This is mostly to bump a release because our last one blew up.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-14 15:05:13 -08:00
Clinton Wolfe
b39d47bda7
Move fetcher files
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-11-14 15:25:43 -05:00
Mendy Baitelman
4ba95a0236
Fix syntax, start tests
...
Signed-off-by: Mendy Baitelman <mendy@baitelman.com>
2019-11-13 23:08:23 -08:00
Ryan Davis
540521031b
Merge pull request #4707 from inspec/zenspider/apt-fix
...
Fixes parsing of apt config files with arch specifier.
2019-11-13 15:48:15 -08:00
Ryan Davis
4e818faeb4
Fixes parsing of apt config files with arch specifier.
...
Fixes #4683 .
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-12 15:08:06 -08:00
Ryan Davis
865e0d43c0
Fixed a race condition in the tests on windows.
...
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.
2019-11-12 14:51:56 -08:00
Ryan Davis
efc51c44d9
Fixes to get inspec_exec_test.rb green on Windows.
2019-11-12 14:51:56 -08:00
Ryan Davis
f8ea33de8f
Added test command caching and refactored inspec helper to run_cmd.
...
Helps with some of the tests that want to run ruby directly.
Fixes #4416 .
2019-11-12 14:51:56 -08:00
Ryan Davis
bb7e69d145
Fixes for some of the inspec exec tests under Windows.
2019-11-12 14:51:56 -08: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
2eaebe510c
Fixed installer_test by testing subsets of the paths.
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-12 14:51:56 -08:00
Ryan Davis
d1f67c02d0
Get the license_tests passing
...
...mostly by skipping
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-12 14:51:56 -08:00
Ryan Davis
e60dc84188
Cleaned up inspec artifact testing.
...
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>
2019-11-12 14:50:39 -08:00
Ryan Davis
c3fe1697bb
Fix the way we determine (and clean) the repo_path in functionals.
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-12 14:50:39 -08:00
Ryan Davis
ee327094fb
Strip all ANSI color codes from output in inspec_shell_test.rb
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-12 14:50:39 -08:00
Ryan Davis
b3b8336620
Get inspec_exec_test.rb passing on windows w/o skips.
...
+ 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>
2019-11-12 14:50:39 -08:00
Ryan Davis
bfc8b357bf
Clean up testing in inspec exec by stripping ansi color codes from output.
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-12 14:50:39 -08:00
Clinton Wolfe
1db2941a9e
Fix for invocation when calling npm under sudo ( #4548 )
...
Fix for invocation when calling npm under sudo
2019-11-12 16:01:07 -05:00
Bryan McLellan
e4a096ba83
Merge pull request #4680 from inspec/btm/warn-objects
...
Deprecate inspec/object/* classes
2019-11-12 15:30:45 -05:00
Miah Johnson
6510679e6a
dont clobber
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-11-09 13:38:00 -08:00
Miah Johnson
b6b6afb29d
dry up other tests
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-11-09 13:36:15 -08:00
Miah Johnson
96d7eab62f
dry up exists tests
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-11-09 13:35:17 -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
e8ca7d3cd3
Suppress output from rubygems installs.
...
I still wish this wouldn't fetch or install... but in the meantime,
leave my dots alone.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-08 18:35:23 -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
Ryan Davis
244c7bbed4
Merge pull request #4677 from inspec/zenspider/bump-chefstyle
...
Bump chefstyle and fix up flagged code.
2019-11-08 16:07:42 -08:00
Ryan Davis
bb49d58cd9
Switched chefstyle back to Layout/AlignArguments=with_first_argument.
...
Fixed the flags mostly with `chefstyle -a` but also refactored/cleaned
some stuff by hand.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-11-08 12:57:43 -08:00
Bryan McLellan
3670500701
Deprecate inspec/object/* classes
...
The classes in inspec/object have been moved to the inspec-objects
library. They aren't used directly by Inspec and will be removed in the
next major release.
Signed-off-by: Bryan McLellan <btm@loftninjas.org>
2019-11-08 15:09:09 -05:00
Miah Johnson
6f829c2d27
drop leading /bin
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-11-07 17:13:49 -08:00
Miah Johnson
71e72af079
Change flunk to skip. drop parallelize me until multiple tests
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-11-07 16:19:19 -08:00
Miah Johnson
2a2dd29e5b
I moved up open3, so lets delete these
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-11-07 15:55:50 -08:00
Miah Johnson
ca1416fb0a
Add some very basic tests. Several of which outright flunk!
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-11-07 15:42:48 -08:00
Miah Johnson
6ad21441e4
Move exist checks to own test. Use open3
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-11-07 15:34:21 -08:00
Clinton Wolfe
f85de31292
Update test mock file to match invocation
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-11-07 15:39:08 -05:00
Miah Johnson
549e3c196e
Merge pull request #4675 from inspec/mj/hab1101
...
Get artifact/habitat starting tests on both Windows and Linux
2019-11-07 12:13:31 -08:00
Miah Johnson
13a1c30ba6
Corret build scripts
...
correct path to hab artifact
Rather than throwing, lets try to install the version
Make sure hab is in the path
we use -b on windows. lets be consistent
export project_root too
picardface
fix regex
execute rake _through_ habitat
make test vrooom
test presence of inspec
strip out clixml bs
... no which on bk.
full path to which
export PATH
test exist on linux/windows
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-11-07 10:09:35 -08:00
Clinton Wolfe
d9f34dda58
Make input() work in describe.one ( #4666 )
...
Make input() work in describe.one
2019-11-07 11:58:11 -05:00
Mendy Baitelman
1a9a47ee96
Merge remote-tracking branch 'upstream/master' into add-startuser-systemd-service
...
Signed-off-by: Mendy Baitelman <mendy@baitelman.com>
2019-11-04 21:07:56 -08:00
Clinton Wolfe
c045de4399
Temporarily add functional test for input in describe.one in isolated commit
...
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>
2019-11-01 16:52:21 -04:00
Clinton Wolfe
f9b65cc54c
Test fixture profile for inputs in describe.one
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-11-01 16:52:21 -04:00
Ryan Davis
e54f0b3646
Fixed runner tests for windows.
...
Passes on my side and only fails on buildkite's windows. I have no
idea why / how it differs. This should be neutral enough that it works
on both.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-31 15:20:58 -07:00
Miah Johnson
1b93755410
Merge pull request #4653 from landychan/lchan/bug-fix-3611
...
Nginx Resource: Add parsing support for wildcard, dot prefix, and regex
2019-10-31 14:20:08 -07:00
Miah Johnson
7a68d58904
Merge pull request #4654 from inspec/mj/oracle
...
oracledb_session fixes
2019-10-31 14:13:56 -07:00
Miah Johnson
de4139aff8
Merge pull request #4568 from ramereth/yum-el8-support
...
Improve testing for yum.repo in CentOS 8
2019-10-31 14:13:05 -07:00
Ryan Davis
74c692c9eb
Pushed unmock up to helper.rb
...
Also switched osx group test to use quick_resource since it is cleaner.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-31 14:09:16 -07:00
Ryan Davis
fdc82b7d12
Tests shouldn't output. Ever.
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-31 14:09:16 -07:00
Ryan Davis
defe63dada
Test for bug #4524 and bug #4587 to verify that resources are available w/in rspec constructs.
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-31 14:09:16 -07:00
Miah Johnson
314715d9f8
let there be tests
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-30 19:11:38 -07:00
Miah Johnson
9173674ecd
Unsure why old mocking system is broken.
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-30 17:27:01 -07:00
Landy Chan
9e38bec396
Added wildcard and dot-prefixed identifier support. Combined regex identifier into standard identifier
...
Signed-off-by: Landy Chan <landychan92@gmail.com>
2019-10-30 16:39:38 -07:00
Landy Chan
e60179b91f
Added regex identifier
2019-10-30 13:51:20 -07:00
Miah Johnson
66cb95b2ca
Add tests to cover Linux/Windows differences in sqlplus execution
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-30 12:26:12 -07:00
Ryan Davis
83a6bd84dd
bumped the windows tests again
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-30 01:47:16 -07:00
Ryan Davis
f56ccb16cb
Merge pull request #4628 from inspec/zenspider/minitest-output
...
Fixed the rest of the minitest deprecations by removing FuncTestRunResult.
2019-10-29 14:47:36 -07:00
Miah Johnson
9c953a0e68
Merge pull request #4638 from inspec/mj/eha
...
Add #to_s to etc_hosts_allow, and add tests
2019-10-24 13:24:46 -07:00
Miah Johnson
44579ab4b3
Merge pull request #4637 from inspec/mj/3921
...
Fix filesystem resource when device has long name
2019-10-24 13:24:23 -07:00
Miah Johnson
ac399b7af9
Add #to_s to etc_hosts_allow, and add tests
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-24 12:07:26 -07:00
Lance Albertson
dab91a321a
Improve testing for yum.repo in CentOS 8
...
The output for ``yum -v repolist all`` changes slightly in CentOS 8. There are
two specific changes:
1. EL8 is no longer trailing the repo name with release version and arch (i.e.
base instead of base/7/x86)
2. EL8 no longer adds a trailing newline on the last repo and instead has a line
with ``Total packages:``. This means the repo listed last will never show up.
A fix was introduced in #4566 however the tests still use CentOS 7 yum output
instead of dnf repolist output. One issue was still discovered where it was
including the ``Total packages`` line in the last repository. This includes a
regex for to work around that and fixes for the tests.
Signed-off-by: Lance Albertson <lance@osuosl.org>
2019-10-24 08:22:42 -07:00
Miah Johnson
8e31367b51
Use new mock loader, update the command name
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-23 21:42:10 -07:00
Miah Johnson
e357232db1
Since our command is df -PT
lets match it in name
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-23 21:33:29 -07:00
Ryan Davis
8d51d878f6
Fixed users resource when "Last password change" is "never".
...
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>
2019-10-23 16:49:49 -07:00
Ryan Davis
d201d1fbc2
Fixed the rest of the minitest deprecations by removing FuncTestRunResult.
...
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>
2019-10-22 12:15:28 -07:00
Ryan Davis
8d4e8c1d96
Merge pull request #4627 from inspec/zenspider/json-and-resource-cleanup
...
JSON processing and resource cleanup
2019-10-21 14:26:37 -07:00
Ryan Davis
9be2accf5d
Merge pull request #4598 from inspec/zenspider/win
...
Clean up testing in inspec exec by stripping ansi color codes from output.
2019-10-21 13:48:07 -07:00
Ryan Davis
e5e1a745cc
Fixed run_inspec_with_plugin to merge run options properly.
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-21 13:30:14 -07:00
Ryan Davis
b626c37386
Improve debugging of json parse failures in functional tests.
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-21 13:30:14 -07:00
Ryan Davis
fdaea02427
Clean up testing in inspec exec by stripping ansi color codes from output.
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-21 12:46:37 -07:00
Ryan Davis
dd3043a992
Merge pull request #4619 from inspec/zenspider/empty-tarball
...
Fix TarProvider when the tarball has empty files in it.
2019-10-21 12:31:29 -07:00
Ryan Davis
e4f4f5d1cc
Fix TarProvider when the tarball has empty files in it.
...
Added a unit test that runs in ~0.1s. Let's avoid heavy integration
tests where possible.
Fixes #4616
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-18 14:30:00 -07:00
Ryan Davis
3d604348a4
Merge pull request #4566 from inspec/zenspider/mock
...
Refactored and added an alternative test mock resource system.
2019-10-18 13:36:42 -07:00
Miah Johnson
23f31a0a72
Use a good profile with inspec check test
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-17 14:55:58 -07:00
Miah Johnson
d47d25e5cc
Merge pull request #4501 from inspec/mj/habitat-windows
...
Habitat plan for Windows
2019-10-17 13:54:50 -07:00
Miah Johnson
245f681cb8
Merge pull request #4601 from inspec/mj/tk
...
Re-organize test-kitchen files. Add BK Pipeline
2019-10-17 12:49:31 -07:00
Miah Johnson
e298f0f44b
move find_files inspec policy to kitchen directory
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-16 22:41:03 -07:00
Miah Johnson
e8ae9012ea
Move inspec-verify kitchen tests into more obvious directory
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-16 22:41:03 -07:00
Miah Johnson
97a258ae69
Use a more obvious directory structure for kitchen testing
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-16 22:41:03 -07:00
Miah Johnson
6e88b3ceb9
Fix rubocop warnings
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-16 21:01:19 -07:00
Miah Johnson
46e7b00add
Fix Rakefile and wtf
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-16 21:01:19 -07:00
Miah Johnson
9543ed8ecc
Add a Rakefile as our main Rakefile also requires 'train'
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-16 21:01:19 -07:00
Miah Johnson
4544ff30aa
Add a very simple test for Windows Habitat builds.
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-16 21:01:19 -07:00
Miah Johnson
6f460b9c3b
Remove this. It slows things down.
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-16 20:57:31 -07:00
Ryan Davis
fe34eb7869
Moved quick_resource and Fake helpers to test/helpers/resources.rb
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-16 16:54:07 -07:00
Ryan Davis
fc8ea79ad0
Fixed parsing yum output on centos8.
...
* 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>
2019-10-16 16:54:07 -07:00
Ryan Davis
201d98fd26
Refactored and added an alternative test mock resource system.
...
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>
2019-10-16 16:54:07 -07:00
Miah Johnson
d48bb56087
Every other example has the value set to 1, so I changed this for consistency.
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-16 10:15:49 -07:00
Miah Johnson
4ec9f302b0
example -> example.tmp
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-16 10:15:49 -07:00
Miah Johnson
c3eb686b51
Remove debug
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-16 10:15:49 -07:00
Miah Johnson
301905e8de
b0rk b0rk
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-16 10:15:49 -07:00
Miah Johnson
41bc8fd7a0
Clean up some tests
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-16 10:15:49 -07:00
Miah Johnson
ae3ee6f657
Finish rename of example -> example-tmp.rb
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-16 10:13:24 -07:00
Miah Johnson
a40ec993e8
Rename files to remove references to gordon
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-16 10:13:24 -07:00
Miah Johnson
df7efefc9d
mostly a search and replace for gordon -> example
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-16 10:13:24 -07:00
Clinton Wolfe
bde308f72d
Replace input to_hash method, and add unit test for it ( #4545 )
...
Replace input to_hash method, and add unit test for it
2019-10-11 10:50:27 -07:00
Clinton Wolfe
b09edbbbf9
And the YAML fixture too.
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-10-09 20:49:33 -07:00
Clinton Wolfe
8f4ff8923e
Add functional test to exercise waivers during profile inheritance
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-10-09 19:10:48 -07:00
Ryan Davis
f9ec3053aa
Refactored unit test to be more like the other one.
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-09 17:41:03 -07:00
Ryan Davis
26ffea8d39
Make my diffs pretty for jsonmin tests.
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-09 17:40:53 -07:00
Ryan Davis
f3fc535fee
Changed formatting and ordering of test data to reduce diffs on failing tests.
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-09 17:40:31 -07:00
Clinton Wolfe
d150a568cd
More test fixes
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-10-09 17:20:24 -07:00
Clinton Wolfe
3c266655ee
Refactor exec-json functional tests to reduce subprocesses
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-10-08 21:04:58 -07:00
Clinton Wolfe
ba61cd3f45
Update JSON schema to reflect new waiver keys
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-10-08 21:01:19 -07:00
Clinton Wolfe
01991cc347
Update some failing test fixtures
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-10-08 21:00:11 -07:00
Clinton Wolfe
0f5fde9729
Modify waiver input file to use 'run' subfield instead of 'skip'
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-10-08 01:03:40 -07:00
Clinton Wolfe
7516f959d1
If there is no data, alwaya return an empty hash.
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-10-08 00:31:23 -07:00
Clinton Wolfe
56c2416c57
Move waiver JSON data from per-result to per-control
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-10-08 00:25:06 -07:00
Clinton Wolfe
88ed1794cb
Revert to a small amount of duplicating to_hash in inspec/input.rb
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-10-06 19:30:37 -04:00
Miah Johnson
e48d08343b
Merge pull request #4452 from mhackethal/user-windows-fix
...
User windows fix
2019-10-04 15:30:37 -07:00
Clinton Wolfe
11074bb7ce
Adjust indentation
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-10-04 14:06:49 -04:00
Clinton Wolfe
36db8b9a7b
Rely on copy of to_hash in objects/input.rb to avoid duplication
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-10-04 14:05:19 -04:00
Clinton Wolfe
51812a9e4e
Replace to_hsh method, and add unit test for it
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-10-04 14:05:19 -04:00
Miah Johnson
416c33e056
Add name property to interface resource
...
Also some general cleanup.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-10-03 14:53:43 -07:00
Ryan Davis
6fd2db256d
Merge pull request #4560 from inspec/zenspider/apt
...
Fixed apt resource incorrectly parsing deb files w/ quoted URIs.
2019-10-03 14:50:48 -07:00
Ryan Davis
07dc5e3192
First pass at cleaning deprecations for old minitest/spec-style tests.
...
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>
2019-10-03 13:45:19 -07:00
Ryan Davis
09392943f5
Fixed apt resource incorrectly parsing deb files w/ quoted URIs.
...
Fixes #4559 .
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-03 12:55:15 -07:00
Ryan Davis
e070f151b9
Merge pull request #4557 from inspec/zenspider/rspec-expectations
...
Fixed tests to work with rspec-expectations 3.8.5+.
2019-10-03 12:51:08 -07:00
Ryan Davis
708a319ce8
Fixed tests to work with rspec-expectations 3.8.5+.
...
We were using a "private" method in our tests and they changed the
signature.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-02 18:08:19 -07:00
Ryan Davis
d1fbbada4d
Yet another bump of our skip_windows! due date.
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-30 12:23:15 -07:00
Ryan Davis
866efdf141
Merge pull request #4531 from inspec/mj/wtf_rake
...
Remove maintainers task from require
2019-09-27 14:45:21 -07:00
Ryan Davis
984e02e312
Quick fix for faraday_middleware bug introduced when bumping to faraday 0.16.0.
...
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>
2019-09-27 14:19:45 -07:00
Ryan Davis
fd1ab6fff0
Merge pull request #4513 from inspec/zenspider/plugin_loader
...
Fixed Inspec::Plugin::V2::Registry#detect_system_plugins
2019-09-26 12:29:29 -07:00
Ryan Davis
ca4844210d
Fixed Inspec::Plugin::V2::Registry#detect_system_plugins
...
+ Falls back to checking for inspec-core if inspec not found.
+ Fails gracefully if neither are found.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-25 16:10:00 -07:00
Mendy Baitelman
d44f9edc55
Merge remote-tracking branch 'upstream/master' into add-startuser-systemd-service
...
Signed-off-by: Mendy Baitelman <mendy@baitelman.com>
2019-09-24 22:30:51 -07:00
Mendy Baitelman
d45963cd91
Fix spacing
...
Signed-off-by: Mendy Baitelman <mendy@baitelman.com>
2019-09-24 21:58:55 -07:00
Mendy Baitelman
76cd799c92
Add to params for tests
...
Signed-off-by: Mendy Baitelman <mendy@baitelman.com>
2019-09-24 21:49:29 -07:00
Ryan Davis
90c4904a55
Merge pull request #4490 from inspec/zenspider/split-long-functional
...
Split and parallelize some tests to make them faster
2019-09-24 17:45:57 -07:00
Irving Popovetsky
bbb927e3dd
Remove invalid test cases for tags
...
Signed-off-by: Irving Popovetsky <irving@chef.io>
2019-09-17 15:58:12 -07:00
Irving Popovetsky
4aebe87c2e
Update unit tests to match
...
Signed-off-by: Irving Popovetsky <irving@chef.io>
2019-09-17 15:58:12 -07:00
Ryan Davis
fc1ad67ffc
More parallelization for functionals.
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-17 11:50:31 -07:00
Ryan Davis
a473a94303
Merge pull request #4493 from inspec/mj/waiver3
...
Waivers Phase 3
2019-09-16 17:50:02 -07:00
Ryan Davis
d3f81f1194
Turn on parallelism for inspec_shell_test.rb
...
Seems safe after several runs.
Takes the time down from ~180s to 22s.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-16 17:19:32 -07:00
Ryan Davis
ba462724db
Turn on parallelism for inspec_exec_test.rb
...
Seems safe after several runs.
Takes the time down from ~275s to 35s.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-16 17:19:32 -07:00
Ryan Davis
a0a7917faa
Merge pull request #4485 from inspec/zenspider/objects-inputs
...
Split out Inspec::Input functional code from the code generation code.
2019-09-16 17:03:49 -07:00
Ryan Davis
1d3c9341ec
Finished up the phase 3 waiver json output tests.
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-16 16:39:34 -07:00
Miah Johnson
5d94b0d709
Add waiver_data to json output, update assertion to show where waiver_data lives.
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-09-16 14:49:05 -07:00
Miah Johnson
168c77e472
Refactor tests.
...
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-09-16 14:49:05 -07:00
Ryan Davis
e375ea30c8
Split out Inspec::Input functional code from the code generation code.
...
Includes moving errors into Inspec::Input and Inspec::InputRegistry.
Fixes #4456 .
Fixes #4473 .
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-13 17:12:20 -07:00
mhackethal
c3270b537a
update user_test.rb
...
Signed-off-by: mhackethal <mh@it31.de>
2019-09-13 21:19:20 +02:00
mhackethal
0b76859728
adjust user_test.rb
2019-09-13 20:45:54 +02:00
mhackethal
9e06f02e27
Update user_test.rb
...
adjust expectation of methods to be "nil" on windows
2019-09-13 13:14:34 +02:00
Miah Johnson
008ac9705b
Merge pull request #4484 from timgates42/feature/typo_becuase
...
Fix simple typo: becuase -> because
2019-09-12 17:25:37 -07:00
Tim Gates
f1e88ca65f
Fix simple typo: becuase -> because
...
Obvious Fix.
2019-09-13 09:30:00 +10:00
mhackethal
7ac468df5b
first test. Signed-off-by: mhackethal <mh@it31.de>
2019-09-12 21:44:13 +02:00
Clinton Wolfe
8132aaf85c
Merge pull request #3844 from inspec/ja/add-error-output-to-json-command
...
json resource: Add handling for `command:` error
2019-09-11 11:12:26 -04:00
Ryan Davis
a2b6517f9a
skip a test when on windows
...
(and make it more compatible for when it does work)
Blocked by #4465 .
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-10 14:19:42 -07:00
Ryan Davis
fcfcc354fe
Reworked test cases and impl to only respond to output, not exit code.
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-10 14:19:42 -07:00
Ryan Davis
dfce5e722f
Merge pull request #4427 from inspec/cw/waivers-overlay
...
waivers: functional test fixture and eval-time skipping
2019-09-09 18:41:37 -07:00
Ryan Davis
f5bbfe5fac
Merge pull request #4365 from inspec/zenspider/the-need-for-speed
...
Make inspec much faster for most commands.
2019-09-09 18:02:10 -07:00
Jerry Aldrich
0e1b3fa65a
json resource: Add handling for command:
error
...
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>
2019-09-09 15:16:34 -07:00
Ryan Davis
79b9c3cbad
Merge pull request #4451 from inspec/zenspider/fix-tarball-decoding
...
Try to decode archive contents to UTF-8 to avoid encoding corruption.
2019-09-09 11:13:48 -07:00
Clinton Wolfe
5d94440823
Fix logic error for future expiring waivers
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-09-09 11:29:26 -04:00
Clinton Wolfe
43bc7e0343
Modify @__skip_rule to distinguish only_if and waiver, and force waiver to win
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-09-09 11:29:26 -04:00
Clinton Wolfe
0db0a2bfdc
Don't assume waiver_ prefix in waiver files
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-09-09 11:29:26 -04:00
Clinton Wolfe
718e205cf2
Alter expiration_date behavior to match spec
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-09-09 11:29:26 -04:00
Clinton Wolfe
ff209b4bae
Refactor control_id lookup in waiver test file
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-09-09 11:29:26 -04:00
Clinton Wolfe
eb1ec437d7
Linting and test number corrections
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-09-09 11:29:26 -04:00
Clinton Wolfe
5891c9aee9
A failing functional test to skip waivered controls
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-09-09 11:29:26 -04:00
Clinton Wolfe
77b4e45175
Test fixture profile and input file for waivers
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-09-09 11:29:26 -04:00
mhackethal
6772f0b301
Update user_test.rb
2019-09-06 11:42:51 +02:00
Ryan Davis
d19d0bfd7c
Refactor tests for TarProvider and ZipProvider a bit.
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-06 00:42:36 -07:00
Ryan Davis
6e821e787e
Save off supports[:os] and restore it after each test.
...
This fixes some other tests that require supports[:os] to be correct.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-04 15:44:26 -07:00
Ryan Davis
6296fdc688
Replace backticks in test descriptions with single-quotes.
...
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>
2019-09-04 15:44:26 -07:00
Ryan Davis
3b69967cc8
Fixed a bug in checking supports (strings vs symbols)
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-04 15:44:26 -07:00
Ryan Davis
b6bfeffd9e
Make inspec much faster for most commands.
...
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.
2019-09-04 15:44:26 -07:00
Lance Albertson
1e94e3503e
Fix for postfix_conf when using a non-standard config location
...
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>
2019-09-03 15:28:44 -07:00
Ryan Davis
49330e8a8e
Extended skip_windows to the end of September.
...
This is getting depressing...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-09-03 12:08:41 -07:00
kekaichinose
d33870b635
Merge pull request #4214 from inspec/zenspider/fix_nil_file
...
Fixed file resource raising UndefinedMethod on source_path
2019-08-30 13:19:54 -07:00
mhackethal
204c41bfd1
Update users.rb to include new attributes
2019-08-30 22:07:36 +02:00
Clinton Wolfe
a6bd7ec4b5
Merge pull request #4401 from inspec/cw/input-from-cli
...
inputs: Accept bare input from the command line
2019-08-28 15:41:21 -04:00
Clinton Wolfe
51de566d93
Assert adjustments
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-28 13:25:49 -04:00
Clinton Wolfe
82acec957e
Add API for fetching plugin vconfig values.
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-28 13:25:49 -04:00
Clinton Wolfe
38f3469ee3
Validation for the plugins area of the config file
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-28 13:25:49 -04:00
Clinton Wolfe
c6d355e4f7
Accept version 1.2 for config file format
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-28 13:25:49 -04:00
Clinton Wolfe
e346b16114
Tighten help listing assertion and adjust chomp
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-28 13:03:42 -04:00
Clinton Wolfe
296158c447
Implementation and functional tests for the --input CLI option
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-28 13:03:42 -04:00
Clinton Wolfe
512189a06b
Add CLI option and check in help
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-28 12:53:27 -04:00
Clinton Wolfe
777f1a1bff
Adjust checking for version when installing latest in unit test
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-27 21:29:42 -04:00
Clinton Wolfe
18640dd70c
We do now include the version in the float fixture, for one thing
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-27 21:29:42 -04:00
Clinton Wolfe
16fecbefb5
Return version number when listing plugins; correct UX coloration
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-27 21:29:42 -04:00
Clinton Wolfe
f90a4c633d
Merge pull request #4419 from inspec/cw/check-enforce-version
...
inspec check: warn if inspec_version is not supported by current inspec
2019-08-27 20:03:19 -04:00
Clinton Wolfe
c6f33b3526
Add functional test for inspec check with runtime constraint
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-26 23:19:18 -04:00
Clinton Wolfe
714dc26006
Add unit test and include runtime version check in metadata.valid
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-26 23:05:49 -04:00
Clinton Wolfe
424318defa
Stringify expected test outcomes for inputs
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-26 14:56:39 -04:00
Clinton Wolfe
f59497d982
Don't open a new train connect, and make an issue for improving helper support
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-26 13:12:30 -04:00
Clinton Wolfe
fffb776982
Add newline
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-22 21:53:02 -04:00
Clinton Wolfe
d462ac3de5
Convert runner api script layout ot heredoc
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-22 21:51:50 -04:00
Ryan Davis
1dd1efa03f
test change for bad resource/backend combo.
...
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>
2019-08-20 13:25:21 -07:00
Ryan Davis
7273a7380f
Fixed file resource raising UndefinedMethod on source_path
...
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>
2019-08-20 13:25:21 -07:00
Clinton Wolfe
1f49ae4046
Skip runner API tests on windows
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-19 18:15:50 -04:00
Clinton Wolfe
cc4aa16212
Add test framework to run Runner API input tests
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-08-19 13:51:51 -04:00
Clinton Wolfe
8dc350bc6c
Add a Postfix-specific configuration testing resource ( #4378 )
...
Add a Postfix-specific configuration testing resource
2019-08-19 12:38:17 -04:00
Ryan Davis
4b3f11697d
Removing ParallelTest so as to not encourage anyone from using it.
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-08-09 16:17:13 -07:00
Ryan Davis
1266a65f28
Moved the osx? guard below minitest/autorun.
...
I didn't hit this because I use `minitest` to run my tests, not `m`.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-08-09 16:16:26 -07:00
David Gasper
ee2806a342
Fix RuboCop issues
...
Signed-off-by: David Gasper <dmgasper@osuosl.org>
2019-08-08 14:32:19 -07:00
David Gasper
52ae5e434b
Add docs and unit tests, remove .travis.yml
...
Signed-off-by: David Gasper <dmgasper@osuosl.org>
2019-08-08 13:54:35 -07:00
Clinton Wolfe
95e6bcb317
Modified DarwinGroup to collect all users properly. ( #4343 )
...
group resource: Modified DarwinGroup to collect all users properly on macos
2019-08-08 11:55:48 -04:00
Clinton Wolfe
c28dd8f9ec
Add startuser windows service ( #4363 )
...
Add startuser windows service
2019-08-08 11:32:39 -04:00
Ryan Davis
374e365c02
Modified DarwinGroup to collect all users properly.
...
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>
2019-08-07 20:27:13 -07:00
Mendy Baitelman
b2c29da936
Use dbus for testing
...
Signed-off-by: Mendy Baitelman <mendy@baitelman.com>
2019-08-06 21:34:46 -07:00
Mendy Baitelman
db58322d41
Add startname to systemd server
...
Signed-off-by: Mendy Baitelman <mendy@baitelman.com>
2019-08-06 21:04:52 -07:00
Mendy Baitelman
4d990865a1
Add to mock_loader
...
Signed-off-by: Mendy Baitelman <mendy@baitelman.com>
2019-08-06 19:44:02 -07:00
Mendy Baitelman
988357aad1
Fix tests
...
Signed-off-by: Mendy Baitelman <mendy@baitelman.com>
2019-08-06 18:58:03 -07:00
Ryan Davis
d295455df6
Fix license functional tests when run on buildkite.
...
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>
2019-08-06 15:50:01 -07:00
Ryan Davis
55f2747ee1
Remove timebombs from 2 functional license tests.
...
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>
2019-08-06 15:02:37 -07:00
Ryan Davis
b570e0cc74
Bump skipped license tests until 8/16.
...
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>
2019-07-31 16:44:49 -07:00
Ryan Davis
99638d8de9
Remove timebomb on skip_until.
...
It has been valuable and should push up to minitest.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-31 12:24:57 -07:00
Clinton Wolfe
88898ce7a9
Linting
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:42:24 -04:00
Clinton Wolfe
f00e741999
PR feedback
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:38:02 -04:00
Clinton Wolfe
c03862fe7b
Code climate updates
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:38:02 -04:00
Clinton Wolfe
4f6d296a22
The error case in which the path does not exist
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:38:02 -04:00
Clinton Wolfe
860d21a370
Test for ./
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:38:02 -04:00
Clinton Wolfe
31bedf7b37
Empty-string edge case
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:38:02 -04:00
Clinton Wolfe
fab58b590e
Combo relative test in place
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:38:02 -04:00
Clinton Wolfe
e9ef8e25a3
Deep dependency works
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:38:02 -04:00
Clinton Wolfe
80241ec971
Passing basic test harness
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:38:02 -04:00
Clinton Wolfe
c257763de6
Linting
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:38:02 -04:00
Clinton Wolfe
aa81012013
Rework tests to be fixture-based, not generated per-run
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:38:02 -04:00
Clinton Wolfe
12fcb24932
Experiment with git subrepo storage
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:36:20 -04:00
Clinton Wolfe
0e32d2429f
Rename path_within_repo option to relative_path
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:36:20 -04:00
Clinton Wolfe
f1a892c857
Move existing git fixture profile to a directory for git-fetchers
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:36:20 -04:00
Clinton Wolfe
9c1fa967fd
Rename profile_path to path_within_repo
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-30 13:36:20 -04:00
Jerry Aldrich
3e1d08cafe
Add support for relative paths to the Git fetcher
...
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>
2019-07-30 13:36:20 -04:00
Ryan Davis
2d5fdabf86
Merge pull request #4337 from inspec/zenspider/remove-version-checking
...
Removed lib/inspec/utils/latest_version.rb and associated code.
2019-07-29 12:47:37 -07:00
Ryan Davis
3d6a4143a1
Removed lib/inspec/utils/latest_version.rb and associated code.
...
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>
2019-07-29 11:57:08 -07:00
Ryan Davis
1e2da6acc2
Moved another non-test to test/unit/mock/files
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-29 11:42:30 -07:00
Ryan Davis
4df8072665
These tests probably never passed.
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-29 11:42:30 -07:00
Ryan Davis
be11d8898d
Found more tests that we've probably never actually run.
...
*sigh*
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-29 11:42:30 -07:00
Clinton Wolfe
be91550343
windows_task: Fix handling of multiple triggers ( #4242 )
...
windows_task: Fix handling of multiple triggers
2019-07-29 13:00:16 -04:00
Ryan Davis
bcf3aa841c
Skip failures from BK run.
...
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>
2019-07-24 18:59:01 -07:00
Ryan Davis
917a531a92
Skipped all failing tests on windows AT the failures site.
...
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>
2019-07-24 18:09:08 -07:00
Ryan Davis
bd16b766fa
Renamed do_shell_c to assert_shell_c to make failures point to the right place.
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-24 18:06:25 -07:00
Ryan Davis
c6837a3915
Moved skip_windows! to top helper and extended date to end of next month.
...
Fixed up requires in v2/installer_test.rb so it sees the top helper.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-24 18:06:25 -07:00
Ryan Davis
6dfa1d8310
Um. No.
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-24 18:06:25 -07:00
Ryan Davis
18ce4850f0
Initial pass to clean up functional testing wrt exit codes and output.
...
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>
2019-07-24 18:06:25 -07:00
Ryan Davis
bd79e9c895
Merge pull request #4316 from inspec/zenspider/fix-file-aws
...
Fix exceptions when resources are used with incompatible transports
2019-07-23 11:47:13 -07:00
Ryan Davis
7a1e1bb775
Merge pull request #4230 from yeoldegrove/sys_info
...
add resource sys_info.manufacturer and sys_info.model
2019-07-22 14:39:28 -07:00
Ryan Davis
7de549577c
Return keys are really nice.
...
They make code more readable by visually separating different sections
of text.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-22 14:19:15 -07:00
Ryan Davis
d3df69213b
Fix handling using resources with incompatible resources (eg file + aws).
...
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-22 14:19:15 -07:00
Ryan Davis
14c245eccb
Refactoring inspec_exec_test.rb
...
+ Moved exit checks to be last.
+ Refactored the IO parts. WHY do the same thing over and over?!?
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-07-22 14:19:15 -07:00
Clinton Wolfe
12b577fccd
linting
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-22 15:17:30 -04:00
Clinton Wolfe
b37d165878
Unit test for suppressing doc install
...
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-07-22 15:17:30 -04:00
Eike Waldt
da4168f83d
add darwin/OSX tests
...
Signed-off-by: Eike Waldt <waldt@b1-systems.de>
2019-07-16 21:53:19 +02:00
Eike Waldt
b47cf6e80e
change from dmidecode to /sys/class/dmi/id/*
...
(kudos to Seife)
Signed-off-by: Eike Waldt <waldt@b1-systems.de>
2019-07-16 21:53:03 +02:00
Eike Waldt
9c06a0c8e2
refactor tests for resource sys_info.manufacturer and sys_info.model
...
Signed-off-by: Eike Waldt <waldt@b1-systems.de>
2019-07-16 21:02:52 +02:00
Eike Waldt
9278d8109d
add tests for resource sys_info.manufacturer and sys_info.model
...
Signed-off-by: Eike Waldt <waldt@b1-systems.de>
2019-07-16 21:02:45 +02:00