Documentation ¶
Index ¶
- func Exists(api libmachine.API, name string) bool
- func MakeTempDir() string
- func State(api libmachine.API, name string) state.State
- type MockAPI
- func (api *MockAPI) Close() error
- func (api *MockAPI) Create(h *host.Host) error
- func (api *MockAPI) Exists(name string) (bool, error)
- func (api MockAPI) GetMachinesDir() string
- func (api *MockAPI) List() ([]string, error)
- func (api *MockAPI) Load(name string) (*host.Host, error)
- func (api *MockAPI) NewHost(driverName string, rawDriver []byte) (*host.Host, error)
- func (api *MockAPI) Remove(name string) error
- func (api *MockAPI) Save(host *host.Host) error
- type MockDetector
- type MockDriver
- func (driver *MockDriver) Create() error
- func (driver *MockDriver) GetCreateFlags() []mcnflag.Flag
- func (driver *MockDriver) GetIP() (string, error)
- func (driver *MockDriver) GetSSHHostname() (string, error)
- func (driver *MockDriver) GetSSHKeyPath() string
- func (driver *MockDriver) GetSSHPort() (int, error)
- func (driver *MockDriver) GetState() (state.State, error)
- func (driver *MockDriver) GetURL() (string, error)
- func (driver *MockDriver) Kill() error
- func (driver *MockDriver) Remove() error
- func (driver *MockDriver) Restart() error
- func (driver *MockDriver) SetConfigFromFlags(opts drivers.DriverOptions) error
- func (driver *MockDriver) Start() error
- func (driver *MockDriver) Stop() error
- type MockHost
- type MockProvisioner
- func (provisioner *MockProvisioner) AttemptIPContact(dockerPort int)
- func (provisioner *MockProvisioner) CompatibleWithHost() bool
- func (provisioner *MockProvisioner) GenerateDockerOptions(dockerPort int) (*provision.DockerOptions, error)
- func (provisioner *MockProvisioner) GetAuthOptions() auth.Options
- func (provisioner *MockProvisioner) GetDockerOptionsDir() string
- func (provisioner *MockProvisioner) GetDriver() drivers.Driver
- func (provisioner *MockProvisioner) GetOsReleaseInfo() (*provision.OsRelease, error)
- func (provisioner *MockProvisioner) Hostname() (string, error)
- func (provisioner *MockProvisioner) Package(name string, action pkgaction.PackageAction) error
- func (provisioner *MockProvisioner) Provision(swarmOptions swarm.Options, authOptions auth.Options, ...) error
- func (provisioner *MockProvisioner) SSHCommand(args string) (string, error)
- func (provisioner *MockProvisioner) Service(name string, action serviceaction.ServiceAction) error
- func (provisioner *MockProvisioner) SetHostname(hostname string) error
- func (provisioner *MockProvisioner) SetOsReleaseInfo(info *provision.OsRelease)
- func (provisioner *MockProvisioner) String() string
- type SSHServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Exists ¶
func Exists(api libmachine.API, name string) bool
Exists tells whether a named host exists.
func MakeTempDir ¶
func MakeTempDir() string
Types ¶
type MockAPI ¶
type MockAPI struct { Hosts map[string]*host.Host CreateError bool RemoveError bool SaveCalled bool }
MockAPI is a struct used to mock out libmachine.API
func NewMockAPI ¶
func NewMockAPI() *MockAPI
func (MockAPI) GetMachinesDir ¶
GetMachinesDir returns the directory to store machines in.
type MockDetector ¶ added in v0.4.0
type MockDetector struct {
Provisioner *MockProvisioner
}
func (*MockDetector) DetectProvisioner ¶ added in v0.4.0
func (m *MockDetector) DetectProvisioner(d drivers.Driver) (provision.Provisioner, error)
type MockDriver ¶
type MockDriver struct { drivers.BaseDriver CurrentState state.State RemoveError bool HostError bool Port int }
MockDriver is a struct used to mock out libmachine.Driver
func (*MockDriver) Create ¶
func (driver *MockDriver) Create() error
Create creates a MockDriver instance
func (*MockDriver) GetCreateFlags ¶
func (driver *MockDriver) GetCreateFlags() []mcnflag.Flag
GetCreateFlags returns the flags used to create a MockDriver
func (*MockDriver) GetIP ¶
func (driver *MockDriver) GetIP() (string, error)
func (*MockDriver) GetSSHHostname ¶
func (driver *MockDriver) GetSSHHostname() (string, error)
GetSSHHostname returns the hostname for SSH
func (*MockDriver) GetSSHKeyPath ¶
func (driver *MockDriver) GetSSHKeyPath() string
GetSSHHostname returns the hostname for SSH
func (*MockDriver) GetSSHPort ¶
func (driver *MockDriver) GetSSHPort() (int, error)
func (*MockDriver) GetState ¶
func (driver *MockDriver) GetState() (state.State, error)
GetState returns the state of the driver
func (*MockDriver) GetURL ¶
func (driver *MockDriver) GetURL() (string, error)
GetURL returns the URL of the driver
func (*MockDriver) SetConfigFromFlags ¶
func (driver *MockDriver) SetConfigFromFlags(opts drivers.DriverOptions) error
SetConfigFromFlags sets the machine config
type MockHost ¶ added in v0.4.0
type MockHost struct { CommandOutput map[string]string Error string Commands map[string]int Driver drivers.Driver }
MockHost used for testing. When commands are run, the output from CommandOutput is used, if present. Then the output from Error is used, if present. Finally, "", nil is returned.
func NewMockHost ¶ added in v0.4.0
func NewMockHost() *MockHost
type MockProvisioner ¶ added in v0.4.0
type MockProvisioner struct {
Provisioned bool
}
Provisioner defines distribution specific actions
func (*MockProvisioner) AttemptIPContact ¶ added in v0.4.0
func (provisioner *MockProvisioner) AttemptIPContact(dockerPort int)
func (*MockProvisioner) CompatibleWithHost ¶ added in v0.4.0
func (provisioner *MockProvisioner) CompatibleWithHost() bool
func (*MockProvisioner) GenerateDockerOptions ¶ added in v0.4.0
func (provisioner *MockProvisioner) GenerateDockerOptions(dockerPort int) (*provision.DockerOptions, error)
func (*MockProvisioner) GetAuthOptions ¶ added in v0.4.0
func (provisioner *MockProvisioner) GetAuthOptions() auth.Options
func (*MockProvisioner) GetDockerOptionsDir ¶ added in v0.4.0
func (provisioner *MockProvisioner) GetDockerOptionsDir() string
func (*MockProvisioner) GetDriver ¶ added in v0.4.0
func (provisioner *MockProvisioner) GetDriver() drivers.Driver
func (*MockProvisioner) GetOsReleaseInfo ¶ added in v0.4.0
func (provisioner *MockProvisioner) GetOsReleaseInfo() (*provision.OsRelease, error)
func (*MockProvisioner) Hostname ¶ added in v0.4.0
func (provisioner *MockProvisioner) Hostname() (string, error)
func (*MockProvisioner) Package ¶ added in v0.4.0
func (provisioner *MockProvisioner) Package(name string, action pkgaction.PackageAction) error
func (*MockProvisioner) SSHCommand ¶ added in v0.4.0
func (provisioner *MockProvisioner) SSHCommand(args string) (string, error)
func (*MockProvisioner) Service ¶ added in v0.4.0
func (provisioner *MockProvisioner) Service(name string, action serviceaction.ServiceAction) error
func (*MockProvisioner) SetHostname ¶ added in v0.4.0
func (provisioner *MockProvisioner) SetHostname(hostname string) error
func (*MockProvisioner) SetOsReleaseInfo ¶ added in v0.4.0
func (provisioner *MockProvisioner) SetOsReleaseInfo(info *provision.OsRelease)
func (*MockProvisioner) String ¶ added in v0.4.0
func (provisioner *MockProvisioner) String() string
type SSHServer ¶
type SSHServer struct { Config *ssh.ServerConfig // Commands stores the raw commands executed against the server. Commands map[string]int Connected bool Transfers *bytes.Buffer HadASessionRequested bool CommandToOutput map[string]string }
SSHServer provides a mock SSH Server for testing. Commands are stored, not executed.
func NewSSHServer ¶
NewSSHServer returns a NewSSHServer instance, ready for use.