Commit graph

1010 commits

Author SHA1 Message Date
Clinton Wolfe
82f910e320 Plugin type declaration and unit test
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-06-06 12:51:21 -04:00
Ryan Davis
11638d36dd Now that we aren't parallelizing, start bringing back skipped tests.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-06-03 14:12:06 -07:00
Miah Johnson
a5c8021227 don't remove this leading newline =)
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-31 11:43:44 -07:00
Miah Johnson
2a1b1d8e88 Remove all leading newlines.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-31 11:43:44 -07:00
Ryan Davis
4790e288a0
Merge pull request #4142 from inspec/zenspider/clean_unnecessary_requires
Clean unnecessary requires
2019-05-29 18:33:06 -07:00
Ryan Davis
be125598c8 Additional whitespace cleanup.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 17:58:02 -07:00
Ryan Davis
82c9aa6ed6 Got the rest of the tests to pass.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 17:58:02 -07:00
Ryan Davis
9ec91484fc Get all non-resource tests fixed again.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 17:58:02 -07:00
Ryan Davis
de8258c9f7 Get yaml_test.rb working
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 17:58:02 -07:00
Ryan Davis
761f48e63c Get user_test.rb working
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 17:58:02 -07:00
Ryan Davis
adaf2bc364 Removed aws resource requiring from test/helper and inspec/resource.
This speeds up parallel unit test runs from a very consistent 2:49 to
a very consistent 1:53, or a 33% reduction.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 17:58:02 -07:00
Ryan Davis
23f8a1e30c Explicitly set default_external to UTF-8 for windows testing.
This fixes 4 failures having to do with encoding mismatch.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 15:48:37 -07:00
Miah Johnson
6c19e81a06 Remove authors tags from source files.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-28 12:47:39 -07:00
Clinton Wolfe
c8f0de05af
inspec check: Send log to STDERR when running with --format json (#4001)
inspec check: Send log to STDERR when running with --format json
2019-05-28 14:44:44 -04:00
Miah Johnson
2215bb0570 Update all requires pointing to util/
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-28 11:30:16 -07:00
Ryan Davis
f36a7c8061 No tabs.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-25 03:40:36 -07:00
Miah Johnson
fb0993e0f2
Merge pull request #4089 from mirskiy/github_url_regex_bug
Fix github url regex. Add period for repo
2019-05-21 12:45:18 -07:00
Miah Johnson
27ee7a1a63
Merge pull request #4107 from inspec/zenspider/telemetry_requires
Minor require cleanup for telemetry.
2019-05-20 13:10:30 -07:00
Ryan Davis
9c6965b2ed Minor require cleanup for telemetry.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-20 13:09:38 -07:00
Miah Johnson
c7218a991a
Merge pull request #4108 from inspec/zenspider/remove_test_unit_helper
Delete test/unit/helper.rb
2019-05-20 13:08:07 -07:00
Miah Johnson
36029da0a3
Merge pull request #4116 from inspec/zenspider/clean_more_requires
Clean more requires
2019-05-20 13:07:04 -07:00
Ryan Davis
e1061f41f2 Clean more requires
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-20 13:01:18 -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
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
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
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
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
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
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
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
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
Miah Johnson
832dc4a1c9 This test was too intimate.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-15 19:30:39 -07:00
Ryan Davis
fa7a8c9e19 Normalizing two test declarations.
These tests both involve dynamic un-rooted classes. As such, they have
no name and thus print like #<Class:0xXXXXXXXX:...>. I switched one to
a describe instead of Class.new(Minitest::Test) and the other I
stringified the anonymous class.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-14 23:27:18 -07:00
Ryan Davis
6adf1d2560 Remove all byebug requires in code.
Please don't leave debugging remnants in the code.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-14 23:24:14 -07:00
Miah Johnson
bf28482350
Merge pull request #4043 from inspec/ap/no-resource-capitalize
Wrap resources in backticks and remove resource name capitalizing
2019-05-08 23:49:25 -07:00
Miah Johnson
11b8da3283
Merge branch 'master' into mj/encoding 2019-05-08 12:59:55 -07:00
Miah Johnson
1edfeae5f4
Merge pull request #4025 from inspec/mj/3849
Enable user telemetry opt-in / opt-out on cli
2019-05-08 12:56:29 -07:00
Clinton Wolfe
b3e5788d2a
Merge pull request #4036 from inspec/mj/dst
Add missing tests for DataSeries#enabled? #disable
2019-05-08 15:49:19 -04:00
Miah Johnson
37ea6f2f77
Merge pull request #4023 from inspec/zenspider/minitest
Modernize use of Minitest.
2019-05-08 12:23:49 -07:00
Alex Pop
d7f06f98f1 Wrap resources in backticks and remove resource name capitalizing
Signed-off-by: Alex Pop <alexpop@users.noreply.github.com>
2019-05-08 20:17:51 +01:00