Documentation
¶
Index ¶
- func MakeTempDir() string
- func RemoveTempDir(tempdir string)
- type FakeFile
- type FakeStore
- type MockAPI
- func (api *MockAPI) Close() error
- func (api *MockAPI) Create(h *host.Host) error
- func (api MockAPI) GetMachinesDir() string
- func (api *MockAPI) List() ([]string, error)
- func (api *MockAPI) Load(name string) (*host.Host, error)
- func (api *MockAPI) Logf(format string, args ...interface{})
- func (api *MockAPI) NewHost(drvName 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 (d *MockDriver) Create() error
- func (d *MockDriver) DriverName() string
- func (d *MockDriver) GetCreateFlags() []mcnflag.Flag
- func (d *MockDriver) GetIP() (string, error)
- func (d *MockDriver) GetSSHHostname() (string, error)
- func (d *MockDriver) GetSSHKeyPath() string
- func (d *MockDriver) GetSSHPort() (int, error)
- func (d *MockDriver) GetState() (state.State, error)
- func (d *MockDriver) GetURL() (string, error)
- func (d *MockDriver) Kill() error
- func (d *MockDriver) Logf(format string, args ...interface{})
- func (d *MockDriver) Remove() error
- func (d *MockDriver) Restart() error
- func (d *MockDriver) SetConfigFromFlags(opts drivers.DriverOptions) error
- func (d *MockDriver) Start() error
- func (d *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) GetSwarmOptions() swarm.Options
- 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 RemoveTempDir ¶ added in v1.12.0
func RemoveTempDir(tempdir string)
Types ¶
type FakeFile ¶ added in v1.2.0
type FakeFile struct {
// contains filtered or unexported fields
}
FakeFile satisfies fdWriter
type FakeStore ¶ added in v0.31.0
FakeStore implements persist.Store from libmachine
type MockAPI ¶
type MockAPI struct { FakeStore CreateError bool RemoveError bool NotExistError bool SaveCalled bool // contains filtered or unexported fields }
MockAPI is a struct used to mock out libmachine.API
func (MockAPI) GetMachinesDir ¶
GetMachinesDir returns the directory to store machines in.
type MockDetector ¶ added in v0.4.0
type MockDetector struct {
Provisioner *MockProvisioner
}
MockDetector can detect MockProvisioner
func (*MockDetector) DetectProvisioner ¶ added in v0.4.0
func (m *MockDetector) DetectProvisioner(d drivers.Driver) (provision.Provisioner, error)
DetectProvisioner detects a provisioner
type MockDriver ¶
type MockDriver struct { drivers.BaseDriver CurrentState state.State RemoveError bool NotExistError bool HostError bool Port int IP string T *testing.T }
MockDriver is a struct used to mock out libmachine.Driver
func (*MockDriver) Create ¶
func (d *MockDriver) Create() error
Create creates a MockDriver instance
func (*MockDriver) DriverName ¶ added in v1.3.0
func (d *MockDriver) DriverName() string
DriverName returns the name of the driver
func (*MockDriver) GetCreateFlags ¶
func (d *MockDriver) GetCreateFlags() []mcnflag.Flag
GetCreateFlags returns the flags used to create a MockDriver
func (*MockDriver) GetIP ¶
func (d *MockDriver) GetIP() (string, error)
GetIP returns the IP address
func (*MockDriver) GetSSHHostname ¶
func (d *MockDriver) GetSSHHostname() (string, error)
GetSSHHostname returns the hostname for SSH
func (*MockDriver) GetSSHKeyPath ¶
func (d *MockDriver) GetSSHKeyPath() string
GetSSHKeyPath returns the key path for SSH
func (*MockDriver) GetSSHPort ¶
func (d *MockDriver) GetSSHPort() (int, error)
GetSSHPort returns the SSH port
func (*MockDriver) GetState ¶
func (d *MockDriver) GetState() (state.State, error)
GetState returns the state of the driver
func (*MockDriver) GetURL ¶
func (d *MockDriver) GetURL() (string, error)
GetURL returns the URL of the driver
func (*MockDriver) Logf ¶ added in v1.3.0
func (d *MockDriver) Logf(format string, args ...interface{})
Logf logs mock interactions
func (*MockDriver) SetConfigFromFlags ¶
func (d *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.
type MockProvisioner ¶ added in v0.4.0
type MockProvisioner struct {
Provisioned bool
}
MockProvisioner defines distribution specific actions
func (*MockProvisioner) AttemptIPContact ¶ added in v0.4.0
func (provisioner *MockProvisioner) AttemptIPContact(dockerPort int)
AttemptIPContact attempts to contact an IP and port
func (*MockProvisioner) CompatibleWithHost ¶ added in v0.4.0
func (provisioner *MockProvisioner) CompatibleWithHost() bool
CompatibleWithHost checks if provisioner is compatible with host
func (*MockProvisioner) GenerateDockerOptions ¶ added in v0.4.0
func (provisioner *MockProvisioner) GenerateDockerOptions(dockerPort int) (*provision.DockerOptions, error)
GenerateDockerOptions generates Docker options
func (*MockProvisioner) GetAuthOptions ¶ added in v0.4.0
func (provisioner *MockProvisioner) GetAuthOptions() auth.Options
GetAuthOptions returns a the auth.Options
func (*MockProvisioner) GetDockerOptionsDir ¶ added in v0.4.0
func (provisioner *MockProvisioner) GetDockerOptionsDir() string
GetDockerOptionsDir gets Docker options dir
func (*MockProvisioner) GetDriver ¶ added in v0.4.0
func (provisioner *MockProvisioner) GetDriver() drivers.Driver
GetDriver gets the driver
func (*MockProvisioner) GetOsReleaseInfo ¶ added in v0.4.0
func (provisioner *MockProvisioner) GetOsReleaseInfo() (*provision.OsRelease, error)
GetOsReleaseInfo gets the os-release info
func (*MockProvisioner) GetSwarmOptions ¶ added in v0.11.0
func (provisioner *MockProvisioner) GetSwarmOptions() swarm.Options
GetSwarmOptions gets the swarm.Options
func (*MockProvisioner) Hostname ¶ added in v0.4.0
func (provisioner *MockProvisioner) Hostname() (string, error)
Hostname returns the hostname
func (*MockProvisioner) Package ¶ added in v0.4.0
func (provisioner *MockProvisioner) Package(name string, action pkgaction.PackageAction) error
Package performs an action for a package
func (*MockProvisioner) Provision ¶ added in v0.4.0
func (provisioner *MockProvisioner) Provision(swarmOptions swarm.Options, authOptions auth.Options, engineOptions engine.Options) error
Provision provisions the machine
func (*MockProvisioner) SSHCommand ¶ added in v0.4.0
func (provisioner *MockProvisioner) SSHCommand(args string) (string, error)
SSHCommand runs a SSH command
func (*MockProvisioner) Service ¶ added in v0.4.0
func (provisioner *MockProvisioner) Service(name string, action serviceaction.ServiceAction) error
Service performs an action for a service
func (*MockProvisioner) SetHostname ¶ added in v0.4.0
func (provisioner *MockProvisioner) SetHostname(hostname string) error
SetHostname sets the hostname
func (*MockProvisioner) SetOsReleaseInfo ¶ added in v0.4.0
func (provisioner *MockProvisioner) SetOsReleaseInfo(info *provision.OsRelease)
SetOsReleaseInfo sets the os-release info
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 // contains filtered or unexported fields }
SSHServer provides a mock SSH Server for testing. Commands are stored, not executed.
func NewSSHServer ¶
NewSSHServer returns a NewSSHServer instance, ready for use.
func (*SSHServer) GetCommandToOutput ¶ added in v0.17.0
GetCommandToOutput gets command to output
func (*SSHServer) IsSessionRequested ¶ added in v0.17.0
IsSessionRequested gcode ets session requested
func (*SSHServer) SetCommandToOutput ¶ added in v0.17.0
SetCommandToOutput sets command to output
func (*SSHServer) SetSessionRequested ¶ added in v0.17.0
SetSessionRequested sets session requested