somehow I cannot get rid of BoltSpec’s expect_plan...
# bolt
y
somehow I cannot get rid of BoltSpec’s expect_plan problem..
Copy code
Failure/Error: result = run_plan(plan, params)
     
     RuntimeError:
       Expected base::run_puppet to be called 1 times with parameters {"nodes"=>["etcd-abcd1", "etcd-abcd2", "etcd-abcd3"], "max_iterations"=>10}
       Plan result: [{"target":"localhost","action":"action","object":null,"status":"success","value":{}}]
       /opt/puppetlabs/pdk/share/cache/ruby/3.2.0/gems/bolt-3.27.4/lib/bolt_spec/plans/action_stubs.rb:70:in `assert_called'
[...]
1
I have the plan mocked:
Copy code
expect_plan('base::run_puppet')
      .with_params('nodes' => ['etcd-abcd1', 'etcd-abcd2', 'etcd-abcd3'], 'max_iterations' => 10)
Copy code
result = run_plan(plan, params)
    expect(result.ok?).to be(true)
If I delete the mock it’ll complain about unexpected call.. if I change mock to stub (allow_plan) it works fine
but I want to ensure the plan is expected to be called actually
It looks like it is related to having an array in the plan parameters somehow
also, this plan is called multiple times with different parameters.. so I have multiple expect_plan() with different .with_params()
it’s definitely related to the array in params.. but it happens only when a variable is passed as a plan parameter of the Array type
when I put a static list in
nodes
e.g. it is matched/expected just fine
well.. those parameters are TargetSpec’s actually facepalm
yeah.. mystery solved with making the array of Bolt::Target’s
sometimes auto-converting things to a String makes it harder to debug.. hit this few times during the recent week