inspec 4.18.51 → 4.18.85
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/inspec.gemspec +15 -37
- data/lib/resource_support/aws/aws_resource_mixin.rb +1 -1
- metadata +22 -709
- data/Gemfile +0 -61
- data/LICENSE +0 -14
- data/README.md +0 -474
- data/etc/deprecations.json +0 -125
- data/etc/plugin_filters.json +0 -45
- data/lib/bundles/README.md +0 -3
- data/lib/bundles/inspec-compliance/api.rb +0 -7
- data/lib/bundles/inspec-compliance/configuration.rb +0 -7
- data/lib/bundles/inspec-compliance/http.rb +0 -7
- data/lib/bundles/inspec-compliance/support.rb +0 -7
- data/lib/bundles/inspec-compliance/target.rb +0 -7
- data/lib/bundles/inspec-supermarket.rb +0 -9
- data/lib/bundles/inspec-supermarket/README.md +0 -45
- data/lib/bundles/inspec-supermarket/api.rb +0 -87
- data/lib/bundles/inspec-supermarket/cli.rb +0 -71
- data/lib/bundles/inspec-supermarket/target.rb +0 -31
- data/lib/inspec.rb +0 -30
- data/lib/inspec/archive/tar.rb +0 -25
- data/lib/inspec/archive/zip.rb +0 -15
- data/lib/inspec/backend.rb +0 -101
- data/lib/inspec/base_cli.rb +0 -318
- data/lib/inspec/cached_fetcher.rb +0 -65
- data/lib/inspec/cli.rb +0 -469
- data/lib/inspec/completions/bash.sh.erb +0 -45
- data/lib/inspec/completions/fish.sh.erb +0 -34
- data/lib/inspec/completions/zsh.sh.erb +0 -61
- data/lib/inspec/config.rb +0 -511
- data/lib/inspec/control_eval_context.rb +0 -248
- data/lib/inspec/dependencies/cache.rb +0 -74
- data/lib/inspec/dependencies/dependency_set.rb +0 -93
- data/lib/inspec/dependencies/lockfile.rb +0 -115
- data/lib/inspec/dependencies/requirement.rb +0 -135
- data/lib/inspec/dependencies/resolver.rb +0 -86
- data/lib/inspec/describe_base.rb +0 -53
- data/lib/inspec/dist.rb +0 -20
- data/lib/inspec/dsl.rb +0 -115
- data/lib/inspec/dsl_shared.rb +0 -32
- data/lib/inspec/env_printer.rb +0 -156
- data/lib/inspec/errors.rb +0 -18
- data/lib/inspec/exceptions.rb +0 -11
- data/lib/inspec/expect.rb +0 -42
- data/lib/inspec/fetcher.rb +0 -48
- data/lib/inspec/fetcher/git.rb +0 -211
- data/lib/inspec/fetcher/local.rb +0 -116
- data/lib/inspec/fetcher/mock.rb +0 -34
- data/lib/inspec/fetcher/url.rb +0 -281
- data/lib/inspec/file_provider.rb +0 -318
- data/lib/inspec/formatters.rb +0 -3
- data/lib/inspec/formatters/base.rb +0 -269
- data/lib/inspec/formatters/json_rspec.rb +0 -20
- data/lib/inspec/formatters/show_progress.rb +0 -12
- data/lib/inspec/globals.rb +0 -9
- data/lib/inspec/impact.rb +0 -36
- data/lib/inspec/input.rb +0 -421
- data/lib/inspec/input_dsl_helpers.rb +0 -26
- data/lib/inspec/input_registry.rb +0 -315
- data/lib/inspec/library_eval_context.rb +0 -55
- data/lib/inspec/log.rb +0 -7
- data/lib/inspec/metadata.rb +0 -253
- data/lib/inspec/method_source.rb +0 -20
- data/lib/inspec/objects.rb +0 -14
- data/lib/inspec/objects/control.rb +0 -85
- data/lib/inspec/objects/describe.rb +0 -106
- data/lib/inspec/objects/each_loop.rb +0 -41
- data/lib/inspec/objects/input.rb +0 -49
- data/lib/inspec/objects/list.rb +0 -15
- data/lib/inspec/objects/or_test.rb +0 -45
- data/lib/inspec/objects/ruby_helper.rb +0 -13
- data/lib/inspec/objects/tag.rb +0 -32
- data/lib/inspec/objects/test.rb +0 -94
- data/lib/inspec/objects/value.rb +0 -32
- data/lib/inspec/plugin/v1.rb +0 -2
- data/lib/inspec/plugin/v1/plugin_types/cli.rb +0 -22
- data/lib/inspec/plugin/v1/plugin_types/fetcher.rb +0 -83
- data/lib/inspec/plugin/v1/plugin_types/resource.rb +0 -176
- data/lib/inspec/plugin/v1/plugin_types/secret.rb +0 -11
- data/lib/inspec/plugin/v1/plugin_types/source_reader.rb +0 -36
- data/lib/inspec/plugin/v1/plugins.rb +0 -59
- data/lib/inspec/plugin/v1/registry.rb +0 -90
- data/lib/inspec/plugin/v2.rb +0 -46
- data/lib/inspec/plugin/v2/activator.rb +0 -40
- data/lib/inspec/plugin/v2/config_file.rb +0 -151
- data/lib/inspec/plugin/v2/filter.rb +0 -96
- data/lib/inspec/plugin/v2/installer.rb +0 -512
- data/lib/inspec/plugin/v2/loader.rb +0 -321
- data/lib/inspec/plugin/v2/plugin_base.rb +0 -112
- data/lib/inspec/plugin/v2/plugin_types/cli.rb +0 -49
- data/lib/inspec/plugin/v2/plugin_types/dsl.rb +0 -11
- data/lib/inspec/plugin/v2/plugin_types/input.rb +0 -34
- data/lib/inspec/plugin/v2/plugin_types/mock.rb +0 -12
- data/lib/inspec/plugin/v2/registry.rb +0 -98
- data/lib/inspec/plugin/v2/status.rb +0 -29
- data/lib/inspec/profile.rb +0 -658
- data/lib/inspec/profile_context.rb +0 -203
- data/lib/inspec/profile_vendor.rb +0 -84
- data/lib/inspec/reporters.rb +0 -73
- data/lib/inspec/reporters/automate.rb +0 -78
- data/lib/inspec/reporters/base.rb +0 -25
- data/lib/inspec/reporters/cli.rb +0 -370
- data/lib/inspec/reporters/json.rb +0 -113
- data/lib/inspec/reporters/json_automate.rb +0 -80
- data/lib/inspec/reporters/json_min.rb +0 -48
- data/lib/inspec/reporters/junit.rb +0 -77
- data/lib/inspec/reporters/yaml.rb +0 -20
- data/lib/inspec/require_loader.rb +0 -29
- data/lib/inspec/resource.rb +0 -114
- data/lib/inspec/resources.rb +0 -130
- data/lib/inspec/resources/aide_conf.rb +0 -153
- data/lib/inspec/resources/apache.rb +0 -47
- data/lib/inspec/resources/apache_conf.rb +0 -156
- data/lib/inspec/resources/apt.rb +0 -151
- data/lib/inspec/resources/audit_policy.rb +0 -64
- data/lib/inspec/resources/auditd.rb +0 -251
- data/lib/inspec/resources/auditd_conf.rb +0 -45
- data/lib/inspec/resources/bash.rb +0 -33
- data/lib/inspec/resources/bond.rb +0 -70
- data/lib/inspec/resources/bridge.rb +0 -125
- data/lib/inspec/resources/bsd_service.rb +0 -2
- data/lib/inspec/resources/chocolatey_package.rb +0 -82
- data/lib/inspec/resources/command.rb +0 -91
- data/lib/inspec/resources/cpan.rb +0 -58
- data/lib/inspec/resources/cran.rb +0 -64
- data/lib/inspec/resources/crontab.rb +0 -173
- data/lib/inspec/resources/csv.rb +0 -56
- data/lib/inspec/resources/dh_params.rb +0 -83
- data/lib/inspec/resources/directory.rb +0 -23
- data/lib/inspec/resources/docker.rb +0 -274
- data/lib/inspec/resources/docker_container.rb +0 -91
- data/lib/inspec/resources/docker_image.rb +0 -84
- data/lib/inspec/resources/docker_object.rb +0 -52
- data/lib/inspec/resources/docker_plugin.rb +0 -64
- data/lib/inspec/resources/docker_service.rb +0 -91
- data/lib/inspec/resources/elasticsearch.rb +0 -165
- data/lib/inspec/resources/etc_fstab.rb +0 -96
- data/lib/inspec/resources/etc_group.rb +0 -157
- data/lib/inspec/resources/etc_hosts.rb +0 -68
- data/lib/inspec/resources/etc_hosts_allow.rb +0 -2
- data/lib/inspec/resources/etc_hosts_allow_deny.rb +0 -114
- data/lib/inspec/resources/etc_hosts_deny.rb +0 -2
- data/lib/inspec/resources/file.rb +0 -339
- data/lib/inspec/resources/filesystem.rb +0 -139
- data/lib/inspec/resources/firewalld.rb +0 -148
- data/lib/inspec/resources/gem.rb +0 -80
- data/lib/inspec/resources/group.rb +0 -2
- data/lib/inspec/resources/groups.rb +0 -241
- data/lib/inspec/resources/grub_conf.rb +0 -230
- data/lib/inspec/resources/host.rb +0 -310
- data/lib/inspec/resources/http.rb +0 -275
- data/lib/inspec/resources/iis_app.rb +0 -101
- data/lib/inspec/resources/iis_app_pool.rb +0 -127
- data/lib/inspec/resources/iis_site.rb +0 -148
- data/lib/inspec/resources/iis_website.rb +0 -2
- data/lib/inspec/resources/inetd_conf.rb +0 -53
- data/lib/inspec/resources/ini.rb +0 -28
- data/lib/inspec/resources/interface.rb +0 -204
- data/lib/inspec/resources/ip6tables.rb +0 -79
- data/lib/inspec/resources/iptables.rb +0 -80
- data/lib/inspec/resources/json.rb +0 -116
- data/lib/inspec/resources/kernel_module.rb +0 -106
- data/lib/inspec/resources/kernel_parameter.rb +0 -54
- data/lib/inspec/resources/key_rsa.rb +0 -66
- data/lib/inspec/resources/ksh.rb +0 -33
- data/lib/inspec/resources/launchd_service.rb +0 -2
- data/lib/inspec/resources/limits_conf.rb +0 -45
- data/lib/inspec/resources/linux_kernel_parameter.rb +0 -2
- data/lib/inspec/resources/login_defs.rb +0 -56
- data/lib/inspec/resources/mount.rb +0 -88
- data/lib/inspec/resources/mssql_session.rb +0 -117
- data/lib/inspec/resources/mysql.rb +0 -81
- data/lib/inspec/resources/mysql_conf.rb +0 -128
- data/lib/inspec/resources/mysql_session.rb +0 -88
- data/lib/inspec/resources/nginx.rb +0 -96
- data/lib/inspec/resources/nginx_conf.rb +0 -232
- data/lib/inspec/resources/noop.rb +0 -9
- data/lib/inspec/resources/npm.rb +0 -68
- data/lib/inspec/resources/ntp_conf.rb +0 -51
- data/lib/inspec/resources/oneget.rb +0 -71
- data/lib/inspec/resources/oracledb_session.rb +0 -149
- data/lib/inspec/resources/os.rb +0 -34
- data/lib/inspec/resources/os_env.rb +0 -86
- data/lib/inspec/resources/package.rb +0 -391
- data/lib/inspec/resources/packages.rb +0 -111
- data/lib/inspec/resources/parse_config.rb +0 -112
- data/lib/inspec/resources/parse_config_file.rb +0 -2
- data/lib/inspec/resources/passwd.rb +0 -73
- data/lib/inspec/resources/pip.rb +0 -132
- data/lib/inspec/resources/platform.rb +0 -112
- data/lib/inspec/resources/port.rb +0 -791
- data/lib/inspec/resources/postfix_conf.rb +0 -35
- data/lib/inspec/resources/postgres.rb +0 -152
- data/lib/inspec/resources/postgres_conf.rb +0 -116
- data/lib/inspec/resources/postgres_hba_conf.rb +0 -86
- data/lib/inspec/resources/postgres_ident_conf.rb +0 -75
- data/lib/inspec/resources/postgres_session.rb +0 -70
- data/lib/inspec/resources/powershell.rb +0 -67
- data/lib/inspec/resources/ppa.rb +0 -2
- data/lib/inspec/resources/processes.rb +0 -219
- data/lib/inspec/resources/rabbitmq_conf.rb +0 -2
- data/lib/inspec/resources/rabbitmq_config.rb +0 -52
- data/lib/inspec/resources/registry_key.rb +0 -296
- data/lib/inspec/resources/runit_service.rb +0 -2
- data/lib/inspec/resources/script.rb +0 -1
- data/lib/inspec/resources/security_identifier.rb +0 -91
- data/lib/inspec/resources/security_policy.rb +0 -182
- data/lib/inspec/resources/service.rb +0 -820
- data/lib/inspec/resources/shadow.rb +0 -150
- data/lib/inspec/resources/ssh_config.rb +0 -98
- data/lib/inspec/resources/sshd_config.rb +0 -2
- data/lib/inspec/resources/ssl.rb +0 -99
- data/lib/inspec/resources/sys_info.rb +0 -119
- data/lib/inspec/resources/systemd_service.rb +0 -2
- data/lib/inspec/resources/sysv_service.rb +0 -2
- data/lib/inspec/resources/toml.rb +0 -30
- data/lib/inspec/resources/upstart_service.rb +0 -2
- data/lib/inspec/resources/user.rb +0 -1
- data/lib/inspec/resources/users.rb +0 -742
- data/lib/inspec/resources/vbscript.rb +0 -67
- data/lib/inspec/resources/virtualization.rb +0 -255
- data/lib/inspec/resources/windows_feature.rb +0 -126
- data/lib/inspec/resources/windows_hotfix.rb +0 -37
- data/lib/inspec/resources/windows_registry_key.rb +0 -2
- data/lib/inspec/resources/windows_task.rb +0 -112
- data/lib/inspec/resources/wmi.rb +0 -109
- data/lib/inspec/resources/x509_certificate.rb +0 -143
- data/lib/inspec/resources/xinetd_conf.rb +0 -103
- data/lib/inspec/resources/xml.rb +0 -48
- data/lib/inspec/resources/yaml.rb +0 -42
- data/lib/inspec/resources/yum.rb +0 -162
- data/lib/inspec/resources/zfs_dataset.rb +0 -62
- data/lib/inspec/resources/zfs_pool.rb +0 -50
- data/lib/inspec/rspec_extensions.rb +0 -116
- data/lib/inspec/rule.rb +0 -389
- data/lib/inspec/runner.rb +0 -333
- data/lib/inspec/runner_mock.rb +0 -37
- data/lib/inspec/runner_rspec.rb +0 -184
- data/lib/inspec/runtime_profile.rb +0 -23
- data/lib/inspec/schema.rb +0 -245
- data/lib/inspec/secrets.rb +0 -15
- data/lib/inspec/secrets/yaml.rb +0 -29
- data/lib/inspec/shell.rb +0 -211
- data/lib/inspec/shell_detector.rb +0 -89
- data/lib/inspec/source_reader.rb +0 -26
- data/lib/inspec/ui.rb +0 -213
- data/lib/inspec/ui_table_helper.rb +0 -12
- data/lib/inspec/utils/command_wrapper.rb +0 -23
- data/lib/inspec/utils/convert.rb +0 -8
- data/lib/inspec/utils/database_helpers.rb +0 -75
- data/lib/inspec/utils/deprecation.rb +0 -6
- data/lib/inspec/utils/deprecation/config_file.rb +0 -109
- data/lib/inspec/utils/deprecation/deprecator.rb +0 -118
- data/lib/inspec/utils/deprecation/errors.rb +0 -14
- data/lib/inspec/utils/deprecation/global_method.rb +0 -9
- data/lib/inspec/utils/enumerable_delegation.rb +0 -7
- data/lib/inspec/utils/erlang_parser.rb +0 -190
- data/lib/inspec/utils/file_reader.rb +0 -24
- data/lib/inspec/utils/filter.rb +0 -461
- data/lib/inspec/utils/filter_array.rb +0 -25
- data/lib/inspec/utils/find_files.rb +0 -44
- data/lib/inspec/utils/hash.rb +0 -37
- data/lib/inspec/utils/json_log.rb +0 -15
- data/lib/inspec/utils/modulator.rb +0 -9
- data/lib/inspec/utils/nginx_parser.rb +0 -101
- data/lib/inspec/utils/object_traversal.rb +0 -47
- data/lib/inspec/utils/parser.rb +0 -277
- data/lib/inspec/utils/pkey_reader.rb +0 -17
- data/lib/inspec/utils/simpleconfig.rb +0 -121
- data/lib/inspec/utils/spdx.rb +0 -10
- data/lib/inspec/utils/spdx.txt +0 -383
- data/lib/inspec/utils/telemetry.rb +0 -3
- data/lib/inspec/utils/telemetry/collector.rb +0 -81
- data/lib/inspec/utils/telemetry/data_series.rb +0 -44
- data/lib/inspec/utils/telemetry/global_methods.rb +0 -22
- data/lib/inspec/version.rb +0 -3
- data/lib/matchers/matchers.rb +0 -341
- data/lib/plugins/README.md +0 -16
- data/lib/plugins/inspec-artifact/lib/inspec-artifact.rb +0 -12
- data/lib/plugins/inspec-artifact/lib/inspec-artifact/base.rb +0 -170
- data/lib/plugins/inspec-artifact/lib/inspec-artifact/cli.rb +0 -116
- data/lib/plugins/inspec-artifact/test/functional/inspec_artifact_test.rb +0 -50
- data/lib/plugins/inspec-compliance/README.md +0 -207
- data/lib/plugins/inspec-compliance/lib/inspec-compliance.rb +0 -12
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/api.rb +0 -362
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/api/login.rb +0 -198
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/cli.rb +0 -269
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/configuration.rb +0 -103
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/http.rb +0 -117
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/images/cc-token.png +0 -0
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb +0 -34
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/target.rb +0 -146
- data/lib/plugins/inspec-compliance/test/functional/inspec_compliance_test.rb +0 -53
- data/lib/plugins/inspec-compliance/test/integration/default/cli.rb +0 -91
- data/lib/plugins/inspec-compliance/test/unit/api/login_test.rb +0 -190
- data/lib/plugins/inspec-compliance/test/unit/api_test.rb +0 -386
- data/lib/plugins/inspec-compliance/test/unit/target_test.rb +0 -155
- data/lib/plugins/inspec-habitat/Berksfile +0 -5
- data/lib/plugins/inspec-habitat/README.md +0 -150
- data/lib/plugins/inspec-habitat/kitchen.yml +0 -28
- data/lib/plugins/inspec-habitat/lib/inspec-habitat.rb +0 -11
- data/lib/plugins/inspec-habitat/lib/inspec-habitat/cli.rb +0 -41
- data/lib/plugins/inspec-habitat/lib/inspec-habitat/profile.rb +0 -265
- data/lib/plugins/inspec-habitat/templates/habitat/plan.sh.erb +0 -6
- data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/Berksfile +0 -2
- data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/README.md +0 -3
- data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/files/hab_setup.exp +0 -28
- data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/metadata.rb +0 -9
- data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/recipes/default.rb +0 -61
- data/lib/plugins/inspec-habitat/test/functional/inspec_habitat_test.rb +0 -34
- data/lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/README.md +0 -3
- data/lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb +0 -40
- data/lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/inspec.yml +0 -10
- data/lib/plugins/inspec-habitat/test/support/example_profile/README.md +0 -3
- data/lib/plugins/inspec-habitat/test/support/example_profile/controls/example.rb +0 -7
- data/lib/plugins/inspec-habitat/test/support/example_profile/inspec.yml +0 -10
- data/lib/plugins/inspec-habitat/test/unit/profile_test.rb +0 -242
- data/lib/plugins/inspec-init/README.md +0 -31
- data/lib/plugins/inspec-init/lib/inspec-init.rb +0 -12
- data/lib/plugins/inspec-init/lib/inspec-init/cli.rb +0 -15
- data/lib/plugins/inspec-init/lib/inspec-init/cli_plugin.rb +0 -243
- data/lib/plugins/inspec-init/lib/inspec-init/cli_profile.rb +0 -47
- data/lib/plugins/inspec-init/lib/inspec-init/renderer.rb +0 -97
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/Gemfile +0 -11
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/LICENSE +0 -2
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/README.md +0 -28
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/Rakefile +0 -40
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template.rb +0 -14
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/cli_command.rb +0 -62
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/plugin.rb +0 -53
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/version.rb +0 -8
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/fixtures/README.md +0 -24
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/functional/README.md +0 -12
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/functional/inspec_plugin_template_test.rb +0 -110
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/helper.rb +0 -24
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/unit/README.md +0 -17
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/unit/cli_args_test.rb +0 -67
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/unit/plugin_def_test.rb +0 -51
- data/lib/plugins/inspec-init/templates/profiles/aws/libraries/.gitkeep +0 -0
- data/lib/plugins/inspec-init/templates/profiles/azure/libraries/.gitkeep +0 -0
- data/lib/plugins/inspec-init/templates/profiles/gcp/libraries/.gitkeep +0 -0
- data/lib/plugins/inspec-init/templates/profiles/os/README.md +0 -3
- data/lib/plugins/inspec-init/templates/profiles/os/controls/example.rb +0 -18
- data/lib/plugins/inspec-init/templates/profiles/os/inspec.yml +0 -10
- data/lib/plugins/inspec-init/templates/profiles/os/libraries/.gitkeep +0 -0
- data/lib/plugins/inspec-init/test/functional/inspec_init_plugin_test.rb +0 -184
- data/lib/plugins/inspec-init/test/functional/inspec_init_profile_test.rb +0 -121
- data/lib/plugins/inspec-plugin-manager-cli/README.md +0 -6
- data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli.rb +0 -17
- data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/cli_command.rb +0 -518
- data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/plugin.rb +0 -12
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/config_dirs/empty/.gitkeep +0 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-egg-white-omelette/lib/inspec-egg-white-omelette.rb +0 -2
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-egg-white-omelette/lib/inspec-egg-white-omelette/.gitkeep +0 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-wrong-structure/.gitkeep +0 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/wrong-name/lib/wrong-name.rb +0 -1
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/wrong-name/lib/wrong-name/.gitkeep +0 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/help_test.rb +0 -23
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/helper.rb +0 -62
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/install_test.rb +0 -368
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/list_test.rb +0 -101
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/search_test.rb +0 -129
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/uninstall_test.rb +0 -63
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/update_test.rb +0 -84
- data/lib/plugins/inspec-plugin-manager-cli/test/unit/cli_args_test.rb +0 -77
- data/lib/plugins/inspec-plugin-manager-cli/test/unit/plugin_def_test.rb +0 -39
- data/lib/plugins/shared/core_plugin_test_helper.rb +0 -153
- data/lib/plugins/things-for-train-integration.rb +0 -14
- data/lib/source_readers/flat.rb +0 -36
- data/lib/source_readers/inspec.rb +0 -66
File without changes
|
File without changes
|
data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-wrong-structure/.gitkeep
DELETED
File without changes
|
data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/wrong-name/lib/wrong-name.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# This should should never even be loaded.
|
data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/wrong-name/lib/wrong-name/.gitkeep
DELETED
File without changes
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require_relative "helper"
|
2
|
-
|
3
|
-
class PluginManagerCliHelp < Minitest::Test
|
4
|
-
include CorePluginFunctionalHelper
|
5
|
-
|
6
|
-
# Main inspec help subcommand listing
|
7
|
-
def test_inspec_help_includes_plugin
|
8
|
-
result = run_inspec_process_with_this_plugin("help")
|
9
|
-
skip_windows!
|
10
|
-
assert_includes result.stdout, "inspec plugin"
|
11
|
-
end
|
12
|
-
|
13
|
-
# inspec plugin help subcommand listing
|
14
|
-
def test_inspec_plugin_help_includes_plugin
|
15
|
-
result = run_inspec_process_with_this_plugin("plugin help")
|
16
|
-
skip_windows!
|
17
|
-
assert_includes result.stdout, "inspec plugin list"
|
18
|
-
assert_includes result.stdout, "inspec plugin search"
|
19
|
-
assert_includes result.stdout, "inspec plugin install"
|
20
|
-
assert_includes result.stdout, "inspec plugin update"
|
21
|
-
assert_includes result.stdout, "inspec plugin uninstall"
|
22
|
-
end
|
23
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
require "plugins/shared/core_plugin_test_helper"
|
2
|
-
|
3
|
-
module PluginManagerHelpers
|
4
|
-
let(:project_repo_path) { File.expand_path(File.join(__FILE__, "..", "..", "..")) }
|
5
|
-
let(:project_fixtures_path) { File.join(project_repo_path, "test", "fixtures") }
|
6
|
-
let(:project_config_dirs_path) { File.join(project_fixtures_path, "config_dirs") }
|
7
|
-
let(:empty_config_dir_path) { File.join(project_config_dirs_path, "empty") }
|
8
|
-
|
9
|
-
let(:list_after_run) do
|
10
|
-
Proc.new do |run_result, tmp_dir|
|
11
|
-
# After installing/uninstalling/whatevering, run list with config in the same dir, and capture it.
|
12
|
-
@list_result = parse_plugin_list_lines(
|
13
|
-
run_inspec_process("plugin list", env: { INSPEC_CONFIG_DIR: tmp_dir }).stdout
|
14
|
-
)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def copy_in_project_config_dir(fixture_name, dest = nil)
|
19
|
-
src = Dir.glob(File.join(project_config_dirs_path, fixture_name, "*"))
|
20
|
-
dest ||= File.join(project_config_dirs_path, "empty")
|
21
|
-
src.each { |path| FileUtils.cp_r(path, dest) }
|
22
|
-
end
|
23
|
-
|
24
|
-
def copy_in_core_config_dir(fixture_name, dest = nil)
|
25
|
-
src = Dir.glob(File.join(core_config_dir_path, fixture_name, "*"))
|
26
|
-
dest ||= File.join(project_config_dirs_path, "empty")
|
27
|
-
src.each { |path| FileUtils.cp_r(path, dest) }
|
28
|
-
end
|
29
|
-
|
30
|
-
def clear_empty_config_dir
|
31
|
-
Dir.glob(File.join(project_config_dirs_path, "empty", "*")).each do |path|
|
32
|
-
next if path.end_with? ".gitkeep"
|
33
|
-
|
34
|
-
FileUtils.rm_rf(path)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def parse_plugin_list_lines(stdout)
|
39
|
-
plugins = []
|
40
|
-
|
41
|
-
stdout.force_encoding("UTF-8").lines.each do |line|
|
42
|
-
next if line.strip.empty?
|
43
|
-
next if line.include? "─────" # This is some unicode glyphiness
|
44
|
-
next if line.include? "Plugin Name"
|
45
|
-
next if line.include? "plugin(s) total"
|
46
|
-
|
47
|
-
parts = line.split(/│/u).map(&:strip!).compact
|
48
|
-
plugins << {
|
49
|
-
name: parts[0],
|
50
|
-
version: parts[1],
|
51
|
-
type: parts[2],
|
52
|
-
generation: parts[3],
|
53
|
-
raw: line,
|
54
|
-
}
|
55
|
-
end
|
56
|
-
plugins
|
57
|
-
end
|
58
|
-
|
59
|
-
def teardown
|
60
|
-
clear_empty_config_dir
|
61
|
-
end
|
62
|
-
end
|
@@ -1,368 +0,0 @@
|
|
1
|
-
require_relative "helper"
|
2
|
-
|
3
|
-
class PluginManagerCliInstall < Minitest::Test
|
4
|
-
include CorePluginFunctionalHelper # gives us instance methods, like `let` aliases inside test methods
|
5
|
-
extend CorePluginFunctionalHelper # gives us class methods, like `let` aliases out here outside test methods
|
6
|
-
|
7
|
-
parallelize_me!
|
8
|
-
|
9
|
-
include PluginManagerHelpers
|
10
|
-
ruby_abi_version = (Gem.ruby_version.segments[0, 2] << 0).join(".")
|
11
|
-
# Test multiple hueristics of the path-mode install.
|
12
|
-
# These are all positive tests; they should resolve the entry point to the same path in each case.
|
13
|
-
{
|
14
|
-
"is_perfect" => {
|
15
|
-
given: File.join(core_fixture_plugins_path, "inspec-test-fixture", "lib", "inspec-test-fixture.rb"),
|
16
|
-
},
|
17
|
-
"refers_to_the_entry_point_with_no_extension" => {
|
18
|
-
given: File.join(core_fixture_plugins_path, "inspec-test-fixture", "lib", "inspec-test-fixture"),
|
19
|
-
},
|
20
|
-
"refers_to_the_src_root_of_a_plugin" => {
|
21
|
-
given: File.join(core_fixture_plugins_path, "inspec-test-fixture"),
|
22
|
-
},
|
23
|
-
"refers_to_a_versioned_gem_install" => {
|
24
|
-
given: File.join(core_config_dir_path, "test-fixture-1-float", "gems", ruby_abi_version, "gems", "inspec-test-fixture-0.1.0", "lib", "inspec-test-fixture.rb"),
|
25
|
-
resolved_path: File.join(core_config_dir_path, "test-fixture-1-float", "gems", ruby_abi_version, "gems", "inspec-test-fixture-0.1.0", "lib", "inspec-test-fixture.rb"),
|
26
|
-
},
|
27
|
-
"refers_to_a_versioned_gem_install_missing_extension" => {
|
28
|
-
given: File.join(core_config_dir_path, "test-fixture-1-float", "gems", ruby_abi_version, "gems", "inspec-test-fixture-0.1.0", "lib", "inspec-test-fixture"),
|
29
|
-
resolved_path: File.join(core_config_dir_path, "test-fixture-1-float", "gems", ruby_abi_version, "gems", "inspec-test-fixture-0.1.0", "lib", "inspec-test-fixture.rb"),
|
30
|
-
},
|
31
|
-
"refers_to_a_relative_path" => {
|
32
|
-
given: File.join("test", "fixtures", "plugins", "inspec-test-fixture", "lib", "inspec-test-fixture.rb"),
|
33
|
-
},
|
34
|
-
"refers_to_a_train_plugin" => {
|
35
|
-
given: File.join(core_config_dir_path, "train-test-fixture", "gems", ruby_abi_version, "gems", "train-test-fixture-0.1.0", "lib", "train-test-fixture.rb"),
|
36
|
-
plugin_name: "train-test-fixture",
|
37
|
-
resolved_path: File.join(core_config_dir_path, "train-test-fixture", "gems", ruby_abi_version, "gems", "train-test-fixture-0.1.0", "lib", "train-test-fixture.rb"),
|
38
|
-
},
|
39
|
-
}.each do |test_name, fixture_info|
|
40
|
-
define_method(("test_install_from_path_when_path_" + test_name).to_sym) do
|
41
|
-
fixture_info = {
|
42
|
-
plugin_name: "inspec-test-fixture",
|
43
|
-
resolved_path: File.join(core_fixture_plugins_path, "inspec-test-fixture", "lib", "inspec-test-fixture.rb"),
|
44
|
-
}.merge(fixture_info)
|
45
|
-
|
46
|
-
install_result = run_inspec_process_with_this_plugin("plugin install #{fixture_info[:given]}", post_run: list_after_run)
|
47
|
-
|
48
|
-
# Check UX messaging
|
49
|
-
success_message = install_result.stdout.split("\n").grep(/installed/).last
|
50
|
-
skip_windows!
|
51
|
-
assert_empty install_result.stderr
|
52
|
-
refute_nil success_message, "Should find a success message at the end"
|
53
|
-
assert_includes success_message, fixture_info[:plugin_name]
|
54
|
-
assert_includes success_message, "plugin installed via source path reference"
|
55
|
-
|
56
|
-
# Check round-trip UX via list
|
57
|
-
itf_plugin = @list_result.detect { |p| p[:name] == fixture_info[:plugin_name] }
|
58
|
-
refute_nil itf_plugin, "plugin name should now appear in the output of inspec list"
|
59
|
-
assert_equal "path", itf_plugin[:type], "list output should show that it is a path installation"
|
60
|
-
|
61
|
-
# Check plugin statefile. Extra important in this case, since all should resolve to the same entry point.
|
62
|
-
plugin_data = @plugin_data
|
63
|
-
entry = plugin_data["plugins"].detect { |e| e["name"] == fixture_info[:plugin_name] }
|
64
|
-
assert_equal fixture_info[:resolved_path], entry["installation_path"], "Regardless of input, the entry point should be correct."
|
65
|
-
|
66
|
-
assert_exit_code 0, install_result
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def test_fail_install_from_nonexistant_path
|
71
|
-
bad_path = File.join(project_fixtures_path, "none", "such", "inspec-test-fixture-nonesuch.rb")
|
72
|
-
install_result = run_inspec_process_with_this_plugin("plugin install #{bad_path}")
|
73
|
-
skip_windows!
|
74
|
-
|
75
|
-
error_message = install_result.stdout
|
76
|
-
assert_includes error_message, "No such source code path"
|
77
|
-
assert_includes error_message, "inspec-test-fixture-nonesuch.rb"
|
78
|
-
assert_includes error_message, "installation failed"
|
79
|
-
|
80
|
-
assert_empty install_result.stderr
|
81
|
-
|
82
|
-
assert_exit_code 1, install_result
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_fail_install_from_path_with_wrong_name
|
86
|
-
bad_path = File.join(project_fixtures_path, "plugins", "wrong-name", "lib", "wrong-name.rb")
|
87
|
-
install_result = run_inspec_process_with_this_plugin("plugin install #{bad_path}")
|
88
|
-
skip_windows!
|
89
|
-
|
90
|
-
error_message = install_result.stdout
|
91
|
-
assert_includes error_message, "Invalid plugin name"
|
92
|
-
assert_includes error_message, "wrong-name"
|
93
|
-
assert_includes error_message, "All inspec plugins must begin with either 'inspec-' or 'train-'"
|
94
|
-
assert_includes error_message, "installation failed"
|
95
|
-
|
96
|
-
assert_empty install_result.stderr
|
97
|
-
|
98
|
-
assert_exit_code 1, install_result
|
99
|
-
end
|
100
|
-
|
101
|
-
def test_fail_install_from_path_when_it_is_not_a_plugin
|
102
|
-
bad_path = File.join(project_fixtures_path, "plugins", "inspec-egg-white-omelette", "lib", "inspec-egg-white-omelette.rb")
|
103
|
-
install_result = run_inspec_process_with_this_plugin("plugin install #{bad_path}")
|
104
|
-
skip_windows!
|
105
|
-
|
106
|
-
error_message = install_result.stdout
|
107
|
-
assert_includes error_message, "Does not appear to be a plugin"
|
108
|
-
assert_includes error_message, "inspec-egg-white-omelette"
|
109
|
-
assert_includes error_message, "After probe-loading the supposed plugin, it did not register"
|
110
|
-
assert_includes error_message, "Ensure something inherits from 'Inspec.plugin(2)'"
|
111
|
-
assert_includes error_message, "installation failed"
|
112
|
-
|
113
|
-
assert_empty install_result.stderr
|
114
|
-
|
115
|
-
assert_exit_code 1, install_result
|
116
|
-
end
|
117
|
-
|
118
|
-
def test_fail_install_from_path_when_it_is_already_installed
|
119
|
-
plugin_path = File.join(core_fixture_plugins_path, "inspec-test-fixture", "lib", "inspec-test-fixture.rb")
|
120
|
-
pre_block = Proc.new do |plugin_data, _tmp_dir|
|
121
|
-
plugin_data["plugins"] << {
|
122
|
-
"name" => "inspec-test-fixture",
|
123
|
-
"installation_type" => "path",
|
124
|
-
"installation_path" => plugin_path,
|
125
|
-
}
|
126
|
-
end
|
127
|
-
|
128
|
-
install_result = run_inspec_process_with_this_plugin("plugin install #{plugin_path}", pre_run: pre_block)
|
129
|
-
skip_windows!
|
130
|
-
|
131
|
-
error_message = install_result.stdout
|
132
|
-
assert_includes error_message, "Plugin already installed"
|
133
|
-
assert_includes error_message, "inspec-test-fixture"
|
134
|
-
assert_includes error_message, "Use 'inspec plugin list' to see previously installed plugin"
|
135
|
-
assert_includes error_message, "installation failed"
|
136
|
-
|
137
|
-
assert_empty install_result.stderr
|
138
|
-
|
139
|
-
assert_exit_code 2, install_result
|
140
|
-
end
|
141
|
-
|
142
|
-
def test_fail_install_from_path_when_the_dir_structure_is_wrong
|
143
|
-
bad_path = File.join(project_fixtures_path, "plugins", "inspec-wrong-structure")
|
144
|
-
install_result = run_inspec_process_with_this_plugin("plugin install #{bad_path}")
|
145
|
-
skip_windows!
|
146
|
-
|
147
|
-
error_message = install_result.stdout
|
148
|
-
assert_includes error_message, "Unrecognizable plugin structure"
|
149
|
-
assert_includes error_message, "inspec-wrong-structure"
|
150
|
-
assert_includes error_message, " When installing from a path, please provide the path of the entry point file"
|
151
|
-
assert_includes error_message, "installation failed"
|
152
|
-
|
153
|
-
assert_empty install_result.stderr
|
154
|
-
|
155
|
-
assert_exit_code 1, install_result
|
156
|
-
end
|
157
|
-
|
158
|
-
def test_install_from_gemfile
|
159
|
-
fixture_gemfile_path = File.join(core_fixture_plugins_path, "inspec-test-fixture", "pkg", "inspec-test-fixture-0.1.0.gem")
|
160
|
-
install_result = run_inspec_process_with_this_plugin("plugin install #{fixture_gemfile_path}", post_run: list_after_run)
|
161
|
-
skip_windows!
|
162
|
-
|
163
|
-
success_message = install_result.stdout.split("\n").grep(/installed/).last
|
164
|
-
refute_nil success_message, "Should find a success message at the end"
|
165
|
-
assert_includes success_message, "installed from local .gem file"
|
166
|
-
|
167
|
-
itf_plugin = @list_result.detect { |p| p[:name] == "inspec-test-fixture" }
|
168
|
-
refute_nil itf_plugin, "plugin name should now appear in the output of inspec list"
|
169
|
-
assert_equal "gem (user)", itf_plugin[:type]
|
170
|
-
assert_equal "0.1.0", itf_plugin[:version]
|
171
|
-
|
172
|
-
assert_empty install_result.stderr
|
173
|
-
assert_exit_code 0, install_result
|
174
|
-
end
|
175
|
-
|
176
|
-
def test_fail_install_from_nonexistant_gemfile
|
177
|
-
bad_path = File.join(project_fixtures_path, "none", "such", "inspec-test-fixture-nonesuch-0.3.0.gem")
|
178
|
-
install_result = run_inspec_process_with_this_plugin("plugin install #{bad_path}")
|
179
|
-
|
180
|
-
skip_windows!
|
181
|
-
assert_match(/No such plugin gem file .+ - installation failed./, install_result.stdout)
|
182
|
-
|
183
|
-
assert_empty install_result.stderr
|
184
|
-
|
185
|
-
assert_exit_code 1, install_result
|
186
|
-
end
|
187
|
-
|
188
|
-
def test_install_from_rubygems_latest
|
189
|
-
install_result = run_inspec_process_with_this_plugin("plugin install inspec-test-fixture", post_run: list_after_run)
|
190
|
-
skip_windows!
|
191
|
-
|
192
|
-
success_message = install_result.stdout.split("\n").grep(/installed/).last
|
193
|
-
refute_nil success_message, "Should find a success message at the end"
|
194
|
-
assert_includes success_message, "inspec-test-fixture"
|
195
|
-
assert_includes success_message, "0.2.0"
|
196
|
-
assert_includes success_message, "installed from rubygems.org"
|
197
|
-
|
198
|
-
itf_plugin = @list_result.detect { |p| p[:name] == "inspec-test-fixture" }
|
199
|
-
refute_nil itf_plugin, "plugin name should now appear in the output of inspec list"
|
200
|
-
assert_equal "gem (user)", itf_plugin[:type]
|
201
|
-
assert_equal "0.2.0", itf_plugin[:version]
|
202
|
-
|
203
|
-
assert_empty install_result.stderr
|
204
|
-
assert_exit_code 0, install_result
|
205
|
-
end
|
206
|
-
|
207
|
-
def test_fail_install_from_nonexistant_remote_rubygem
|
208
|
-
install_result = run_inspec_process_with_this_plugin("plugin install inspec-test-fixture-nonesuch")
|
209
|
-
|
210
|
-
skip_windows!
|
211
|
-
assert_match(/No such plugin gem .+ could be found on rubygems.org - installation failed./, install_result.stdout)
|
212
|
-
|
213
|
-
assert_empty install_result.stderr
|
214
|
-
|
215
|
-
assert_exit_code 1, install_result
|
216
|
-
end
|
217
|
-
|
218
|
-
def test_install_from_rubygems_with_pinned_version
|
219
|
-
install_result = run_inspec_process_with_this_plugin("plugin install inspec-test-fixture -v 0.1.0", post_run: list_after_run)
|
220
|
-
|
221
|
-
success_message = install_result.stdout.split("\n").grep(/installed/).last
|
222
|
-
skip_windows!
|
223
|
-
refute_nil success_message, "Should find a success message at the end"
|
224
|
-
assert_includes success_message, "inspec-test-fixture"
|
225
|
-
assert_includes success_message, "0.1.0"
|
226
|
-
assert_includes success_message, "installed from rubygems.org"
|
227
|
-
|
228
|
-
itf_plugin = @list_result.detect { |p| p[:name] == "inspec-test-fixture" }
|
229
|
-
refute_nil itf_plugin, "plugin name should now appear in the output of inspec list"
|
230
|
-
assert_equal "gem (user)", itf_plugin[:type]
|
231
|
-
assert_equal "0.1.0", itf_plugin[:version]
|
232
|
-
|
233
|
-
assert_empty install_result.stderr
|
234
|
-
|
235
|
-
assert_exit_code 0, install_result
|
236
|
-
end
|
237
|
-
|
238
|
-
def test_fail_install_from_nonexistant_rubygem_version
|
239
|
-
install_result = run_inspec_process_with_this_plugin("plugin install inspec-test-fixture -v 99.99.99")
|
240
|
-
|
241
|
-
fail_message = install_result.stdout.split("\n").grep(/failed/).last
|
242
|
-
skip_windows!
|
243
|
-
refute_nil fail_message, "Should find a failure message at the end"
|
244
|
-
assert_includes fail_message, "inspec-test-fixture"
|
245
|
-
assert_includes fail_message, "99.99.99"
|
246
|
-
assert_includes fail_message, "no such version"
|
247
|
-
assert_includes fail_message, "on rubygems.org"
|
248
|
-
|
249
|
-
assert_empty install_result.stderr
|
250
|
-
|
251
|
-
assert_exit_code 1, install_result
|
252
|
-
end
|
253
|
-
|
254
|
-
def test_refuse_install_when_missing_prefix
|
255
|
-
install_result = run_inspec_process_with_this_plugin("plugin install test-fixture")
|
256
|
-
|
257
|
-
fail_message = install_result.stdout.split("\n").grep(/failed/).last
|
258
|
-
skip_windows!
|
259
|
-
refute_nil fail_message, "Should find a failure message at the end"
|
260
|
-
assert_includes fail_message, "test-fixture"
|
261
|
-
assert_includes fail_message, "All inspec plugins must begin with either 'inspec-' or 'train-'"
|
262
|
-
|
263
|
-
assert_empty install_result.stderr
|
264
|
-
|
265
|
-
assert_exit_code 1, install_result
|
266
|
-
end
|
267
|
-
|
268
|
-
def test_refuse_install_when_already_installed_same_version
|
269
|
-
pre_block = Proc.new do |plugin_statefile_data, tmp_dir|
|
270
|
-
plugin_statefile_data.clear # Signal not to write a file, we'll provide one.
|
271
|
-
copy_in_core_config_dir("test-fixture-2-float", tmp_dir)
|
272
|
-
end
|
273
|
-
|
274
|
-
install_result = run_inspec_process_with_this_plugin("plugin install inspec-test-fixture", pre_run: pre_block)
|
275
|
-
|
276
|
-
refusal_message = install_result.stdout.split("\n").grep(/refusing/).last
|
277
|
-
skip_windows!
|
278
|
-
refute_nil refusal_message, "Should find a failure message at the end"
|
279
|
-
assert_includes refusal_message, "inspec-test-fixture"
|
280
|
-
assert_includes refusal_message, "0.2.0"
|
281
|
-
assert_includes refusal_message, "Plugin already installed at latest version"
|
282
|
-
|
283
|
-
assert_empty install_result.stderr
|
284
|
-
|
285
|
-
assert_exit_code 2, install_result
|
286
|
-
end
|
287
|
-
|
288
|
-
def test_refuse_install_when_already_installed_can_update
|
289
|
-
pre_block = Proc.new do |plugin_statefile_data, tmp_dir|
|
290
|
-
plugin_statefile_data.clear # Signal not to write a file, we'll provide one.
|
291
|
-
copy_in_core_config_dir("test-fixture-1-float", tmp_dir)
|
292
|
-
end
|
293
|
-
|
294
|
-
install_result = run_inspec_process_with_this_plugin("plugin install inspec-test-fixture", pre_run: pre_block)
|
295
|
-
|
296
|
-
refusal_message = install_result.stdout.split("\n").grep(/refusing/).last
|
297
|
-
skip_windows!
|
298
|
-
refute_nil refusal_message, "Should find a failure message at the end"
|
299
|
-
assert_includes refusal_message, "inspec-test-fixture"
|
300
|
-
assert_includes refusal_message, "0.1.0"
|
301
|
-
assert_includes refusal_message, "0.2.0"
|
302
|
-
assert_includes refusal_message, "Update required"
|
303
|
-
assert_includes refusal_message, "inspec plugin update"
|
304
|
-
|
305
|
-
assert_empty install_result.stderr
|
306
|
-
|
307
|
-
assert_exit_code 2, install_result
|
308
|
-
end
|
309
|
-
|
310
|
-
def test_install_from_rubygems_latest_with_train_plugin
|
311
|
-
install_result = run_inspec_process_with_this_plugin("plugin install train-test-fixture", post_run: list_after_run)
|
312
|
-
skip_windows!
|
313
|
-
|
314
|
-
success_message = install_result.stdout.split("\n").grep(/installed/).last
|
315
|
-
refute_nil success_message, "Should find a success message at the end"
|
316
|
-
assert_includes success_message, "train-test-fixture"
|
317
|
-
assert_includes success_message, "0.1.0"
|
318
|
-
assert_includes success_message, "installed from rubygems.org"
|
319
|
-
|
320
|
-
ttf_plugin = @list_result.detect { |p| p[:name] == "train-test-fixture" }
|
321
|
-
refute_nil ttf_plugin, "plugin name should now appear in the output of inspec list"
|
322
|
-
assert_equal "gem (user)", ttf_plugin[:type]
|
323
|
-
assert_equal "0.1.0", ttf_plugin[:version]
|
324
|
-
|
325
|
-
assert_empty install_result.stderr
|
326
|
-
assert_exit_code 0, install_result
|
327
|
-
end
|
328
|
-
|
329
|
-
def test_refuse_install_when_plugin_on_exclusion_list
|
330
|
-
# Here, 'inspec-core', 'inspec-multi-server', and 'train-tax-collector'
|
331
|
-
# are the names of real rubygems. They are not InSpec/Train plugins, though,
|
332
|
-
# and installing them would be a jam-up.
|
333
|
-
# This is configured in 'etc/plugin-filter.json'.
|
334
|
-
%w{
|
335
|
-
inspec-core
|
336
|
-
inspec-multi-server
|
337
|
-
train-tax-calculator
|
338
|
-
}.each do |plugin_name|
|
339
|
-
install_result = run_inspec_process_with_this_plugin("plugin install #{plugin_name}")
|
340
|
-
refusal_message = install_result.stdout
|
341
|
-
refute_nil refusal_message, "Should find a failure message at the end"
|
342
|
-
skip_windows!
|
343
|
-
assert_includes refusal_message, plugin_name
|
344
|
-
assert_includes refusal_message, "Plugin on Exclusion List"
|
345
|
-
assert_includes refusal_message, "refusing to install"
|
346
|
-
assert_includes refusal_message, "Rationale:"
|
347
|
-
assert_includes refusal_message, "etc/plugin_filters.json"
|
348
|
-
assert_includes refusal_message, "github.com/inspec/inspec/issues/new"
|
349
|
-
|
350
|
-
assert_empty install_result.stderr
|
351
|
-
|
352
|
-
assert_exit_code 2, install_result
|
353
|
-
end
|
354
|
-
end
|
355
|
-
|
356
|
-
def test_error_install_with_debug_enabled
|
357
|
-
skip "this test requires bundler to pass" unless defined? ::Bundler
|
358
|
-
|
359
|
-
install_result = run_inspec_process_with_this_plugin("plugin install inspec-test-fixture -v 0.1.1 --log-level debug")
|
360
|
-
skip_windows!
|
361
|
-
|
362
|
-
assert_includes install_result.stdout, "DEBUG"
|
363
|
-
|
364
|
-
assert_includes install_result.stderr, "can't activate rake"
|
365
|
-
|
366
|
-
assert_exit_code 1, install_result
|
367
|
-
end
|
368
|
-
end
|