builders

package
v0.0.0-...-5e14263 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package builders helps you create struct for your unit test while keeping them expressive.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Autolock

func Autolock() func(*swarm.Swarm)

Autolock set the swarm into autolock mode

func Hostname

func Hostname(hostname string) func(*swarm.Node)

Hostname sets the node hostname

func Leader

func Leader() func(*swarm.ManagerStatus)

Leader sets the current node as a leader

func Manager

func Manager(managerStatusBuilders ...func(*swarm.ManagerStatus)) func(*swarm.Node)

Manager set the current node as a manager

func ManagerStatus

func ManagerStatus(managerStatusBuilders ...func(*swarm.ManagerStatus)) *swarm.ManagerStatus

ManagerStatus create a ManageStatus with default values.

func Node

func Node(builders ...func(*swarm.Node)) *swarm.Node

Node creates a node with default values. Any number of node function builder can be pass to augment it.

n1 := Node() // Returns a default node
n2 := Node(NodeID("foo"), NodeHostname("bar"), Leader())

func NodeID

func NodeID(id string) func(*swarm.Node)

NodeID sets the node id

func NodeLabels

func NodeLabels(labels map[string]string) func(*swarm.Node)

NodeLabels sets the node labels

func NodeName

func NodeName(name string) func(*swarm.Node)

NodeName sets the node name

func PortStatus

func PortStatus(portConfigs []swarm.PortConfig) func(*swarm.TaskStatus)

PortStatus sets the tasks port config status FIXME(vdemeester) should be a sub builder 👼

func Secret

func Secret(builders ...func(secret *swarm.Secret)) *swarm.Secret

Secret creates a secret with default values. Any number of secret builder functions can be passed to augment it.

func SecretCreatedAt

func SecretCreatedAt(t time.Time) func(*swarm.Secret)

SecretCreatedAt sets the creation time for the secret

func SecretID

func SecretID(ID string) func(secret *swarm.Secret)

SecretID sets the secret's ID

func SecretLabels

func SecretLabels(labels map[string]string) func(secret *swarm.Secret)

SecretLabels sets the secret's labels

func SecretName

func SecretName(name string) func(secret *swarm.Secret)

SecretName sets the secret's name

func SecretUpdatedAt

func SecretUpdatedAt(t time.Time) func(*swarm.Secret)

SecretUpdatedAt sets the update time for the secret

func SecretVersion

func SecretVersion(v swarm.Version) func(*swarm.Secret)

SecretVersion sets the version for the secret

func Service

func Service(builders ...func(*swarm.Service)) *swarm.Service

Service creates a service with default values. Any number of service builder functions can be passed to augment it. Currently, only ServiceName is implemented

func ServiceID

func ServiceID(id string) func(*swarm.Task)

ServiceID sets the task service's ID

func ServiceName

func ServiceName(name string) func(*swarm.Service)

ServiceName sets the service name

func StatusErr

func StatusErr(err string) func(*swarm.TaskStatus)

StatusErr sets the tasks status error

func Swarm

func Swarm(swarmBuilders ...func(*swarm.Swarm)) *swarm.Swarm

Swarm creates a swarm with default values. Any number of swarm function builder can be pass to augment it.

func Task

func Task(taskBuilders ...func(*swarm.Task)) *swarm.Task

Task creates a task with default values . Any number of task function builder can be pass to augment it.

func TaskID

func TaskID(id string) func(*swarm.Task)

TaskID sets the task ID

func TaskSpec

func TaskSpec(specBuilders ...func(*swarm.TaskSpec)) *swarm.TaskSpec

TaskSpec creates a task spec with default values . Any number of taskSpec function builder can be pass to augment it.

func TaskStatus

func TaskStatus(statusBuilders ...func(*swarm.TaskStatus)) *swarm.TaskStatus

TaskStatus creates a task status with default values . Any number of taskStatus function builder can be pass to augment it.

func Timestamp

func Timestamp(t time.Time) func(*swarm.TaskStatus)

Timestamp sets the task status timestamp

func Volume

func Volume(builders ...func(volume *types.Volume)) *types.Volume

Volume creates a volume with default values. Any number of volume function builder can be pass to augment it.

func VolumeDriver

func VolumeDriver(name string) func(volume *types.Volume)

VolumeDriver sets the volume driver

func VolumeLabels

func VolumeLabels(labels map[string]string) func(volume *types.Volume)

VolumeLabels sets the volume labels

func VolumeName

func VolumeName(name string) func(volume *types.Volume)

VolumeName sets the volume labels

func WithStatus

func WithStatus(statusBuilders ...func(*swarm.TaskStatus)) func(*swarm.Task)

WithStatus sets the task status

Types

This section is empty.

Jump to

Keyboard shortcuts

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