Commit graph

6537 commits

Author SHA1 Message Date
Miah Johnson
69151ced56
Merge pull request #4119 from inspec/mj/missing_requires
Fix missing requires in toml, postgres_conf resources
2019-05-20 12:56:59 -07:00
Chef Expeditor
da57262892
Bump version to 4.4.36 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2019-05-20 19:56:40 +00:00
Miah Johnson
b6c86bfad8
Merge pull request #4118 from inspec/mj/rtjson
json was required twice.
2019-05-20 12:56:27 -07:00
Miah Johnson
94f14bae20 Fix missing requires in toml, postgres_conf resources
toml was missing json
postgres_conf was missing object_traversal

Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-19 11:31:59 -07:00
Miah Johnson
e514fbff90 json was required twice.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-19 11:02:02 -07:00
Ryan Davis
7e5c27410e This is one place where rubocop and I strongly disagree.
Using self.something makes it more clear. Sometimes that is necessary.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-18 21:04:27 -07:00
Ryan Davis
22a3ee5855 Fixed missing requires.
Telemetry tests were hitting inspec/config via a different route and
inspec/config uses forwardable w/o requiring.

lib/plugins/inspec-compliance/test/unit/api_test.rb had a test that
had never run before and required webmock.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-18 21:02:13 -07:00
Chef Expeditor
7fb177a691
Bump version to 4.4.35 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2019-05-19 01:08:41 +00:00
Ryan Davis
53a6d7842b
Merge pull request #4111 from inspec/zenspider/loader_test_fix
Fixes a test interaction bug between installer and loader.
2019-05-18 18:08:28 -07:00
Ryan Davis
10c7924758 Make the API header stay at the top of the page so URLS w/ #slugs work.
Right now the header being fixed to the window obscures the section
header for any API doco we provide. Not friendly to the user.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-18 16:54:08 -07:00
Ryan Davis
03a1fba565 Stop using method(...).call(...)
Use send. It's **vastly** faster:

```
Comparison:
                send:  6364383.9 i/s
         method+call:  2530347.8 i/s - 2.52x  slower
```

Also removed a bunch of unnecessary to_sym's. Ruby doesn't care.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-18 16:53:33 -07:00
Ryan Davis
fe82931b39 Just use math.
I don't know what the reasoning is behind the rjust & the format
call... String converting between octal to binary in order to get an
integer? Instead, this converts from an octal string and uses
straight-forward binary manipulation and logic.

Please avoid `cond ? false : true` like constructs. Use `!cond` instead.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-18 15:50:01 -07:00
Ryan Davis
8c56477f02 Fixes a test interaction bug between installer and loader.
Not sure how it was supposed to work in the first place. The plugin in
question depends on ordinal_array and that wasn't in that fixture dir.
Switching to 2 is all it apparently needed.

This does cause yet another double-load warning (VERSION already
defined). I don't know how we're supposed to get around that with the
way we've set up these tests.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-18 15:45:22 -07:00
Chef Expeditor
d665efc8c8
Bump version to 4.4.34 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2019-05-18 22:44:42 +00:00
Ryan Davis
3bd95774dd
Merge pull request #4110 from inspec/zenspider/fix_my_mistake
This needed to be a flat_map because :profiles was an array.
2019-05-18 15:44:25 -07:00
Ryan Davis
62890e4809 This needed to be a flat_map because :profiles was an array.
Entirely on me. Pushing this through to rectify my mistake in review.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-18 15:16:09 -07:00
Chef Expeditor
f1654c02d2
Bump version to 4.4.33 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2019-05-18 22:01:01 +00:00
Ryan Davis
8ea1889001
Merge pull request #4079 from inspec/mj/cli_warn
Fix @unique_controls uninitialized warning
2019-05-18 15:00:47 -07:00
Chef Expeditor
87db267ef1
Bump version to 4.4.32 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2019-05-18 21:29:49 +00:00
Ryan Davis
28c72cf6b7
Merge pull request #4103 from inspec/zenspider/no_more_logging
Turn off logging in our test.
2019-05-18 14:29:33 -07:00
Ryan Davis
892641f69d Delete test/unit/helper.rb
I isn't used anywhere.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-18 14:21:33 -07:00
Ryan Davis
7082fbef3d Add support for Gemfile.local
Let me use _my_ tooling!

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-18 13:19:56 -07:00
Ryan Davis
9b7c292d4c Use IO globals instead of IO constants.
Helps testing and lots of other things if we only use $stdout/$stderr.

STDOUT/STDERR should only be used to restore the globals.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-18 12:48:18 -07:00
Ryan Davis
40d74cb5be Turn off logging after the configure_logger tests.
Please do not increase the amount of noise our tests have from here on out.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-18 12:48:18 -07:00
Dan Mirsky
1e20e2998e Fix github tree url regex. Add period for repo
Signed-off-by: Dan Mirsky <mirskiy@gmail.com>
2019-05-18 10:50:39 -07:00
Miah Johnson
a3c55ea49f We didn't need a Set!
Update this based on feedback from @zenspider

Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-18 00:00:59 -07:00
Miah Johnson
2181b9a76b Ensure AwsResourceMixin returns a resource name
`@__resource_name` may be nil, so return our resource name via
`self.class.to_s`. This isn't perfect, is there something better to use
here?

.[2019-05-17T20:14:37-07:00] WARN: DEPRECATION: AWS resources shipped with core InSpec are being to moved to a resource pack for faster iteration. Please update your profiles to depend on git@github.com:inspec/inspec-aws.git . Resource 'AwsElbs'

AwsElbs? This is the `aws_elbs` resource, this is not user-friendly. :(

Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-17 20:15:21 -07:00
Chef Expeditor
a0f9487f9d
Bump version to 4.4.31 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2019-05-18 00:55:15 +00:00
Miah Johnson
ff285b391d
Merge pull request #4101 from inspec/mj/key
Use #key? rather than #has_key? in profile_name ternary
2019-05-17 17:54:59 -07:00
Miah Johnson
3db8d93fe5 Use #key? rather than #has_key? in profile_name ternary
lib/inspec/profile_context.rb:28:29: C: [Corrected] Style/PreferredHashMethods: Use Hash#key? instead of Hash#has_key?.
      @profile_name = @conf.has_key?('profile') ? @conf['profile'].profile_name : @profile_id
                            ^^^^^^^^

355 files inspected, 1 offense detected, 1 offense corrected

Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-17 16:39:14 -07:00
Chef Expeditor
40ef08183b
Bump version to 4.4.30 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2019-05-17 22:21:51 +00:00
Miah Johnson
ee899d694f
Merge pull request #4081 from inspec/mj/profile_context
Fix @profile_name not initialized
2019-05-17 15:21:38 -07:00
Chef Expeditor
b51608e629
Bump version to 4.4.29 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2019-05-17 22:20:59 +00:00
Miah Johnson
0e896221e5
Merge pull request #4083 from inspec/mj/circular-telemetry
Fix circular require in telemetry
2019-05-17 15:20:43 -07:00
Chef Expeditor
a4f039adff
Bump version to 4.4.28 by Chef Expeditor
Obvious fix; these changes are the result of automation not creative thinking.
2019-05-17 21:38:26 +00:00
Miah Johnson
ea248d84ac
Merge pull request #4031 from inspec/zenspider/test_cleanup
Fix up sporadically failing tests and ensure tests can run independently
2019-05-17 14:38:10 -07:00
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