istio: istio.io/istio/tests/integration_old/framework Index | Files

package framework

import "istio.io/istio/tests/integration_old/framework"

Index

Package Files

component.go configuration.go environment.go status.go testEnvManager.go testProcess.go

type Component Uses

type Component interface {
    // GetName returns component name
    GetName() string

    // GetConfig returns the config of this component for outside use
    // It can be called anytime during the whole component lifetime
    // It's recommended to use sync.Mutex to lock data while read
    // in case component itself is accessing config
    GetConfig() Config

    // SetConfig sets a config into this component
    // Initial config is set when during initialization
    // But config can be updated at runtime using SetConfig
    // Component needs to implement extra functions to apply new configs
    // It's recommended to use sync.Mutex to lock data while write
    // in case component itself is accessing config
    SetConfig(config Config) error

    // GetStatus returns the status of this component for outside use
    // It can be called anytime during the whole component lifetime
    // It's recommended to use sync.Mutex to lock data while read
    // in case component itself is updating status
    GetStatus() Status

    // Start sets up for this component
    // Start is being called in framework.StartUp()
    Start() error

    // Stop stops this component and clean it up
    // Stop is being called in framework.TearDown()
    Stop() error

    // IsAlive checks if component is alive/running
    IsAlive() (bool, error)
}

Component is a interface of a test component

type Config Uses

type Config interface {
}

Config is interface to extend the ability of the framework. It is a interface to accumulate config fields into one structure Any item (component, environment or even framework itself can has a Config) Actual implement can take this interface with its configuration.

type Status Uses

type Status interface {
}

Status is interface to extend the ability of the framework. It includes anything needed to be exposed outside to other components, environment or testcases. Any item (component, environment can has a Status) Actual implement can take this interface with its status field.

type TestEnv Uses

type TestEnv interface {

    // GetName returns environment ID
    GetName() string

    // GetComponents is the key of a environment
    // It defines what components a environment contains.
    // It should be a singleton-like function
    // Components will be stored in framework for start and stop
    GetComponents() []Component

    // Bringup does general setup for environment level, not components.
    // Bringup() is called by framework.SetUp()
    Bringup() error

    // Cleanup cleans everything created by this test environment, not component level
    // Cleanup() is being called in framework.TearDown()
    Cleanup() error
}

TestEnv is a interface holding serveral components for testing

type TestEnvManager Uses

type TestEnvManager struct {
    // contains filtered or unexported fields
}

TestEnvManager is core test framework struct

func NewTestEnvManager Uses

func NewTestEnvManager(env TestEnv, id string) *TestEnvManager

NewTestEnvManager creates a TestEnvManager with a given environment and ID

func (*TestEnvManager) GetEnv Uses

func (envManager *TestEnvManager) GetEnv() TestEnv

GetEnv returns the test environment currently using

func (*TestEnvManager) GetID Uses

func (envManager *TestEnvManager) GetID() string

GetID returns this test ID

func (*TestEnvManager) RunTest Uses

func (envManager *TestEnvManager) RunTest(m runnable) (ret int)

RunTest is the main entry for framework: setup, run tests and clean up

func (*TestEnvManager) StartUp Uses

func (envManager *TestEnvManager) StartUp() (err error)

StartUp sets up the whole environment as well brings up components

func (*TestEnvManager) TearDown Uses

func (envManager *TestEnvManager) TearDown()

TearDown stops components and clean up environment

func (*TestEnvManager) WaitUntilReady Uses

func (envManager *TestEnvManager) WaitUntilReady() (bool, error)

WaitUntilReady checks and waits until the whole environment is ready It retries several time before aborting and throwing error

type TestProcess Uses

type TestProcess struct {
    Process *os.Process
}

TestProcess is a wrap of os.Process With implemented methods to control local components

func (*TestProcess) IsRunning Uses

func (tp *TestProcess) IsRunning() (running bool, err error)

IsRunning checks if the process is still running

func (*TestProcess) Start Uses

func (tp *TestProcess) Start(command string) (err error)

Start starts a background process with given command

func (*TestProcess) Stop Uses

func (tp *TestProcess) Stop() (err error)

Stop kills the process

Package framework imports 7 packages (graph). Updated 2019-08-28. Refresh now. Tools for package owners.