run_command: support an array of commands #5678
Annotations
4 errors
|
bolt-modules/boltlib/spec/functions/run_command_spec.rb#L182
run_command it calls bolt executor run_command without targets - does not invoke bolt
Failure/Error:
is_expected.to run
.with_params(command, [])
.and_return(Bolt::ResultSet.new([]))
expected run_command("hostname", []) to have returned #<Bolt::ResultSet:0x0000025102c13ce8 @results=[]> instead of raising Puppet::Pops::Types::TypeAssertionError(value returned from function 'run_command' has wrong type, expects an Object[{name => 'ResultSet', attributes => {'results' => Array[Variant[Result, ApplyResult]]}, functions => {'count' => Callable[[0, 0], Integer], 'empty' => Callable[[0, 0], Boolean], 'error_set' => Callable[[0, 0], ResultSet], 'filter_set' => Callable[[0, 0, Callable], ResultSet], 'find' => Callable[[String[1]], Optional[Variant[Result, ApplyResult]]], 'first' => Callable[[0, 0], Optional[Variant[Result, ApplyResult]]], 'names' => Callable[[0, 0], Array[String[1]]], 'ok' => Callable[[0, 0], Boolean], 'ok_set' => Callable[[0, 0], ResultSet], 'targets' => Callable[[0, 0], Array[Target]], 'to_data' => Callable[[0, 0], Array[Hash]], '[]' => Variant[Callable[[Integer], Optional[Variant[Result, ApplyResult, Array[Variant[Result, ApplyResult]]]]], Callable[[Integer, Integer], Optional[Variant[Result, ApplyResult, Array[Variant[Result, ApplyResult]]]]]]}}] value, got Object[{name => 'Result', attributes => {'value' => Hash[String[1], Data], 'target' => Target}, functions => {'error' => Callable[[0, 0], Optional[Error]], 'message' => Callable[[0, 0], Optional[String]], 'sensitive' => Callable[[0, 0], Optional[Sensitive[Data]]], 'action' => Callable[[0, 0], String], 'status' => Callable[[0, 0], String], 'to_data' => Callable[[0, 0], Hash], 'ok' => Callable[[0, 0], Boolean], '[]' => Callable[[String[1]], Variant[Data, Sensitive[Data]]]}}])
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/puppet-7.32.1/lib/puppet/pops/types/type_asserter.rb:41:in `report_type_mismatch'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/puppet-7.32.1/lib/puppet/pops/types/type_asserter.rb:33:in `assert_instance_of'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/puppet-7.32.1/lib/puppet/pops/functions/dispatch.rb:62:in `invoke'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/puppet-7.32.1/lib/puppet/pops/functions/dispatcher.rb:47:in `block in dispatch'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/puppet-7.32.1/lib/puppet/pops/functions/dispatcher.rb:46:in `catch'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/puppet-7.32.1/lib/puppet/pops/functions/dispatcher.rb:46:in `dispatch'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/puppet-7.32.1/lib/puppet/pops/functions/function.rb:43:in `block in call'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/puppet-7.32.1/lib/puppet/pops/functions/function.rb:42:in `catch'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/puppet-7.32.1/lib/puppet/pops/functions/function.rb:42:in `call'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/rspec-puppet-4.0.2/lib/rspec-puppet/example/function_example_group.rb:21:in `block in execute'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/puppet-7.32.1/lib/puppet/context.rb:62:in `override'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/puppet-7.32.1/lib/puppet.rb:289:in `override'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/rspec-puppet-4.0.2/lib/rspec-puppet/example/function_example_group.rb:20:in `execute'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/rspec-puppet-4.0.2/lib/rspec-puppet/matchers/run.rb:12:in `matches?'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.13.1/lib/rspec/expectations/handler.rb:51:in `block in handle_matcher'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.13.1/lib/rspec/expectations/handler.rb:27:in `with_matcher'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.13.1/lib/rspec/expectations/handler.rb:48:in `handle_matcher'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.13.1/lib/rspec/expectations/expectation_target.rb:65:in `to'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.13.1/lib/rspec/expectations/expectation_target.rb:101:in `t
|
bolt-modules/boltlib/spec/functions/run_command_spec.rb#L237
run_command with _env_vars transforms values to json
Failure/Error:
is_expected.to run
.with_params(command, targets, { '_env_vars' => env_vars })
expected run_command("echo $FRUIT", ["localhost"], {"_env_vars"=>{"FRUIT"=>{"apple"=>"banana"}}}) to have run successfully instead of Mocha::ExpectationError(unexpected invocation: #<Bolt::Executor:0x11a58>.run_command(["localhost"], "echo \\$FRUIT", {:env_vars => {"FRUIT" => "{\"apple\":\"banana\"}"}}, [])
unsatisfied expectations:
- expected exactly once, not yet invoked: #<Bolt::Executor:0x11a58>.run_command(["localhost"], "echo $FRUIT", {:env_vars => {"FRUIT" => "{\"apple\":\"banana\"}"}}, [])
satisfied expectations:
- expected exactly once, invoked once: #<Mock:inventory>.get_targets(["localhost"])
- allowed any number of times, invoked once: #<Mock:inventory>.target_implementation_class(any_parameters)
- allowed any number of times, not yet invoked: #<Mock:inventory>.version(any_parameters)
- allowed any number of times, not yet invoked: #<Puppet::Util::Feature:0x61f8>.root?(any_parameters)
)
D:/a/bolt/bolt/bolt-modules/boltlib/spec/fixtures/modules/boltlib/lib/puppet/functions/run_command.rb:154:in `run_command_with_description'
D:/a/bolt/bolt/bolt-modules/boltlib/spec/fixtures/modules/boltlib/lib/puppet/functions/run_command.rb:66:in `run_command'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/puppet-7.32.1/lib/puppet/pops/functions/dispatch.rb:60:in `invoke'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/puppet-7.32.1/lib/puppet/pops/functions/dispatcher.rb:47:in `block in dispatch'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/puppet-7.32.1/lib/puppet/pops/functions/dispatcher.rb:46:in `catch'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/puppet-7.32.1/lib/puppet/pops/functions/dispatcher.rb:46:in `dispatch'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/puppet-7.32.1/lib/puppet/pops/functions/function.rb:43:in `block in call'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/puppet-7.32.1/lib/puppet/pops/functions/function.rb:42:in `catch'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/puppet-7.32.1/lib/puppet/pops/functions/function.rb:42:in `call'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/rspec-puppet-4.0.2/lib/rspec-puppet/example/function_example_group.rb:21:in `block in execute'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/puppet-7.32.1/lib/puppet/context.rb:62:in `override'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/puppet-7.32.1/lib/puppet.rb:289:in `override'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/rspec-puppet-4.0.2/lib/rspec-puppet/example/function_example_group.rb:20:in `execute'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/rspec-puppet-4.0.2/lib/rspec-puppet/matchers/run.rb:12:in `matches?'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.13.1/lib/rspec/expectations/handler.rb:51:in `block in handle_matcher'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.13.1/lib/rspec/expectations/handler.rb:27:in `with_matcher'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.13.1/lib/rspec/expectations/handler.rb:48:in `handle_matcher'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.13.1/lib/rspec/expectations/expectation_target.rb:65:in `to'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/rspec-expectations-3.13.1/lib/rspec/expectations/expectation_target.rb:101:in `to'
D:/a/bolt/bolt/bolt-modules/boltlib/spec/functions/run_command_spec.rb:248:in `block (3 levels) in <top (required)>'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.13.0/lib/rspec/core/example.rb:263:in `instance_exec'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.13.0/lib/rspec/core/example.rb:263:in `block in run'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.13.0/lib/rspec/core/example.rb:511:in `block in with_around_and_singleton_context_hooks'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.13.0/lib/rspec/core/example.rb:468:in `block in with_around_example_hooks'
D:/a/bolt/bolt/vendor/bundle/ruby/2.7.0/gems/rspec-co
|
|
This job was cancelled
Loading