targettest

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package targettest provides a test target subtype for use by the target package. Note that it leverages the tcp.Target's database table to avoid needing schema migrations just for tests.

Index

Constants

View Source
const (
	Subtype = subtypes.Subtype("tcp")
)

Variables

This section is empty.

Functions

func Alloc

func Alloc() target.Target

Alloc creates an in-memory Target.

func New

func New(projectId string, opt ...target.Option) (target.Target, error)

New creates a targettest.Target.

func TestNewTestTarget

func TestNewTestTarget(ctx context.Context, t *testing.T, conn *db.DB, projectId, name string, opt ...target.Option) target.Target

TestNewTestTarget is a test helper for creating a targettest.Target.

func Vet

func Vet(ctx context.Context, t target.Target) error

Vet checks that the given Target is a targettest.Target and that it is not nil.

func VetCredentialSources added in v0.9.0

func VetCredentialSources(_ context.Context, _ []*target.CredentialLibrary, _ []*target.StaticCredential) error

VetCredentialSources allows for any CredentialLibraries.

func VetForUpdate added in v0.9.0

func VetForUpdate(ctx context.Context, t target.Target, paths []string) error

vet validates that the given Target is a targettest.Target and that it has a Target store.

Types

type Target

type Target struct {
	*store.Target
	Address string `gorm:"-"`

	HostSource        []target.HostSource       `gorm:"-"`
	CredentialSources []target.CredentialSource `gorm:"-"`
	// contains filtered or unexported fields
}

Target is a target.Target used for tests.

func (*Target) Clone

func (t *Target) Clone() target.Target

func (*Target) GetAddress added in v0.12.0

func (t *Target) GetAddress() string

func (*Target) GetCreateTime

func (t *Target) GetCreateTime() *timestamp.Timestamp

func (*Target) GetCredentialSources added in v0.13.0

func (t *Target) GetCredentialSources() []target.CredentialSource

func (*Target) GetDefaultClientPort added in v0.13.0

func (t *Target) GetDefaultClientPort() uint32

func (*Target) GetDefaultPort

func (t *Target) GetDefaultPort() uint32

func (*Target) GetDescription

func (t *Target) GetDescription() string

func (*Target) GetEgressWorkerFilter added in v0.12.0

func (t *Target) GetEgressWorkerFilter() string

func (*Target) GetEnableSessionRecording added in v0.13.0

func (t *Target) GetEnableSessionRecording() bool

func (*Target) GetHostSources added in v0.13.0

func (t *Target) GetHostSources() []target.HostSource

func (*Target) GetIngressWorkerFilter added in v0.12.0

func (t *Target) GetIngressWorkerFilter() string

func (*Target) GetName

func (t *Target) GetName() string

func (*Target) GetProjectId added in v0.10.2

func (t *Target) GetProjectId() string

func (*Target) GetPublicId

func (t *Target) GetPublicId() string

func (*Target) GetSessionConnectionLimit

func (t *Target) GetSessionConnectionLimit() int32

func (*Target) GetSessionMaxSeconds

func (t *Target) GetSessionMaxSeconds() uint32

func (*Target) GetStorageBucketId added in v0.13.0

func (t *Target) GetStorageBucketId() string

func (*Target) GetType

func (t *Target) GetType() subtypes.Subtype

func (*Target) GetUpdateTime

func (t *Target) GetUpdateTime() *timestamp.Timestamp

func (*Target) GetVersion

func (t *Target) GetVersion() uint32

func (*Target) GetWorkerFilter

func (t *Target) GetWorkerFilter() string

func (*Target) Oplog

func (t *Target) Oplog(op oplog.OpType) oplog.Metadata

func (*Target) SetAddress added in v0.12.0

func (t *Target) SetAddress(a string)

func (*Target) SetCreateTime

func (t *Target) SetCreateTime(ts *timestamp.Timestamp)

func (*Target) SetCredentialSources added in v0.13.0

func (t *Target) SetCredentialSources(sources []target.CredentialSource)

func (*Target) SetDefaultClientPort added in v0.13.0

func (t *Target) SetDefaultClientPort(port uint32)

func (*Target) SetDefaultPort

func (t *Target) SetDefaultPort(port uint32)

func (*Target) SetDescription

func (t *Target) SetDescription(description string)

func (*Target) SetEgressWorkerFilter added in v0.12.0

func (t *Target) SetEgressWorkerFilter(filter string)

func (*Target) SetEnableSessionRecording added in v0.13.0

func (t *Target) SetEnableSessionRecording(_ bool)

func (*Target) SetHostSources added in v0.13.0

func (t *Target) SetHostSources(sources []target.HostSource)

func (*Target) SetIngressWorkerFilter added in v0.12.0

func (t *Target) SetIngressWorkerFilter(filter string)

func (*Target) SetName

func (t *Target) SetName(name string)

func (*Target) SetProjectId added in v0.10.2

func (t *Target) SetProjectId(projectId string)

func (*Target) SetPublicId

func (t *Target) SetPublicId(_ context.Context, publicId string) error

func (*Target) SetSessionConnectionLimit

func (t *Target) SetSessionConnectionLimit(l int32)

func (*Target) SetSessionMaxSeconds

func (t *Target) SetSessionMaxSeconds(s uint32)

func (*Target) SetStorageBucketId added in v0.13.0

func (t *Target) SetStorageBucketId(_ string)

func (*Target) SetTableName

func (t *Target) SetTableName(n string)

SetTableName sets the tablename and satisfies the ReplayableMessage interface. If the caller attempts to set the name to "" the name will be reset to the default name.

func (*Target) SetUpdateTime

func (t *Target) SetUpdateTime(ts *timestamp.Timestamp)

func (*Target) SetVersion

func (t *Target) SetVersion(v uint32)

func (*Target) SetWorkerFilter

func (t *Target) SetWorkerFilter(filter string)

func (*Target) TableName

func (t *Target) TableName() string

TableName returns the tablename to override the default gorm table name

func (*Target) VetForWrite

func (t *Target) VetForWrite(ctx context.Context, _ db.Reader, opType db.OpType, _ ...db.Option) error

VetForWrite implements db.VetForWrite() interface and validates the tcp target before it's written.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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