decider

package
v0.0.0-...-03d6fc4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2019 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TransformBotIDToDevice

func TransformBotIDToDevice(id string) string

TransformBotIDToDevice transforms the bot id to a bot id with device, e.g. skia-foo -> skia-foo-device

Types

type Decider

type Decider interface {
	// ShouldPowercycleBot returns true if the bot/host supports powercycling
	// and is in a state that would be fixed by powercycling.
	ShouldPowercycleBot(*swarming.SwarmingRpcsBotInfo) bool
	// ShouldPowercycleBot returns true if the device supports powercycling
	// and is in a state that would be fixed by powercycling.
	ShouldPowercycleDevice(*swarming.SwarmingRpcsBotInfo) bool
}

The Decider interface abstracts away the logic to decide if a bot/device 1) is powercycleable and 2) should be powercycled

func New

func New(powercycleConfigFiles []string) (Decider, map[string]string, error)

New creates a new Decider based off the powercycle configs. It will assume that only the bots listed in that config file are powercycleable. Additionally, it returns a map of deviceID -> jumphost it is on, which is derrived from which config file declares the given device.

type MockDecider

type MockDecider struct {
	mock.Mock
}

func NewMockDecider

func NewMockDecider() *MockDecider

NewMockDecider returns a pointer to a newly created struct. We return the pointer because we want to make sure the methods on mock.Mock stay accessible, e.g. m.On()

func (*MockDecider) ShouldPowercycleBot

func (m *MockDecider) ShouldPowercycleBot(bot *swarming.SwarmingRpcsBotInfo) bool

func (*MockDecider) ShouldPowercycleDevice

func (m *MockDecider) ShouldPowercycleDevice(bot *swarming.SwarmingRpcsBotInfo) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL