juju: github.com/juju/juju/worker/uniter/runner/jujuc/jujuctesting Index | Files

package jujuctesting

import "github.com/juju/juju/worker/uniter/runner/jujuc/jujuctesting"

Index

Package Files

action.go component.go context.go instance.go leadership.go metrics.go networking.go relation.go relationhook.go relations.go settings.go status.go storage.go storageattachment.go suite.go unit.go version.go

type ActionHook Uses

type ActionHook struct {
    ActionParams map[string]interface{}
}

ActionHook holds the values for the hook context.

type Component Uses

type Component struct {
    Name string
}

Component holds the values for the hook context.

type Components Uses

type Components struct {
    Components map[string]jujuc.ContextComponent
}

Components holds the values for the hook context.

func (*Components) SetComponent Uses

func (c *Components) SetComponent(name string, comp jujuc.ContextComponent)

SetComponent sets the component on the registry.

func (*Components) SetNewComponent Uses

func (c *Components) SetNewComponent(name string, stub *testing.Stub) *Component

SetNewComponent sets the component on the registry.

type Context Uses

type Context struct {
    ContextUnit
    ContextStatus
    ContextInstance
    ContextNetworking
    ContextLeader
    ContextMetrics
    ContextStorage
    ContextComponents
    ContextRelations
    ContextRelationHook
    ContextActionHook
    ContextVersion
}

Context is a test double for jujuc.Context.

func NewContext Uses

func NewContext(stub *testing.Stub, info *ContextInfo) *Context

NewContext builds a jujuc.Context test double.

type ContextActionHook Uses

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

ContextActionHook is a test double for jujuc.ActionHookContext.

func (*ContextActionHook) ActionParams Uses

func (c *ContextActionHook) ActionParams() (map[string]interface{}, error)

ActionParams implements jujuc.ActionHookContext.

func (*ContextActionHook) LogActionMessage Uses

func (c *ContextActionHook) LogActionMessage(message string) error

LogActionMessage implements jujuc.ActionHookContext.

func (*ContextActionHook) SetActionFailed Uses

func (c *ContextActionHook) SetActionFailed() error

SetActionFailed implements jujuc.ActionHookContext.

func (*ContextActionHook) SetActionMessage Uses

func (c *ContextActionHook) SetActionMessage(message string) error

SetActionMessage implements jujuc.ActionHookContext.

func (*ContextActionHook) UpdateActionResults Uses

func (c *ContextActionHook) UpdateActionResults(keys []string, value string) error

UpdateActionResults implements jujuc.ActionHookContext.

type ContextComponent Uses

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

ContextComponent is a test double for jujuc.ContextComponent.

func NewContextComponent Uses

func NewContextComponent(stub *testing.Stub, info *Component) *ContextComponent

func (ContextComponent) Flush Uses

func (cc ContextComponent) Flush() error

Flush implements jujuc.ContextComponent.

func (ContextComponent) Get Uses

func (cc ContextComponent) Get(name string, result interface{}) error

Get implements jujuc.ContextComponent.

func (ContextComponent) Set Uses

func (cc ContextComponent) Set(name string, value interface{}) error

Set implements jujuc.ContextComponent.

type ContextComponents Uses

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

ContextComponents is a test double for jujuc.ContextComponents.

func (ContextComponents) Component Uses

func (cc ContextComponents) Component(name string) (jujuc.ContextComponent, error)

ContextComponents implements jujuc.ContextComponents.

type ContextInfo Uses

type ContextInfo struct {
    Unit
    Status
    Instance
    NetworkInterface
    Leadership
    Metrics
    Storage
    Components
    Relations
    RelationHook
    ActionHook
    Version
}

ContextInfo holds the values for the hook context.

func (*ContextInfo) Context Uses

func (info *ContextInfo) Context(stub *testing.Stub) *Context

Context returns a Context that wraps the info.

func (*ContextInfo) SetAsActionHook Uses

func (info *ContextInfo) SetAsActionHook()

SetAsActionHook updates the context to work as an action hook context.

func (*ContextInfo) SetAsRelationHook Uses

func (info *ContextInfo) SetAsRelationHook(id int, remote string)

SetAsRelationHook updates the context to work as a relation hook context.

