Open atheiman opened 7 years ago
I have not been using test-kitchen and chef lately and have not been actively developing this plugin. One weakness with this plugin is that it captures the state of a node prior to converge but as you have noted, does not persist state post converge. Definitely open to PRs if you wanted to investigate ea solution.
it looks like the way to do this would be:
#download(remotes, local)
method to Kitchen::Transport::Base::Connection
conn.download('/tmp/kitchen/nodes', 'test/fixtures/nodes)
onto the end of this block on Kitchen::Provisioner::Base#call
I might give this a try if I get time.
https://github.com/test-kitchen/test-kitchen/pull/1306 will make this work. if that gets merged I think there could be some updates to kitchen-nodes:
kitchen nodes needs some changes to work with concurrency (-c 2
), it currently:
I think it needs to update to:
kitchen destroy
is runprovisioner[:downloads]
to ['/tmp/kitchen/data_bags', '/tmp/kitchen/nodes'] => 'test/integration'
so that data bags and nodes are downloaded from nodes by default and then ready to be uploaded to the next converged nodeWhat's the status of this suggestion? I'm having the same issue with kitchen-nodes: normal attributes of the nodes always get overwritten. It would be nice to have those preserved.
if youre running into the same issue I was - that the node file is deleted and recreated with only a few attributes at the start of the node's converge - then this patch will fix your problem:
require 'kitchen'
require 'kitchen/provisioner/chef_zero'
module Kitchen
module Provisioner
# Patch kitchen-nodes to not delete node files before converge. This
# ensures all node files will be uploaded during concurrent provisions.
# https://github.com/mwrock/kitchen-nodes/blob/master/lib/kitchen/provisioner/nodes.rb
class Nodes < ChefZero
def create_sandbox
create_node
ensure
super
end
end
end
end
That needs to be loaded when you run kitchen
commands - I required it from a Rakefile
which I use to kick off test-kitchen actions. Not ideal.
It would be a good idea to make this change in this gem - but I have not submitted a pr for it. it probably needs to be configurable whether or not the node file is deleted at the start of the node's converge.
FWIW, #node_template should merge the normal attributes from the already existing node file, if anything. This would make sure that other, updated nodes' info also get their way into the index.
Right now this doesnt seem to bring back the converged node attributes to the nodes directory on the workstation. For example, if you converge a node with an environment, environment attributes are written to the node json file on the instance (
/tmp/kitchen/nodes/my-node.json
). But the attributes are not written back to the node json file on the workstation (test/fixtures/nodes/my-node.json
). The purpose of this would be to then search for the nodes that have attributes from an environment or that were set during a chef-client converge.Is there a way to copy
/tmp/kitchen/nodes
from the instance back to the workstation nodes dir after converge?Seems this could be done with data bags as well, some recipes create data bag items for recipes on other nodes to consume.