Commit graph

999 commits

Author SHA1 Message Date
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
Miah Johnson
5a0913e3f6 Add missing tests for DataSeries#enabled? #disable
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-08 00:44:51 -07:00
Miah Johnson
d000f20f34 Update Collector#reset to clear telemetry_toggled_off
Updated the name of #reset -> #reset! as we are modifying state of a
singeton.

Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-08 00:36:45 -07:00
Miah Johnson
871b0e9a38 Ensure telemetry can be disabled
The #disable_telemetry method now toggles @telemetry_toggle_off.
The @telemetry_toggle_off is defaulted to false

The #telemetry_enabled? method now checks @telemetry_toggle_off
and we generally check the configuration. We do not flip
@telemetry_toggle_off based on the content of the configuration.

Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-08 00:30:24 -07:00
Miah Johnson
640d122327 Update Inspec::Config.mock in collector global methods
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-07 22:37:43 -07:00
Miah Johnson
0b9833dd96 condense true/false enabled tests
Because of the way the test system loads I cannot guarantee that
`Inspec::Config.cached` won't be nil. I have to always pass in a mock
config object with our setting.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-07 19:06:38 -07:00
Miah Johnson
659b4b373a Remove # encoding: utf8 magic comments
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-07 16:06:23 -07:00
Clinton Wolfe
80b847ae83
Improve testing on inputs that do not have values (#4007)
Improve testing on inputs that do not have values
2019-05-07 15:01:09 -04:00
Clinton Wolfe
ce16120b18 Failing functional test for running inspec check with a deprecation
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-05-06 14:58:10 -04:00
Miah Johnson
b51ad8acb8 When telemetry is disabled Inspec.record_telemetry_data doesn't record
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-03 16:13:45 -07:00
Miah Johnson
ac2d782266 Pass in mock config object to tests and validate telemetry_enabled?
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-03 16:07:24 -07:00
Ryan Davis
476c6878b3 Modernize use of Minitest.
+ Turn off verbosity in Rakefile by default. Use `rake V=1` to turn back on.
+ MiniTest -> Minitest everywhere.
+ MiniTest::Unit::TestCase -> Minitest::Test everywhere.
+ Updated minitest doco urls to official and up-to-date site.
+ Normalize requires. Only needs "minitest/autorun" and "minitest/pride".

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-03 15:01:57 -07:00