func (*ContextInfo) SetRemoteApplicationName Uses

func (info *ContextInfo) SetRemoteApplicationName(remote string)

SetRemoteApplicationName defines the remote application

type ContextInstance Uses

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

ContextInstance is a test double for jujuc.ContextInstance.

func (*ContextInstance) AvailabilityZone Uses

func (c *ContextInstance) AvailabilityZone() (string, error)

AvailabilityZone implements jujuc.ContextInstance.

func (*ContextInstance) RequestReboot Uses

func (c *ContextInstance) RequestReboot(priority jujuc.RebootPriority) error

RequestReboot implements jujuc.ContextInstance.

type ContextLeader Uses

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

ContextLeader is a test double for jujuc.ContextLeader.

func (*ContextLeader) IsLeader Uses

func (c *ContextLeader) IsLeader() (bool, error)

IsLeader implements jujuc.ContextLeader.

func (*ContextLeader) LeaderSettings Uses

func (c *ContextLeader) LeaderSettings() (map[string]string, error)

LeaderSettings implements jujuc.ContextLeader.

func (*ContextLeader) WriteLeaderSettings Uses

func (c *ContextLeader) WriteLeaderSettings(settings map[string]string) error

WriteLeaderSettings implements jujuc.ContextLeader.

type ContextMetrics Uses

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

ContextMetrics is a test double for jujuc.ContextMetrics.

func (*ContextMetrics) AddMetric Uses

func (c *ContextMetrics) AddMetric(key, value string, created time.Time) error

AddMetric implements jujuc.ContextMetrics.

func (*ContextMetrics) AddMetricLabels Uses

func (c *ContextMetrics) AddMetricLabels(key, value string, created time.Time, labels map[string]string) error

AddMetricLabels implements jujuc.ContextMetrics.

type ContextNetworking Uses

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

ContextNetworking is a test double for jujuc.ContextNetworking.

func (*ContextNetworking) ClosePorts Uses

func (c *ContextNetworking) ClosePorts(protocol string, from, to int) error

ClosePorts implements jujuc.ContextNetworking.

func (*ContextNetworking) NetworkInfo Uses

func (c *ContextNetworking) NetworkInfo(bindingNames []string, relationId int) (map[string]params.NetworkInfoResult, error)

NetworkInfo implements jujuc.ContextNetworking.

func (*ContextNetworking) OpenPorts Uses

func (c *ContextNetworking) OpenPorts(protocol string, from, to int) error

OpenPorts implements jujuc.ContextNetworking.

func (*ContextNetworking) OpenedPorts Uses

func (c *ContextNetworking) OpenedPorts() []network.PortRange

OpenedPorts implements jujuc.ContextNetworking.

func (*ContextNetworking) PrivateAddress Uses

func (c *ContextNetworking) PrivateAddress() (string, error)

PrivateAddress implements jujuc.ContextNetworking.

func (*ContextNetworking) PublicAddress Uses

func (c *ContextNetworking) PublicAddress() (string, error)

PublicAddress implements jujuc.ContextNetworking.

type ContextRelation Uses

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

ContextRelation is a test double for jujuc.ContextRelation.

func (*ContextRelation) ApplicationSettings Uses

func (r *ContextRelation) ApplicationSettings() (jujuc.Settings, error)

ApplicationSettings implements jujuc.ContextRelation.

func (*ContextRelation) FakeId Uses

func (r *ContextRelation) FakeId() string

FakeId implements jujuc.ContextRelation.

func (*ContextRelation) Id Uses

func (r *ContextRelation) Id() int

Id implements jujuc.ContextRelation.

func (*ContextRelation) Name Uses

func (r *ContextRelation) Name() string

Name implements jujuc.ContextRelation.

func (*ContextRelation) ReadApplicationSettings Uses

func (r *ContextRelation) ReadApplicationSettings(name string) (params.Settings, error)

ReadApplicationSettings implements jujuc.ContextRelation.

func (*ContextRelation) ReadSettings Uses

func (r *ContextRelation) ReadSettings(name string) (params.Settings, error)

ReadSettings implements jujuc.ContextRelation.

func (*ContextRelation) SetStatus Uses

