Documentation
¶
Overview ¶
Package drivermock implements a mock driver. It should be used only in tests.
In particular, the driver implemented in this package uses mock images, whose status is not stored permanently. Image status, therefore, can vary between tests.
Index ¶
- Variables
- type Driver
- func (vd *Driver) DeleteMachine(machinename string, clustername string) error
- func (vd *Driver) DeleteNetwork(clustername string) error
- func (vd *Driver) DeleteRemoteImage(k8sversion string)
- func (vd *Driver) Description() string
- func (vd *Driver) Error() string
- func (vd *Driver) GetImage(k8sversion string) (drivercore.Image, error)
- func (vd *Driver) GetMachine(machinename string, clustername string) (drivercore.Machine, error)
- func (vd *Driver) GetNetwork(clustername string) (drivercore.Network, error)
- func (vd *Driver) K8sVersions() []string
- func (vd *Driver) ListImages() ([]drivercore.Image, error)
- func (vd *Driver) ListMachines() ([]drivercore.Machine, error)
- func (vd *Driver) ListNetworks() ([]drivercore.Network, error)
- func (vd *Driver) Name() string
- func (vd *Driver) NewMachine(machinename string, clustername string, k8sversion string) (drivercore.Machine, error)
- func (vd *Driver) NewNetwork(clustername string) (drivercore.Network, error)
- func (vd *Driver) QualifiedMachineName(machinename string, clustername string) string
- func (vd *Driver) QualifiedNetworkName(clustername string) string
- func (vd *Driver) Status() string
- func (vd *Driver) UpdateImageList() error
- func (vd *Driver) UpdateRemoteImage(k8sversion string, deprecated bool)
- func (vd *Driver) UsesNATNetworking() bool
- func (vd *Driver) UsesPerClusterNetworking() bool
- func (vd *Driver) ValidK8sVersion(k8sversion string) bool
- type Image
- func (img *Image) Deprecated() bool
- func (img *Image) Fetch() error
- func (img *Image) FetchWithProgress(progress func(int64, int64)) error
- func (img *Image) FromFile(filepath string) error
- func (img *Image) K8sVersion() string
- func (img *Image) PurgeLocal() error
- func (img *Image) Status() drivercore.ImageStatus
- type Machine
- func (vh *Machine) Error() string
- func (vh *Machine) ExecuteCommand(command drivercore.PredefinedCommand, params ...string) error
- func (vh *Machine) ForceStop() error
- func (vh *Machine) ForwardPort(hostport int, machineport int) error
- func (vh *Machine) ForwardSSHPort(hostport int) error
- func (vh *Machine) IPAddress() string
- func (vh *Machine) ImplementsCommand(command drivercore.PredefinedCommand) bool
- func (vh *Machine) Name() string
- func (vh *Machine) SSHAddress() string
- func (vh *Machine) Start() error
- func (vh *Machine) Status() drivercore.MachineStatus
- func (vh *Machine) Stop() error
- func (vh *Machine) UnforwardPort(machineport int) error
- func (vh *Machine) WaitForStateChange(timeoutinseconds int)
- type Network
Constants ¶
This section is empty.
Variables ¶
var DefaultNetCIDR = "192.168.125.0/24"
DefaultNetCIDR is the address range used by NAT networks.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver implements the drivercore.Driver interface
func (*Driver) DeleteMachine ¶
DeleteMachine deletes the specified machine.
func (*Driver) DeleteNetwork ¶
DeleteNetwork deletes a network.
func (*Driver) DeleteRemoteImage ¶
DeleteRemoteImage deletes a mock remote image.
func (*Driver) Description ¶
Description returns the driver description.
func (*Driver) GetImage ¶
func (vd *Driver) GetImage(k8sversion string) (drivercore.Image, error)
GetImage returns the image for the specified k8s version, or nil.
func (*Driver) GetMachine ¶
GetMachine returns the specified machine, or an error.
func (*Driver) GetNetwork ¶
func (vd *Driver) GetNetwork(clustername string) (drivercore.Network, error)
GetNetwork gets a network.
func (*Driver) K8sVersions ¶
K8sVersions lists locally available k8s versions.
func (*Driver) ListImages ¶
func (vd *Driver) ListImages() ([]drivercore.Image, error)
ListImages returns the local images.
func (*Driver) ListMachines ¶
func (vd *Driver) ListMachines() ([]drivercore.Machine, error)
ListMachines returns the list of machines.
func (*Driver) ListNetworks ¶
func (vd *Driver) ListNetworks() ([]drivercore.Network, error)
ListNetworks gets a list of networks.
func (*Driver) NewMachine ¶
func (vd *Driver) NewMachine(machinename string, clustername string, k8sversion string) (drivercore.Machine, error)
NewMachine creates a new machine.
func (*Driver) NewNetwork ¶
func (vd *Driver) NewNetwork(clustername string) (drivercore.Network, error)
NewNetwork creates a network for a cluster.
func (*Driver) QualifiedMachineName ¶
QualifiedMachineName returns the driver-qualified machine name.
func (*Driver) QualifiedNetworkName ¶
QualifiedNetworkName adds a suffix to the specified cluster name.
func (*Driver) UpdateImageList ¶
UpdateImageList updates the image list
func (*Driver) UpdateRemoteImage ¶
UpdateRemoteImage adds or updates a mock remote image.
func (*Driver) UsesNATNetworking ¶
UsesNATNetworking returns if this particular mock driver instance uses NAT networking
func (*Driver) UsesPerClusterNetworking ¶ added in v0.2.0
UsesPerClusterNetworking returns if this particular mock driver instance uses per cluster networking
func (*Driver) ValidK8sVersion ¶
ValidK8sVersion returns true if the specified k8s version is available in localimages, false otherwise.
type Image ¶
type Image struct {
// contains filtered or unexported fields
}
Image implements the drivercore.Image interface.
func (*Image) Deprecated ¶
Deprecated returns the deprecation status of the image.
func (*Image) FetchWithProgress ¶ added in v0.3.0
FetchWithProgress downloads the image from the driver repository into the local cache, and reports progress via the supplied callback. The callback reports current and total in bytes.
func (*Image) K8sVersion ¶
K8sVersion returns the k8s version of the image.
func (*Image) PurgeLocal ¶
PurgeLocal removes the local copy of an image.
func (*Image) Status ¶
func (img *Image) Status() drivercore.ImageStatus
Status returns the status of the image.
type Machine ¶
type Machine struct {
// contains filtered or unexported fields
}
Machine implements the drivercore.Machine interface
func (*Machine) Error ¶
Error returns the last error message returned by the machine, or an empty string.
func (*Machine) ExecuteCommand ¶
func (vh *Machine) ExecuteCommand(command drivercore.PredefinedCommand, params ...string) error
ExecuteCommand executes a predefined command.
func (*Machine) ForwardPort ¶
ForwardPort forwards a port.
func (*Machine) ForwardSSHPort ¶
ForwardSSHPort forwards the SSH port.
func (*Machine) ImplementsCommand ¶
func (vh *Machine) ImplementsCommand(command drivercore.PredefinedCommand) bool
ImplementsCommand returns true if a predefined command has been implemented, false otherwise.
func (*Machine) SSHAddress ¶
SSHAddress returns the SSH address of the machine.
func (*Machine) Status ¶
func (vh *Machine) Status() drivercore.MachineStatus
Status returns the status of the machine.
func (*Machine) UnforwardPort ¶
UnforwardPort unforwards a port.
func (*Machine) WaitForStateChange ¶
WaitForStateChange waits until the status of a machine has changed, or until timeout. In this mock, it just waits till 1/10th of timeout.