services

package
v0.0.0-...-19f3ddf Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: BSD-3-Clause Imports: 23 Imported by: 0

Documentation

Overview

Provides service implementations and management

Provides service implementations and management

Provides service implementations and management

Provides service implementations and management

Provides service implementations and management

Provides service implementations and management

Provides service implementations and management

Provides service implementations and management

Provides service implementations and management

Provides service implementations and management

Index

Constants

View Source
const (
	IMAGE_DATA_TEMPLATE   = "gs://chromeos-image-archive/%s-release/%s*/metadata/containers.jsonpb"
	CROS_TOOL_RUNNER_PATH = "chromiumos/infra/cros-tool-runner/${platform}"
)
View Source
const (
	// OWNER: Execute, Read, Write
	// GROUP: Execute, Read
	// OTHER: Execute, Read
	DIR_PERMISSION = 0755

	// OWNER: Read, Write
	// GROUP: Read
	// OTHER: Read
	FILE_PERMISSION = 0644

	LOGS_PATH = "output"
)
View Source
const (
	DUT_CONNECTION_PORT = 22
)
View Source
const (
	PROVISION_METADATA_PATH = "/tmp/provisionservice/in.json"
)

Variables

This section is empty.

Functions

func BuildConnection

func BuildConnection(service *ServiceBase) error

Creates a connection to the service

func BuildServiceListener

func BuildServiceListener(service *ServiceBase, skipDial bool, cmd *exec.Cmd) func()

Builds a listener function that connects to the service through a specified OS command. Once connected, logs all output of the service, and sends out a signal that the service is ready to be used. Finally, waits to receive signal to shutdown.

func CACHE_SERVER_SERVICE_COMMANDS

func CACHE_SERVER_SERVICE_COMMANDS() cacheServerServiceCommands

func CROS_DUT_SERVICE_COMMANDS

func CROS_DUT_SERVICE_COMMANDS() crosDutServiceCommands

func CROS_PROVISION_SERVICE_COMMANDS

func CROS_PROVISION_SERVICE_COMMANDS() crosProvisionServiceCommands

Enum of available commands for cros-provision

func CROS_TEST_FINDER_SERVICE_COMMANDS

func CROS_TEST_FINDER_SERVICE_COMMANDS() crosTestFinderServiceCommands

Enum of available commands for cros-test-finder

func CROS_TEST_SERVICE_COMMANDS

func CROS_TEST_SERVICE_COMMANDS() crosTestServiceCommands

Enum of available commands for cros-test

func CTR_SERVICE_COMMANDS

func CTR_SERVICE_COMMANDS() ctrServiceCommands

Enum of available commands for cros-tool-runner

func SERVICES

func SERVICES() services

Enum of defined runnable services

func SSH_TUNNEL_SERVICE_COMMANDS

func SSH_TUNNEL_SERVICE_COMMANDS() sshTunnelServiceCommands

func WriteLogs

func WriteLogs(service *ServiceBase)

Dumps the logs compiled over the service's lifetime into an output directory

Types

type CTRService

type CTRService struct {
	Service
	ServiceBase
	// contains filtered or unexported fields
}

Service implementation for cros-tool-runner

func (*CTRService) Execute

func (c *CTRService) Execute(commandName ServiceCommand_, args ...interface{}) error

func (*CTRService) Start

func (c *CTRService) Start() error

func (*CTRService) Stop

func (c *CTRService) Stop() error

type CacheServerService

type CacheServerService struct {
	Service
	ServiceBase
}

Service implementation for the cache server

func (*CacheServerService) Execute

func (c *CacheServerService) Execute(commandName ServiceCommand_, args ...interface{}) error

func (*CacheServerService) Start

func (c *CacheServerService) Start() error

func (*CacheServerService) Stop

func (c *CacheServerService) Stop() error

type CrosDutService

type CrosDutService struct {
	Service
	ServiceBase
	// contains filtered or unexported fields
}

Service implementation for cros-dut

func (*CrosDutService) Execute

func (c *CrosDutService) Execute(commandName ServiceCommand_, args ...interface{}) error

func (*CrosDutService) Start

func (c *CrosDutService) Start() error

func (*CrosDutService) Stop

func (c *CrosDutService) Stop() error

type CrosProvisionService

type CrosProvisionService struct {
	Service
	ServiceBase
	// contains filtered or unexported fields
}

Service implementation for cros-provision

func (*CrosProvisionService) Execute

func (c *CrosProvisionService) Execute(commandName ServiceCommand_, args ...interface{}) error

func (*CrosProvisionService) Start

func (c *CrosProvisionService) Start() error

func (*CrosProvisionService) Stop

func (c *CrosProvisionService) Stop() error

type CrosTestFinderService