func (r *ContextRelation) SetStatus(status relation.Status) error

SetStatus implements jujuc.ContextRelation.

func (*ContextRelation) Settings Uses

func (r *ContextRelation) Settings() (jujuc.Settings, error)

Settings implements jujuc.ContextRelation.

func (*ContextRelation) Suspended Uses

func (r *ContextRelation) Suspended() bool

Suspended implements jujuc.ContextRelation.

func (*ContextRelation) UnitNames Uses

func (r *ContextRelation) UnitNames() []string

UnitNames implements jujuc.ContextRelation.

type ContextRelationHook Uses

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

ContextRelationHook is a test double for jujuc.RelationHookContext.

func (*ContextRelationHook) HookRelation Uses

func (c *ContextRelationHook) HookRelation() (jujuc.ContextRelation, error)

HookRelation implements jujuc.RelationHookContext.

func (*ContextRelationHook) RemoteApplicationName Uses

func (c *ContextRelationHook) RemoteApplicationName() (string, error)

RemoteApplicationName implements jujuc.RelationHookContext.

func (*ContextRelationHook) RemoteUnitName Uses

func (c *ContextRelationHook) RemoteUnitName() (string, error)

RemoteUnitName implements jujuc.RelationHookContext.

type ContextRelations Uses

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

ContextRelations is a test double for jujuc.ContextRelations.

func (*ContextRelations) Relation Uses

func (c *ContextRelations) Relation(id int) (jujuc.ContextRelation, error)

Relation implements jujuc.ContextRelations.

func (*ContextRelations) RelationIds Uses

func (c *ContextRelations) RelationIds() ([]int, error)

RelationIds implements jujuc.ContextRelations.

type ContextStatus Uses

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

ContextStatus is a test double for jujuc.ContextStatus.

func (*ContextStatus) ApplicationStatus Uses

func (c *ContextStatus) ApplicationStatus() (jujuc.ApplicationStatusInfo, error)

ApplicationStatus implements jujuc.ContextStatus.

func (*ContextStatus) SetApplicationStatus Uses

func (c *ContextStatus) SetApplicationStatus(status jujuc.StatusInfo) error

SetApplicationStatus implements jujuc.ContextStatus.

func (*ContextStatus) SetUnitStatus Uses

func (c *ContextStatus) SetUnitStatus(status jujuc.StatusInfo) error

SetUnitStatus implements jujuc.ContextStatus.

func (*ContextStatus) UnitStatus Uses

func (c *ContextStatus) UnitStatus() (*jujuc.StatusInfo, error)

UnitStatus implements jujuc.ContextStatus.

type ContextStorage Uses

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

ContextStorage is a test double for jujuc.ContextStorage.

func (*ContextStorage) AddUnitStorage Uses

func (c *ContextStorage) AddUnitStorage(all map[string]params.StorageConstraints) error

AddUnitStorage implements jujuc.ContextStorage.

func (*ContextStorage) HookStorage Uses

func (c *ContextStorage) HookStorage() (jujuc.ContextStorageAttachment, error)

HookStorage implements jujuc.ContextStorage.

func (*ContextStorage) Storage Uses

func (c *ContextStorage) Storage(tag names.StorageTag) (jujuc.ContextStorageAttachment, error)

Storage implements jujuc.ContextStorage.

func (*ContextStorage) StorageTags Uses

func (c *ContextStorage) StorageTags() ([]names.StorageTag, error)

StorageTags implements jujuc.ContextStorage.

type ContextStorageAttachment Uses

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

ContextStorageAttachment is a test double for jujuc.ContextStorageAttachment.

func (*ContextStorageAttachment) Kind Uses

func (c *ContextStorageAttachment) Kind() storage.StorageKind

Kind implements jujuc.StorageAttachement.

func (*ContextStorageAttachment) Location Uses

func (c *ContextStorageAttachment) Location() string

Location implements jujuc.StorageAttachement.

func (*ContextStorageAttachment) Tag Uses

func (c *ContextStorageAttachment) Tag() names.StorageTag

Tag implements jujuc.StorageAttachement.

type ContextSuite Uses

type ContextSuite struct {
    Stub *testing.Stub
    Unit string
}

