cadvisor: github.com/google/cadvisor/integration/framework Index | Files

package framework

import "github.com/google/cadvisor/integration/framework"

Index

Package Files

framework.go

Constants

const (
    Aufs         string = "aufs"
    Overlay      string = "overlay"
    Overlay2     string = "overlay2"
    DeviceMapper string = "devicemapper"
    Unknown      string = ""
)

func RetryForDuration Uses

func RetryForDuration(retryFunc func() error, dur time.Duration) error

Runs retryFunc until no error is returned. After dur time the last error is returned. Note that the function does not timeout the execution of retryFunc when the limit is reached.

type CadvisorActions Uses

type CadvisorActions interface {
    // Returns a cAdvisor client to the machine being tested.
    Client() *client.Client
    ClientV2() *v2.Client
}

type DockerActions Uses

type DockerActions interface {
    // Run the no-op pause Docker container and return its ID.
    RunPause() string

    // Run the specified command in a Docker busybox container and return its ID.
    RunBusybox(cmd ...string) string

    // Runs a Docker container in the background. Uses the specified DockerRunArgs and command.
    // Returns the ID of the new container.
    //
    // e.g.:
    // Run(DockerRunArgs{Image: "busybox"}, "ping", "www.google.com")
    //   -> docker run busybox ping www.google.com
    Run(args DockerRunArgs, cmd ...string) string
    RunStress(args DockerRunArgs, cmd ...string) string

    Version() []string
    StorageDriver() string
}

type DockerRunArgs Uses

type DockerRunArgs struct {
    // Image to use.
    Image string

    // Arguments to the Docker CLI.
    Args []string

    InnerArgs []string
}

type Framework Uses

type Framework interface {
    // Clean the framework state.
    Cleanup()

    // The testing.T used by the framework and the current test.
    T() *testing.T

    // Returns the hostname being tested.
    Hostname() HostnameInfo

    // Returns the Docker actions for the test framework.
    Docker() DockerActions

    // Returns the shell actions for the test framework.
    Shell() ShellActions

    // Returns the cAdvisor actions for the test framework.
    Cadvisor() CadvisorActions
}

Integration test framework.

func New Uses

func New(t *testing.T) Framework

Instantiates a Framework. Cleanup *must* be called. Class is thread-compatible. All framework actions report fatal errors on the t specified at creation time.

Typical use:

func TestFoo(t *testing.T) {

	fm := framework.New(t)
	defer fm.Cleanup()
     ... actual test ...

}

type HostnameInfo Uses

type HostnameInfo struct {
    Host string
    Port int
}

func (HostnameInfo) FullHostname Uses

func (h HostnameInfo) FullHostname() string

Returns: http://<host>:<port>/

type ShellActions Uses

type ShellActions interface {
    // Runs a specified command and arguments. Returns the stdout and stderr.
    Run(cmd string, args ...string) (string, string)
    RunStress(cmd string, args ...string) (string, string)
}

Package framework imports 10 packages (graph). Updated 2020-04-26. Refresh now. Tools for package owners.