Class: Kitchen::Verifier::Base
- Inherits:
-
Object
- Object
- Kitchen::Verifier::Base
- Defined in:
- lib/kitchen/helpers.rb
Overview
Instance Method Summary collapse
-
#call(state) ⇒ void
Run the verifier against the instance.
-
#create_sandbox ⇒ void
Create the verifier sandbox under ~/.dokken.
-
#instance_name ⇒ String
A container-safe, collision-free name for this kitchen instance.
-
#sandbox_path ⇒ String
Where the verifier stages files for this instance.
Instance Method Details
#call(state) ⇒ void
This method returns an undefined value.
Run the verifier against the instance.
This replaces Kitchen::Verifier::Base#call outright, so it has to be read against the upstream version it stands in for. It diverges in three places, and each divergence is deliberate:
-
The upload is gated on the data container. Files are only shipped when the driver built one, which it does exactly when the daemon cannot read the host filesystem. Otherwise the sandboxes are bind-mounted and are already in place.
init_commandis gated with it because for Busser it clears the verifier root, which in bind-mount mode is the host sandbox that was just populated. -
cleanup_sandboxis not called, and must not be. Upstream canrmtreeits sandbox because a stock one is a throwawayDir.mktmpdir. Dokken's is a stable per-instance directory that the driver bind-mounts into a long-lived container, and a bind mount is bound to an inode rather than to a path: removing the directory severs it permanently, and themkdir_pin the nextcreate_sandboxdoes not restore it. Verified against Docker -- after an rmtree and a recreate, the host has the file and the container cannot see it, until the container itself is replaced. Kitchen::Provisioner::Dokken#cleanup_dokken_sandbox is the shape that is safe here: empty the directory, keep the inode. -
config[:downloads]is not honoured. Upstream downloads files off the instance after the run command. That cannot work here yet for a second reason as well: Transport::Dokken::Connection does not implementdownload, so the base class would raise. Wiring both up is worth doing, and is the one divergence here that is a gap rather than a decision.
spec/kitchen/verifier_override_contract_spec.rb pins the upstream facts this reasoning rests on, so that a test-kitchen release which invalidates any of them fails loudly rather than silently.
669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 |
# File 'lib/kitchen/helpers.rb', line 669 def call(state) create_sandbox instance.transport.connection(state) do |conn| conn.execute(install_command) unless state[:data_container].nil? conn.execute(init_command) info("Transferring files to #{instance.to_str}") conn.upload(sandbox_dirs, config[:root_path]) debug("Transfer complete") end conn.execute(prepare_command) conn.execute(run_command) end rescue Kitchen::Transport::TransportFailed => ex raise ActionFailed, ex. end |
#create_sandbox ⇒ void
This method returns an undefined value.
Create the verifier sandbox under ~/.dokken.
608 609 610 611 612 613 |
# File 'lib/kitchen/helpers.rb', line 608 def create_sandbox info("Creating kitchen sandbox in #{sandbox_path}") unless ::Dir.exist?(sandbox_path) FileUtils.mkdir_p(sandbox_path, mode: 0o755) end end |
#instance_name ⇒ String
A container-safe, collision-free name for this kitchen instance.
626 627 628 |
# File 'lib/kitchen/helpers.rb', line 626 def instance_name ::Dokken::Helpers.instance_name_for(instance) end |
#sandbox_path ⇒ String
Where the verifier stages files for this instance.
618 619 620 |
# File 'lib/kitchen/helpers.rb', line 618 def sandbox_path "#{Dir.home}/.dokken/verifier_sandbox/#{instance_name}" end |