type CrosTestFinderService struct {
	Service
	ServiceBase
	// contains filtered or unexported fields
}

Service implementation for cros-test-finder

func (*CrosTestFinderService) Execute

func (c *CrosTestFinderService) Execute(commandName ServiceCommand_, args ...interface{}) error

func (*CrosTestFinderService) Start

func (c *CrosTestFinderService) Start() error

func (*CrosTestFinderService) Stop

func (c *CrosTestFinderService) Stop() error

type CrosTestService

type CrosTestService struct {
	Service
	ServiceBase
	// contains filtered or unexported fields
}

Service implementation for cros-test

func (*CrosTestService) Execute

func (c *CrosTestService) Execute(commandName ServiceCommand_, args ...interface{}) error

func (*CrosTestService) Start

func (c *CrosTestService) Start() error

func (*CrosTestService) Stop

func (c *CrosTestService) Stop() error

type DefaultServiceExecutor

type DefaultServiceExecutor struct {
	ServiceExecutor
}

func (*DefaultServiceExecutor) Execute

func (*DefaultServiceExecutor) Start

func (c *DefaultServiceExecutor) Start(starter ServiceSetup) error

func (*DefaultServiceExecutor) Stop

func (c *DefaultServiceExecutor) Stop(stopper ServiceStopper) error

type FindTestsCommand

type FindTestsCommand struct {
	ServiceCommand
	// contains filtered or unexported fields
}

func (*FindTestsCommand) Execute

func (cmd *FindTestsCommand) Execute() error

type InstallCommand

type InstallCommand struct {
	ServiceCommand
	// contains filtered or unexported fields
}

func (*InstallCommand) Execute

func (cmd *InstallCommand) Execute() error

type LocalCFTManager

type LocalCFTManager struct {
	Board         string
	Model         string
	Build         string
	Tests         []string
	Tags          []string
	TagsExclude   []string
	DutHost       string
	BaseDir       string
	Chroot        string
	LocalServices map[string]struct{}
	// contains filtered or unexported fields
}

LocalCFTManager acts as the middle man between the CLI args and the concrete management of the services being run. Handles knowledge of which services are running, as well as how to start, stop, and pass commands to services.

func NewLocalCFTManager

func NewLocalCFTManager(
	ctx context.Context,
	board, model, build, dutHost, baseDir, chroot string,
	tests, tags, tagsExclude, localServices []string,
	ports map[string]uint16,
) *LocalCFTManager

Initializes a LocalCFTManager

func (*LocalCFTManager) Execute

func (c *LocalCFTManager) Execute(serviceName, commandName ServiceCommand_, args ...interface{}) error

Passes the command to the specified service

func (*LocalCFTManager) PrintResults

func (c *LocalCFTManager) PrintResults()

PrintResults list out the statuses of the services that ran during execution

func (*LocalCFTManager) Start

func (c *LocalCFTManager) Start(serviceName string, service Service) error

Calls the service to start then logs the service as running

func (*LocalCFTManager) Stop

func (c *LocalCFTManager) Stop() (err error)

Stops all services that are running in the reverse order of when they started

type LoginRegistryCommand

type LoginRegistryCommand struct {
	ServiceCommand
	// contains filtered or unexported fields
}

func (*LoginRegistryCommand) Execute

func (cmd *LoginRegistryCommand) Execute() error

type RunTestsCommand

type RunTestsCommand struct {
	ServiceCommand
	// contains filtered or unexported fields
}

func (*RunTestsCommand) Execute

func (cmd *RunTestsCommand) Execute() error

type SSHTunnelService

type SSHTunnelService struct {
	Service
	ServiceBase
}

Service implementation for SSH Tunnels

func (*SSHTunnelService) Execute

func (c *SSHTunnelService) Execute(commandName ServiceCommand_, args ...interface{}) error

func (*SSHTunnelService) Start

func (c *SSHTunnelService) Start() error

func (*SSHTunnelService) Stop

func (c *SSHTunnelService) Stop() error

type Service

type Service interface {
	// Sets up and runs the Service
	Start() error

	// Runs an implemented command on the Service
	Execute(ServiceCommand_, ...interface{}) error

	// Shutdowns the service and cleans up
	Stop() error
}

Service represents the required functions for Service structures

type ServiceBase

type ServiceBase struct {
	Name    string
	Port    uint16
	BaseDir string
	Started bool

	ReadyChan         chan error
	CloseChan         chan struct{}
	CloseFinishedChan chan struct{}

	LocalLogger   *log.Logger
	ServiceLogger *log.Logger
	// contains filtered or unexported fields
}

Base structure of Service implementations. Contains common variables used across implementations

func NewDefaultServiceBase

func NewDefaultServiceBase(
	manager *LocalCFTManager,
	name string,
) ServiceBase

