Class: Kitchen::Driver::Proxy

Inherits:
Base show all
Defined in:
lib/kitchen/driver/proxy.rb

Overview

Simple driver that proxies commands through to a test instance whose lifecycle is not managed by Test Kitchen. This driver is useful for long- lived non-ephemeral test instances that are simply “reset” between test runs. Think executing against devices like network switches–this is why the driver was created.

Author:

Instance Attribute Summary

Attributes included from Configurable

#instance

Instance Method Summary collapse

Methods inherited from Base

#cache_directory, #doctor, #initialize, kitchen_driver_api_version, #package

Methods included from ShellOut

#run_command

Methods included from Logging

#banner, #debug, #error, #fatal, #info, #warn

Methods included from Configurable

#[], #bourne_shell?, #calculate_path, #config_keys, #diagnose, #diagnose_plugin, #finalize_config!, included, #name, #powershell_shell?, #remote_path_join, #unix_os?, #verify_dependencies, #windows_os?

Methods inherited from Plugin::Base

no_parallel_for

Constructor Details

This class inherits a constructor from Kitchen::Driver::Base

Instance Method Details

#create(state) ⇒ Object

Creates an instance.

Parameters:

  • state (Hash)

    mutable instance and driver state

Raises:



35
36
37
38
39
40
41
42
# File 'lib/kitchen/driver/proxy.rb', line 35

def create(state)
  super
  state[:hostname] = config[:host]
  state[:port] = config[:port] if config[:port]
  state[:username] = config[:username] if config[:username]
  state[:password] = config[:password] if config[:password]
  reset_instance(state)
end

#destroy(state) ⇒ Object

Destroys an instance.

Parameters:

  • state (Hash)

    mutable instance and driver state

Raises:



45
46
47
48
49
50
# File 'lib/kitchen/driver/proxy.rb', line 45

def destroy(state)
  return if state[:hostname].nil?

  reset_instance(state)
  state.delete(:hostname)
end