lib

package
v0.0.0-...-18bc924 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2021 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KubernetesType    = "kubernetes"
	ComputeEngineType = "compute"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Caps

type Caps struct {
	Name                   string `json:"browserName"`
	Version                string `json:"version"`
	W3CVersion             string `json:"browserVersion"`
	ScreenResolution       string `json:"screenResolution"`
	TestName               string `json:"name"`
	TimeZone               string `json:"timeZone"`
	PlatformName           string `json:"platformName"`
	PlatformVersion        string `json:"platformVersion"`
	DeviceName             string `json:"deviceName"`
	App                    string `json:"app"`
	DisableAndroidWatchers string `json:"disableAndroidWatchers"`
	GridTimeout            int    `json:"gridTimeout"`
	NewCommandTimeout      string `json:"newCommandTimeout"`
}

Caps Browser capabilities

type ComputeClient

type ComputeClient struct {
	Clientset *http.Client
}

func GetComputeClient

func GetComputeClient() ComputeClient

func (ComputeClient) CreateGrid

func (c ComputeClient) CreateGrid(gridBase *GridBase) (name string, err error)

func (ComputeClient) DeleteGrid

func (c ComputeClient) DeleteGrid(name string) (err error)

func (ComputeClient) WaitUntilReady

func (c ComputeClient) WaitUntilReady(name string, timeout int32) (ip string, err error)

type ComputeEngine

type ComputeEngine struct {
	GridBase GridBase
	Caps     Caps
}

func (ComputeEngine) StartWithCancel

func (ce ComputeEngine) StartWithCancel() (grid *StartedGrid, err error)

type DefaultManager

type DefaultManager struct {
	GridConfig *GridConfig
}

DefaultManager Grid default manager

func (*DefaultManager) Find

func (m *DefaultManager) Find(caps Caps) (GridStarter, bool)

Find Find grid matching capabilities

type Engine

type Engine interface {
	CreateGrid(gridBase *GridBase) (string, error)
	DeleteGrid(name string) error
	WaitUntilReady(name string, timeout int32) (string, error)
}

func GetEngineClient

func GetEngineClient(engineType string) (engine Engine)

type Grid

type Grid struct {
	Image         string `yaml:"image"`
	Port          int32  `yaml:"port"`
	BaseURL       string `yaml:"baseURL"`
	HealthCheck   string `yaml:"healthCheck"`
	EntryPoint    string `yaml:"entryPoint"`
	VNCPort       int32  `yaml:"vncPort"`
	Engine        string `yaml:"engine"`
	MachineType   string `yaml:"machineType"`
	CPURequest    string `yaml:"cpuRequest"`
	MemoryRequest string `yaml:"memoryRequest"`
	CPULimit      string `yaml:"cpuLimit"`
	MemoryLimit   string `yaml:"memoryLimit"`
}

type GridBase

type GridBase struct {
	Grid    *Grid
	Timeout int
}

GridBase Grid base

type GridConfig

type GridConfig struct {
	LastReloadTime time.Time
	Grids          map[string]Versions
	// contains filtered or unexported fields
}

func GetGridConfig

func GetGridConfig() *GridConfig

func (*GridConfig) Find

func (gc *GridConfig) Find(name string, version string) (*Grid, string, bool)

func (*GridConfig) Load

func (gc *GridConfig) Load(grids string) error

type GridStarter

type GridStarter interface {
	StartWithCancel() (*StartedGrid, error)
}

GridStarter Grid starter

func GetGridStarter

func GetGridStarter(engineType string, gridBase GridBase, caps Caps) (grid GridStarter)

type Kubernetes

type Kubernetes struct {
	GridBase GridBase
	Caps     Caps
}

Kubernetes kubernetes

func (Kubernetes) StartWithCancel

func (k Kubernetes) StartWithCancel() (*StartedGrid, error)

StartWithCancel Start pod with cancel

type KubernetesClient

type KubernetesClient struct {
	Clientset *kubernetes.Clientset
}

KubernetesClient Kubernetes client

func GetKubernetesClient

func GetKubernetesClient() *KubernetesClient

GetKubernetesClient Get kubernetes client

func (KubernetesClient) CreateGrid

func (k KubernetesClient) CreateGrid(gridBase *GridBase) (podName string, err error)

CreateGrid Create browsers pod

func (KubernetesClient) DeleteGrid

func (k KubernetesClient) DeleteGrid(name string) (err error)

DeleteGrid Delete pod

func (KubernetesClient) WaitUntilReady

func (k KubernetesClient) WaitUntilReady(name string, timeout int32) (ip string, err error)

WaitUntilReady Wait until grid ready

type Manager

type Manager interface {
	Find(caps Caps, requestID uint64) (GridStarter, bool)
}

Manager Grid manager

type StartedGrid

type StartedGrid struct {
	Name   string
	URL    *url.URL
	Grid   GridBase
	Cancel func()
}

StartedGrid Started grid

type Versions

type Versions struct {
	Default  string           `yaml:"default"`
	Versions map[string]*Grid `yaml:"versions"`
}

Jump to

Keyboard shortcuts

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