Provides a ServiceBase constructed with the DefaultServiceExecutor

func NewServiceBase

func NewServiceBase(
	manager *LocalCFTManager,
	executor ServiceExecutor,
	name string,
) ServiceBase

Provides uniform construction of base services

func (*ServiceBase) EnsurePort

func (sb *ServiceBase) EnsurePort()

EnsurePort sets the Port member, if it is not already set. The port is first selected from the manager port list if possible, then any free port is assigned otherwise.

type ServiceCommand

type ServiceCommand interface {
	Execute() error
}

Represents the implementation of a command being called within a service

type ServiceCommand_

type ServiceCommand_ = string

Service Command type alias

type ServiceExecutor

type ServiceExecutor interface {
	Start(ServiceSetup) error
	Execute(ServiceCommand) error
	Stop(ServiceStopper) error
}

ServiceExecutor represents how the service should handle its execution requests

type ServiceResult

type ServiceResult struct {
	Undefined ServiceResult_
	Success   ServiceResult_
	Failed    ServiceResult_
}

func SERVICE_RESULT

func SERVICE_RESULT() ServiceResult

SERVICE_RESULT provides possibilities for service result

type ServiceResult_

type ServiceResult_ = string

type ServiceSetup

type ServiceSetup interface {
	Setup() error
}

Represents how to start up a service

type ServiceStopper

type ServiceStopper interface {
	Stop() error
}

Represents the implementation for how to stop a service

type SetupCTR

type SetupCTR struct {
	ServiceSetup
	// contains filtered or unexported fields
}

func (*SetupCTR) Setup

func (starter *SetupCTR) Setup() error

type SetupCacheServer

type SetupCacheServer struct {
	ServiceSetup
	// contains filtered or unexported fields
}

func (*SetupCacheServer) Setup

func (starter *SetupCacheServer) Setup() error

type SetupCrosDut

type SetupCrosDut struct {
	ServiceSetup
	// contains filtered or unexported fields
}

func (*SetupCrosDut) Setup

func (starter *SetupCrosDut) Setup() error

type SetupCrosProvision

type SetupCrosProvision struct {
	ServiceSetup
	// contains filtered or unexported fields
}

func (*SetupCrosProvision) Setup

func (starter *SetupCrosProvision) Setup() error

type SetupCrosTest

type SetupCrosTest struct {
	ServiceSetup
	// contains filtered or unexported fields
}

func (*SetupCrosTest) Setup

func (starter *SetupCrosTest) Setup() error

type SetupCrosTestFinder

type SetupCrosTestFinder struct {
	ServiceSetup
	// contains filtered or unexported fields
}

func (*SetupCrosTestFinder) Setup

func (starter *SetupCrosTestFinder) Setup() error

type SetupSSHTunnel

type SetupSSHTunnel struct {
	ServiceSetup
	// contains filtered or unexported fields
}

func (*SetupSSHTunnel) Setup

func (starter *SetupSSHTunnel) Setup() error

type StartContainerCommand

type StartContainerCommand struct {
	ServiceCommand
	// contains filtered or unexported fields
}

func (*StartContainerCommand) Execute

func (cmd *StartContainerCommand) Execute() error

type StopCTR

type StopCTR struct {
	ServiceStopper
	// contains filtered or unexported fields
}

func (*StopCTR) Stop

func (stopper *StopCTR) Stop() error

type StopCacheServer

type StopCacheServer struct {
	ServiceStopper
	// contains filtered or unexported fields
}

func (*StopCacheServer) Stop

func (stopper *StopCacheServer) Stop() error

type StopCrosDut

type StopCrosDut struct {
	ServiceStopper
	// contains filtered or unexported fields
}

func (*StopCrosDut) Stop

func (stopper *StopCrosDut) Stop() error

type StopCrosProvision

type StopCrosProvision struct {
	ServiceStopper
	// contains filtered or unexported fields
}

func (*StopCrosProvision) Stop

func (stopper *StopCrosProvision) Stop() error

type StopCrosTest

type StopCrosTest struct {
	ServiceStopper
	// contains filtered or unexported fields
}

func (*StopCrosTest) Stop

func (stopper *StopCrosTest) Stop() error

type StopCrosTestFinder

type StopCrosTestFinder struct {
	ServiceStopper
	// contains filtered or unexported fields
}

func (*StopCrosTestFinder) Stop

func (stopper *StopCrosTestFinder) Stop() error

type StopSSHTunnel

type StopSSHTunnel struct {
	ServiceStopper
	// contains filtered or unexported fields
}

func (*StopSSHTunnel) Stop

func (stopper *StopSSHTunnel) Stop() error

Jump to

Keyboard shortcuts

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