inspec / kitchen-inspec

Test-Kitchen Plugin for InSpec
Other
109 stars 58 forks source link

Error when using plugin-based reporters and multiple instances #262

Closed clintoncwolfe closed 3 years ago

clintoncwolfe commented 3 years ago

Error "Plugin hooks search returned multiple results for filter" when using multiple instances and a reporter that is loaded from a plugin.

Version:

test-kitchen 2.7.2 kitchen-inspec 2.2.1 inspec 4.23.15

Environment:

Any host OS. Any driver. Any guest OS.

No cookbook.

Scenario:

Run a kitchen verify on a kitchenfile that has multiple instances (platforms x suites > 1) and has multiple reporters configured (at least one of which is plugin based).

Steps to Reproduce:

Kitchenfile:

driver:
  name: vagrant

provisioner:
  name: chef_solo

platforms:
  - name: centos8
    driver:
      box: centos/8
  - name: centos7
    driver:
      box: centos/7

suites:
  - name: default
    run_list:
    attributes:

verifier:
  name: inspec
  reporter:
    - cli
    - documentation:.kitchen/%{platform}_%{suite}_inspec.txt
    - junit2:.kitchen/%{platform}_%{suite}_inspec.xml

Place any simple control in test/integration/default/controls/test.rb:

control "ctl-01" do
  describe file("/tmp") do
    it { should be_directory }
  end
end

Expected Result:

Normal verify run

Actual Result:

-----> Starting Test Kitchen (v2.7.2)
-----> Verifying <default-centos8>...
       Loaded tests from {:path=>".Users.cwolfe.sandbox.test-kitchen.test-kitchen.temp-vagrant.test.integration.default"}

Profile: tests from {:path=>"/Users/cwolfe/sandbox/test-kitchen/test-kitchen/temp-vagrant/test/integration/default"} (tests from {:path=>".Users.cwolfe.sandbox.test-kitchen.test-kitchen.temp-vagrant.test.integration.default"})
Version: (not specified)
Target:  ssh://vagrant@127.0.0.1:2200

  ✔  ctl-01: File /tmp
     ✔  File /tmp is expected to be directory

Profile Summary: 1 successful control, 0 control failures, 0 controls skipped
Test Summary: 1 successful, 0 failures, 0 skipped
       Finished verifying <default-centos8> (0m2.37s).
-----> Setting up <default-centos7>...
       Finished setting up <default-centos7> (0m0.00s).
-----> Verifying <default-centos7>...
       Loaded tests from {:path=>".Users.cwolfe.sandbox.test-kitchen.test-kitchen.temp-vagrant.test.integration.default"}

Profile: tests from {:path=>"/Users/cwolfe/sandbox/test-kitchen/test-kitchen/temp-vagrant/test/integration/default"} (tests from {:path=>".Users.cwolfe.sandbox.test-kitchen.test-kitchen.temp-vagrant.test.integration.default"})
Version: (not specified)
Target:  ssh://vagrant@127.0.0.1:2202

  ✔  ctl-01: File /tmp
     ✔  File /tmp is expected to be directory

Profile Summary: 1 successful control, 0 control failures, 0 controls skipped
Test Summary: 1 successful, 0 failures, 0 skipped
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>>     Failed to complete #verify action: [Plugin hooks search returned multiple results for filter {:plugin_type=>:reporter, :activator_name=>:junit2} - use more filters, or use find_activators (plural)] on default-centos7
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration
clintoncwolfe commented 3 years ago

It appears that it need not be multiple reporters; only that there be one reporter that is definitely plugin-based.