2019-06-11 22:24:35 +00:00
|
|
|
require "minitest/autorun"
|
|
|
|
require_relative "../../../../lib/inspec"
|
Plugins API v2: Loader, Base API, and Test Harness (#3278)
* Functional tests for userdir option
* Accepts --config-dir CLI option
* Actually loads a config file from the config dir, more cases to test
* Able to load config and verify contents from config-dir
* Functional tests to ensure precedence for config options
* Enable setting config dir via env var
* .inspec, not .inspec.d
* Begin converting PluginCtl to PluginLoader/Registry
* Able to load and partially validate the plugins.json file
* More work on the plugin loader
* Break the world, move next gen stuff to plugin/
* Be sure to require base cli in bundled plugins
* Move test file
* Revert changes to v1 plugin, so we can have a separate one
* Checkpoint commit
* Move v2 plugin work to v2 area
* Move plugins v1 code into an isolated directory
* rubocop fixes
* Rip out the stuff about a user-dir config file, just use a plugin file
* Two psuedocode test file
* Working base API, moock plugin type, and loader.
* Adjust load path to be more welcoming
* Silence circular depencency warning, which was breaking a unit test
* Linting
* Fix plugin type registry, add tests to cover
* Feedback from Jerry
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2018-08-16 22:16:32 +00:00
|
|
|
|
|
|
|
module PluginV2BackCompat
|
2019-04-24 00:21:31 +00:00
|
|
|
class PluginV1TypeClassFetchers < Minitest::Test
|
Plugins API v2: Loader, Base API, and Test Harness (#3278)
* Functional tests for userdir option
* Accepts --config-dir CLI option
* Actually loads a config file from the config dir, more cases to test
* Able to load config and verify contents from config-dir
* Functional tests to ensure precedence for config options
* Enable setting config dir via env var
* .inspec, not .inspec.d
* Begin converting PluginCtl to PluginLoader/Registry
* Able to load and partially validate the plugins.json file
* More work on the plugin loader
* Break the world, move next gen stuff to plugin/
* Be sure to require base cli in bundled plugins
* Move test file
* Revert changes to v1 plugin, so we can have a separate one
* Checkpoint commit
* Move v2 plugin work to v2 area
* Move plugins v1 code into an isolated directory
* rubocop fixes
* Rip out the stuff about a user-dir config file, just use a plugin file
* Two psuedocode test file
* Working base API, moock plugin type, and loader.
* Adjust load path to be more welcoming
* Silence circular depencency warning, which was breaking a unit test
* Linting
* Fix plugin type registry, add tests to cover
* Feedback from Jerry
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2018-08-16 22:16:32 +00:00
|
|
|
|
|
|
|
# Note: we can't call klass.name, because that is redefined as a setter.
|
|
|
|
|
|
|
|
# cli had a base class (which was really a registry), but no class fetcher
|
|
|
|
# There was no Inspec.plugin(...)
|
|
|
|
|
|
|
|
def test_get_plugin_v1_base_for_fetchers
|
|
|
|
klass = Inspec.fetcher(1)
|
|
|
|
assert_kind_of Class, klass
|
|
|
|
assert Inspec::Plugins.const_defined? :Fetcher
|
|
|
|
assert_equal Inspec::Plugins::Fetcher, klass
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_get_plugin_v1_base_for_source_readers
|
|
|
|
klass = Inspec.source_reader(1)
|
|
|
|
assert_kind_of Class, klass
|
|
|
|
assert Inspec::Plugins.const_defined? :SourceReader
|
|
|
|
assert_equal Inspec::Plugins::SourceReader, klass
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2019-04-24 00:21:31 +00:00
|
|
|
end
|