Commit graph

6293 commits

Author SHA1 Message Date
Ryan Davis
e72f3f34aa Skip more_permissive_than? file_test because broken only on CI.
Trying to fix file_test failure that only happens on travis.

The "mock" file in question is supposed to have a stat of 644, but
actually has 664 but only on travis-ci.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 03:19:46 -07:00
Ryan Davis
bc028893e8 Fixed inconsistent use of MT::S's "expect" method (eg _)
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 02:26:07 -07:00
Ryan Davis
9b0d8edfb4 Fixed another bad test interaction.
This time between:

+ PluginManagerCliDefinitionTests#(?:test_plugin_registered
+ PluginLoaderTests#test_load_mock_plugin_by_gem

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 02:26:07 -07:00
Ryan Davis
3ba7aecffb Skips the one test that hits rspec directly and causes mocha to blow out afterwards
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 02:26:07 -07:00
Ryan Davis
ec9121dafe Cleanup long lines for readability / debugging.
Also asked a couple q's in TODO lines.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 02:26:07 -07:00
Ryan Davis
1b01aa7a57 Removed all redundant INSPEC_CONFIG_DIR setup from tests.
Pushed up to setup

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 02:26:07 -07:00
Ryan Davis
8f3e1a0fe5 Fixes test failure interaction between Loader and Installer tests.
Specifically, if these were run in this order:

+ PluginLoaderTests#test_load_mock_plugin_by_gem
+ PluginInstallerInstallationTests#test_install_a_gem_from_local_file

the latter would fail.

The failure was in test setup. The solution was partially to crib off
of and normalize with LoaderTest setup/teardown and partially to set extra things.

Specifically:

+ HOME wasn't being set so it was finding my ~/.inspec/plugins.json
+ ENV wasn't being reset for Gem.paths
+ Installer wasn't being reset correctly, so plugins were known across tests.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 02:26:07 -07:00
Ryan Davis
8ec76e666e Fixed assignment to RUBY_VERSION.
Lost in a sea of deprecation warnings.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 02:26:07 -07:00
Ryan Davis
03dd753ad3 Omit user plugins for loader test failure.
Fixes #4053

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 02:26:07 -07:00
Ryan Davis
a53d118b3f Punting on 2 tests in inspec-plugin-manager-cli.
These two tests make assumptions that are not valid when bundler is
not being used.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 02:26:07 -07:00
Ryan Davis
84fd8af96a Added SLOW=1 env var to run slow installer tests, otherwise skipped
+ Added SLOW=1 to appveyor (I hope?) and travis.
+ Off by default.

Speeds up installer tests from ~5.5 seconds to ~0.5 seconds.

Once this is established, we can push this up to the main helper and
generalize if it works out for us.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 02:26:07 -07:00
Ryan Davis
92d8cd4df9 Fixed two test order dependency bugs.
+ Do extra cleanup of loaded_specs for the dependencies.
+ Ensure rake is actually activated.

Fixes #4030.
Fixes #4026.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 02:26:07 -07:00
Ryan Davis
4d4e8e1feb Turn off rdoc/ri generation in plugins.
As commented, I'm happy to push this to our tests, but it does seem
odd that we'd install rdoc/ri for plugins.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 02:26:07 -07:00
Ryan Davis
e16657883a Fixed referenced urls so we can find the cited code again.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 02:26:06 -07:00
Ryan Davis
7935d5553d Fix how we're running inspec to include local lib dir.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 02:26:06 -07:00
Ryan Davis
e7348f4d72 Add minitest/hell and parallelize_me! to the plugin tests.
We already do this in test/helper.rb so we might as well do it here.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 02:26:06 -07:00
Ryan Davis
0c9644c1c2 Use RbConfig::CONFIG instead of Gem.ruby_version for plugin_gem_path
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 02:26:06 -07:00
Ryan Davis
e7426658fd Fixed rake test:isolated task. The glob was far too limited.
Extracted a GLOBS const so it can be reused and only updated in one
place.

Added test:list that prints out all known test files.

