23 lines
492 B
Go
23 lines
492 B
Go
package googlecompute
|
|
|
|
// DriverMock is a Driver implementation that is a mocked out so that
|
|
// it can be used for tests.
|
|
type DriverMock struct {
|
|
RunInstanceConfig *InstanceConfig
|
|
RunInstanceErrCh <-chan error
|
|
RunInstanceErr error
|
|
}
|
|
|
|
func (d *DriverMock) RunInstance(c *InstanceConfig) (<-chan error, error) {
|
|
d.RunInstanceConfig = c
|
|
|
|
resultCh := d.RunInstanceErrCh
|
|
if resultCh == nil {
|
|
ch := make(chan error)
|
|
close(ch)
|
|
resultCh = ch
|
|
}
|
|
|
|
return resultCh, d.RunInstanceErr
|
|
}
|