testutil

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithProxy

func WithProxy(config *TestProviderConfig)

Types

type Client

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

Client is a sugarcoat version of the docker client

func NewClient

func NewClient() (*Client, error)

NewClient creates a new docker Client

func (*Client) Clean

func (c *Client) Clean()

func (*Client) Create

func (c *Client) Create(ctx context.Context, node *proto.Node) (string, error)

Create creates a docker container

func (*Client) Exec

func (c *Client) Exec(ctx context.Context, id string, execCmd []string) error

func (*Client) GetIP

func (c *Client) GetIP(id string) string

func (*Client) PullImage

func (c *Client) PullImage(ctx context.Context, image string) error

PullImage pulls a docker image

func (*Client) Remove

func (c *Client) Remove(id string) error

type Provider

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

Provider is a mock provider for the swarm

func NewTestProvider

func NewTestProvider(t *testing.T, backend string, callback TestProviderCallback) (*Provider, func())

func (*Provider) Apply

func (p *Provider) Apply(t *TestTask) string

Apply applies a change. If the resource does not exists its a Create op if the resource exists its an Update op

func (*Provider) CreateResource

func (p *Provider) CreateResource(node *proto.Node) (*proto.Node, error)

func (*Provider) DeleteResource

func (p *Provider) DeleteResource(node *proto.Node) (*proto.Node, error)

func (*Provider) Exec

func (p *Provider) Exec(handler string, path string, args ...string) error

func (*Provider) FinalizeTask

func (p *Provider) FinalizeTask(uuid string) error

func (*Provider) GetTask

func (p *Provider) GetTask() (*proto.Task, error)

func (*Provider) GetTaskByID

func (p *Provider) GetTaskByID(id string) *proto.Task

func (*Provider) LoadCluster

func (p *Provider) LoadCluster(id string) (*proto.Cluster, error)

func (*Provider) Remove

func (p *Provider) Remove(node *proto.Node)

func (*Provider) Resource

func (p *Provider) Resource() schema.Schema

func (*Provider) Setup

func (p *Provider) Setup() error

func (*Provider) Start

func (p *Provider) Start() error

func (*Provider) Stop

func (p *Provider) Stop()

func (*Provider) UpdateNodeStatus

func (p *Provider) UpdateNodeStatus(node *proto.Node) (*proto.Node, error)

func (*Provider) WaitForTask

func (p *Provider) WaitForTask(id string)

WaitForTask waits for a task to finish

type TestProviderCallback

type TestProviderCallback func(config *TestProviderConfig)

type TestProviderConfig

type TestProviderConfig struct {
	Proxy bool
}

type TestTask

type TestTask struct {
	Name     string
	Resource string
	Input    string
	Delete   bool
}

Jump to

Keyboard shortcuts

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