ContextSuite is the base suite for testing jujuc.Context-related code.

func (*ContextSuite) NewHookContext Uses

func (s *ContextSuite) NewHookContext() (*Context, *ContextInfo)

NewHookContext builds a jujuc.Context test double.

func (*ContextSuite) NewInfo Uses

func (s *ContextSuite) NewInfo() *ContextInfo

NewInfo builds a ContextInfo with basic default data.

func (*ContextSuite) SetUpTest Uses

func (s *ContextSuite) SetUpTest(c *gc.C)

type ContextUnit Uses

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

ContextUnit is a test double for jujuc.ContextUnit.

func (*ContextUnit) CloudSpec Uses

func (c *ContextUnit) CloudSpec() (*params.CloudSpec, error)

func (*ContextUnit) ConfigSettings Uses

func (c *ContextUnit) ConfigSettings() (charm.Settings, error)

ConfigSettings implements jujuc.ContextUnit.

func (*ContextUnit) GetPodSpec Uses

func (c *ContextUnit) GetPodSpec() (string, error)

func (*ContextUnit) GoalState Uses

func (c *ContextUnit) GoalState() (*application.GoalState, error)

GoalState implements jujuc.ContextUnit.

func (*ContextUnit) SetPodSpec Uses

func (c *ContextUnit) SetPodSpec(specYaml string) error

func (*ContextUnit) UnitName Uses

func (c *ContextUnit) UnitName() string

UnitName implements jujuc.ContextUnit.

type ContextVersion Uses

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

ContextVersion is a test double for jujuc.ContextVersion.

func (*ContextVersion) SetUnitWorkloadVersion Uses

func (c *ContextVersion) SetUnitWorkloadVersion(version string) error

SetUnitWorkloadVersion implements jujuc.ContextVersion.

func (*ContextVersion) UnitWorkloadVersion Uses

func (c *ContextVersion) UnitWorkloadVersion() (string, error)

UnitWorkloadVersion implements jujuc.ContextVersion.

type Instance Uses

type Instance struct {
    AvailabilityZone string
    RebootPriority   *jujuc.RebootPriority
}

Instance holds the values for the hook context.

type Leadership Uses

type Leadership struct {
    IsLeader       bool
    LeaderSettings map[string]string
}

Leadership holds the values for the hook context.

type Metrics Uses

type Metrics struct {
    Metrics []jujuc.Metric
}

Metrics holds the values for the hook sub-context.

func (*Metrics) AddMetric Uses

func (m *Metrics) AddMetric(key, value string, created time.Time)

AddMetric adds a Metric for the provided data.

func (*Metrics) AddMetricLabels Uses

func (m *Metrics) AddMetricLabels(key, value string, created time.Time, labels map[string]string)

AddMetricLabels adds a Metric with labels for the provided data.

type NetworkInterface Uses

type NetworkInterface struct {
    PublicAddress      string
    PrivateAddress     string
    Ports              []network.PortRange
    NetworkInfoResults map[string]params.NetworkInfoResult
}

NetworkInterface holds the values for the hook context.

func (*NetworkInterface) AddPorts Uses

func (ni *NetworkInterface) AddPorts(protocol string, from, to int)

AddPorts adds the specified port range.

func (*NetworkInterface) CheckPorts Uses

func (ni *NetworkInterface) CheckPorts(c *gc.C, expected []network.PortRange)

CheckPorts checks the current ports.

func (*NetworkInterface) RemovePorts Uses

func (ni *NetworkInterface) RemovePorts(protocol string, from, to int)

RemovePorts removes the specified port range.

type Relation Uses

type Relation struct {
    // Id is data for jujuc.ContextRelation.
    Id  int
    // Name is data for jujuc.ContextRelation.
    Name string
    // Units is data for jujuc.ContextRelation.
    Units map[string]Settings
    // UnitName is data for jujuc.ContextRelation.
    UnitName string
    // ApplicationSettings is data for jujuc.ContextRelation
    ApplicationSettings Settings
}

Relation holds the data for the test double.

func (*Relation) Reset Uses

func (r *Relation) Reset()

Reset clears the Relation's settings.

func (*Relation) SetRelated Uses