Changed test:isolated to use the glob, AND to use system (sh would
fail out on the first failing test, so much of the looping mechanism
was redundant. I also changed the loop to run all of the tests
regardless of outcome, so you can see all the failures.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 02:26:06 -07:00
Ryan Davis
35aceeb9ba Fixed rake test:resources task. The path was no longer valid.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 02:26:06 -07:00
Ryan Davis
6235c3f658 Fixed missing requires
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 02:26:06 -07:00
Ryan Davis
cdf95cd160 Fixed 3 failures in cmp matcher.
+ 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>
2019-05-17 02:26:06 -07:00
Ryan Davis
b80dfa2cbd Tests for cmp.
Doesn't test any of the aux methods.

This uncovers ~3 errors in the code. Not fixed.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 02:26:06 -07:00
Ryan Davis
bc249a78cb Changed cmp matcher to use send.
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>
2019-05-17 02:26:06 -07:00
Ryan Davis
06ead63972 Minor cleanup and a todo test.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 02:26:06 -07:00
Ryan Davis
1ed4128942 Functional helper let changes.
Moved exec_inspec to inspec_path.
Added new exec_inspec that invokes ruby w/ -Ilib (expanded).

Decouples from bundler and/or needing inspec-bin to be installed.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 02:26:06 -07:00
Ryan Davis
80cfc419f8 Use Inspec::VERSION directly to decouple from bundler.
Can also try to use the bundler version first and then fall back to
VERSION... but VERSION is absolutely free.

Happy to push an edit to this to remove the comment or fold it in.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 02:26:06 -07:00
Ryan Davis
427d59f13f Fixes loading of Telemetry::DataSeries (and neighbors) in isolation.
Fixes telemetry tests when run individually.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-17 02:26:06 -07:00
Chef Expeditor
e251ebf22b
Bump version to 4.4.27 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2019-05-16 23:57:46 +00:00
Miah Johnson
a3f4c25922
Merge pull request #4085 from burtlo/fix/init-plugin
Updates the init profile description to show proper usage
2019-05-16 16:57:29 -07:00
Lynn Frank
4511ac6aaf Updates the init plugin desc to show proper usage
Obvious fix.
2019-05-16 16:43:05 -05:00
Chef Expeditor
506cb5a6a2
Bump version to 4.4.26 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2019-05-16 18:45:27 +00:00
Miah Johnson
ef902ced88
Merge pull request #4082 from inspec/mj/fkg
`rubocop -a` on kitchen directory
2019-05-16 11:45:14 -07:00
Miah Johnson
e2ccb9ae69 rubocop -a
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-16 00:29:16 -07:00
Chef Expeditor
67929db658
Bump version to 4.4.25 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2019-05-15 23:50:31 +00:00
Miah Johnson
67471cc308
Merge pull request #4078 from inspec/resolve_deprecation_warning
Remove the deprecated linux_kernel_parameter resource test
2019-05-15 16:50:01 -07:00
Tim Smith
0122ee8e60 Remove the deprecated linux_kernel_parameter resource test
This was testing serverspec compatibility, but those days are long past us and this is a deprecated resource now. This will quiet our tests up a bit.

Signed-off-by: Tim Smith <tsmith@chef.io>
2019-05-15 16:39:29 -07:00
Chef Expeditor
39dd4128d0
Bump version to 4.4.24 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2019-05-15 22:55:39 +00:00
Miah Johnson
970e151759
Merge pull request #4077 from inspec/local_testing
Build the InSpec gem directly in Kitchen so we can run locally
2019-05-15 15:55:22 -07:00
Tim Smith
ed8dbed517 Fix the box name for the macos boxes as well
The new boxes follow Apple's brand changes

Signed-off-by: Tim Smith <tsmith@chef.io>
2019-05-15 15:50:27 -07:00
Tim Smith
f91284a80f Don't use ERB where it isn't necessary
No need for this array

Signed-off-by: Tim Smith <tsmith@chef.io>
2019-05-15 15:47:19 -07:00
Tim Smith
364a669e6b Mac OS X -> macOS
Make Apple happy

Signed-off-by: Tim Smith <tsmith@chef.io>
2019-05-15 15:46:56 -07:00
Tim Smith
b50f923a91 Remove Solaris 10 testing
Chef doesn't run on Solaris 10 anymore so this won't work.

Signed-off-by: Tim Smith <tsmith@chef.io>
2019-05-15 15:46:38 -07:00
Tim Smith
a05699c5c3 Build the InSpec gem directly in Kitchen so we can run locally
Before you had to kick off kitchen via Rake as the Rake task build the local gem we injected into the cookbook. Now we do it within Test Kitchen using a feature that didn't exist when this was all written. Also --output is your friend and greatly reduces the complexity of all this.

Signed-off-by: Tim Smith <tsmith@chef.io>
2019-05-15 15:46:09 -07:00
Chef Expeditor
77f0efd1e8
Bump version to 4.4.23 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2019-05-15 22:40:48 +00:00
Ryan Davis
76cc58c559
Merge pull request #4076 from inspec/lcg/kitchen-rake-testing
Add kitchen rake testing
2019-05-15 15:40:31 -07:00
Chef Expeditor
043790dcb3
Bump version to 4.4.22 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2019-05-15 22:40:03 +00:00
Ryan Davis
ed6062a191
Merge pull request #4074 from inspec/tk_cleanup
Cleanup and fix failing Kitchen tests
2019-05-15 15:39:47 -07:00
Lamont Granquist
bb731fdbc9 Add kitchen rake testing
I'd suggest starting to structure kitchen testing like this with a
directory and subdirs to keep the kitchen testing gems out of the
root Gemfile entirely.

This still mounts the root dir in /inspec so the root Gemfile
is still what you're running the rake tests against.

By having an extra layer of subdirs, then you can split up different
use cases like the rake-testing vs. the audit cookbook testing.
Otherwise it'll be a mess of having to manage different kitchen.yml
files that require way too many different drivers/provisioners/verifiers
2019-05-15 15:30:26 -07:00
Tim Smith
9930e8d05d Test on Ruby 2.6.3 in Travis
Signed-off-by: Tim Smith <tsmith@chef.io>
2019-05-15 14:51:08 -07:00
Tim Smith
96ed4988e3 Temporarily set TK to 1.x
Until we figure out the licensing issues

Signed-off-by: Tim Smith <tsmith@chef.io>
2019-05-15 14:50:54 -07:00