Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseTask ¶
type BaseTask struct {
Type string `json:"type"`
}
BaseTask is a struct that is intended to be embedded by specific task structs. Both of these in conjunction are used primarily to house the JSON message for passing tasks over the comms package (i.e. message queue), but may also contain important dependencies of the task, such as an HTTP handler.
type DeleteTestDataTask ¶
type DeleteTestDataTask struct {
BaseTask
Config config.Config `json:"-"`
TestUuid string `json:"key"`
}
DeleteTestDataTask embeds BaseTask and adds the necessary fields to transport a DeleteTestData task through comms
func (DeleteTestDataTask) Run ¶
func (dtdt DeleteTestDataTask) Run() error
Run contains the logic necessary to perform this task on the agent.
type DownloadAssetTask ¶
type DownloadAssetTask struct {
BaseTask
HTTPClient *http.Client `json:"-"`
Fs FileSystem `json:"-"`
Ios IoSystem `json:"-"`
CollectorDir string `json:"-"`
Assets []string `json:"assets"`
TestletDir string `json:"-"`
}
DownloadAssetTask defines this particular task. It contains definitions not only for the task message, but also HTTPClient, filesystem, and i/o system abstractions to be more conducive to unit testing.
func (DownloadAssetTask) Run ¶
func (dat DownloadAssetTask) Run() error
Run contains the logic necessary to perform this task on the agent. This particular task will download all required assets, copy them into the appropriate directory, and ensure that the execute permission is given to each collector file.
type ExecuteTestRunTask ¶
type ExecuteTestRunTask struct {
BaseTask
Config config.Config `json:"-"`
TestUuid string `json:"testuuid"`
TimeLimit int `json:"timelimit"`
}
ExecuteTestRunTask defines this particular task.
func (ExecuteTestRunTask) Run ¶
func (ett ExecuteTestRunTask) Run() error
Run contains the logic necessary to perform this task on the agent. This particular task will execute a testrun that has already been installed into the local agent cache. In this context (single agent), a testrun will be executed once per target, all in parallel.
type FileSystem ¶
type FileSystem interface {
Open(name string) (file, error)
Stat(name string) (os.FileInfo, error)
Create(name string) (file, error)
Chmod(name string, mode os.FileMode) error
}
FileSystem is an interface to abstract the "os" calls, to properly mock out functions that work with the filesystem.
type InstallTestRunTask ¶
type InstallTestRunTask struct {
BaseTask
Config config.Config `json:"-"`
Tr defs.TestRun `json:"testrun"`
}
InstallTestRunTask defines this particular task.
func (InstallTestRunTask) Run ¶
func (itt InstallTestRunTask) Run() error
Run contains the logic necessary to perform this task on the agent. This particular task will install, but not execute a testrun on this agent. The installation procedure will first run the referenced testlet in check mode to help ensure that the actual testrun execution can take place. If that succeeds, the testrun is installed in the agent cache.
type IoSystem ¶
IoSystem is an interface to abstract the "ios" calls, to properly mock out functions that work with the filesystem.
type KeyValueTask ¶
type KeyValueTask struct {
BaseTask
Config config.Config `json:"-"`
Key string `json:"key"`
Value string `json:"value"`
}
KeyValueTask defines this particular task.
func (KeyValueTask) Run ¶
func (kvt KeyValueTask) Run() error
Run contains the logic necessary to perform this task on the agent. This particular task will simply pass a key/value pair to the agent cache to be set
type SetGroupTask ¶
type SetGroupTask struct {
BaseTask
Config config.Config `json:"-"`
GroupName string `json:"groupName"`
}
SetGroupTask defines this particular task.
func (SetGroupTask) Run ¶
func (sgt SetGroupTask) Run() error
Run contains the logic necessary to perform this task on the agent.
type Task ¶
type Task interface {
// TODO(mierdin): This works but is a little "meh". Basically, each task has to have a "Run()" function, as enforced
// by this interface. If the task needs some additional data, it gets these through struct properties. This works but
// doesn't quite feel right. Come back to this and see if there's a better way.
Run() error
}
Task is an interface to define task behavior This is used for functions like those in comms that need to work with all specific task types, not one specific task.