Commit graph

1801 commits

Author SHA1 Message Date
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