func (r *Relation) SetRelated(name string, settings Settings)

SetRelated adds the relation settings for the unit.

func (*Relation) SetRelatedApplicationSettings Uses

func (r *Relation) SetRelatedApplicationSettings(settings Settings)

type RelationHook Uses

type RelationHook struct {
    HookRelation          jujuc.ContextRelation
    RemoteUnitName        string
    RemoteApplicationName string
}

RelationHook holds the values for the hook context.

func (*RelationHook) Reset Uses

func (rh *RelationHook) Reset()

Reset clears the RelationHook's data.

type Relations Uses

type Relations struct {
    Relations map[int]jujuc.ContextRelation
}

Relations holds the values for the hook context.

func (*Relations) Reset Uses

func (r *Relations) Reset()

Reset clears the Relations data.

func (*Relations) SetNewRelation Uses

func (r *Relations) SetNewRelation(id int, name string, stub *testing.Stub) *Relation

SetNewRelation adds the relation to the set of known relations.

func (*Relations) SetRelated Uses

func (r *Relations) SetRelated(id int, unit string, settings Settings)

SetRelated adds the provided unit information to the relation.

func (*Relations) SetRelation Uses

func (r *Relations) SetRelation(id int, relCtx jujuc.ContextRelation)

SetRelation adds the relation to the set of known relations.

type Settings Uses

type Settings params.Settings

Settings is a test double for jujuc.Settings.

func (Settings) Delete Uses

func (s Settings) Delete(k string)

Delete implements jujuc.Settings.

func (Settings) Get Uses

func (s Settings) Get(k string) (interface{}, bool)

Get implements jujuc.Settings.

func (Settings) Map Uses

func (s Settings) Map() params.Settings

Map implements jujuc.Settings.

func (Settings) Set Uses

func (s Settings) Set(k, v string)

Set implements jujuc.Settings.

type Status Uses

type Status struct {
    UnitStatus        jujuc.StatusInfo
    ApplicationStatus jujuc.ApplicationStatusInfo
}

Status holds the values for the hook context.

func (*Status) SetApplicationStatus Uses

func (s *Status) SetApplicationStatus(application jujuc.StatusInfo, units []jujuc.StatusInfo)

SetApplicationStatus builds a application status and sets it on the Status.

type Storage Uses

type Storage struct {
    Storage    map[names.StorageTag]jujuc.ContextStorageAttachment
    StorageTag names.StorageTag
    Added      map[string]params.StorageConstraints
}

Storage holds the values for the hook context.

func (*Storage) AddUnitStorage Uses

func (s *Storage) AddUnitStorage(all map[string]params.StorageConstraints)

AddUnitStorage sets storage that should be added.

func (*Storage) SetAttachment Uses

func (s *Storage) SetAttachment(attach jujuc.ContextStorageAttachment)

SetAttachment adds the attachment to the storage.

func (*Storage) SetBlockStorage Uses

func (s *Storage) SetBlockStorage(name, location string, stub *testing.Stub)

SetBlockStorage adds the attachment to the storage.

func (*Storage) SetNewAttachment Uses

func (s *Storage) SetNewAttachment(name, location string, kind storage.StorageKind, stub *testing.Stub)

SetNewAttachment adds the attachment to the storage.

func (*Storage) SetStorageTag Uses

func (s *Storage) SetStorageTag(id string)

SetStorageTag sets the storage tag to the given ID.

func (*Storage) SetUnitStorage Uses

func (s *Storage) SetUnitStorage(name string, constraints params.StorageConstraints)

SetUnitStorage sets storage that should be added.

type StorageAttachment Uses

type StorageAttachment struct {
    Tag      names.StorageTag
    Kind     storage.StorageKind
    Location string
}

StorageAttachment holds the data for the test double.

type Unit Uses

type Unit struct {
    Name           string
    ConfigSettings charm.Settings
    GoalState      application.GoalState
    PodSpec        string
    CloudSpec      params.CloudSpec
}

Unit holds the values for the hook context.

type Version Uses

type Version struct {
    WorkloadVersion string
}

Version holds values for the hook context.

Package jujuctesting imports 15 packages (graph). Updated 2019-12-11. Refresh now. Tools for package owners.