conformance

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package conformance implements tests which verify conformance of the implementation with the spec.

Index

Constants

View Source
const IntResourceType = resource.Type("test/int")

IntResourceType is the type of IntResource.

View Source
const SentenceResourceType = resource.Type("test/sentence")

SentenceResourceType is the type of SentenceResource.

View Source
const StrResourceType = resource.Type("test/str")

StrResourceType is the type of StrResource.

Variables

This section is empty.

Functions

This section is empty.

Types

type FailingController

type FailingController struct {
	TargetNamespace resource.Namespace
	Panic           bool
	// contains filtered or unexported fields
}

FailingController fails on each iteration creating new resources each time.

func (*FailingController) Inputs

func (ctrl *FailingController) Inputs() []controller.Input

Inputs implements controller.Controller interface.

func (*FailingController) Name

func (ctrl *FailingController) Name() string

Name implements controller.Controller interface.

func (*FailingController) Outputs

func (ctrl *FailingController) Outputs() []controller.Output

Outputs implements controller.Controller interface.

func (*FailingController) Run

Run implements controller.Controller interface.

type IntDoublerController added in v0.3.1

type IntDoublerController struct {
	SourceNamespace resource.Namespace
	TargetNamespace resource.Namespace
}

IntDoublerController doubles IntResource.

func (*IntDoublerController) Inputs added in v0.3.1

func (ctrl *IntDoublerController) Inputs() []controller.Input

Inputs implements controller.Controller interface.

func (*IntDoublerController) Name added in v0.3.1

func (ctrl *IntDoublerController) Name() string

Name implements controller.Controller interface.

func (*IntDoublerController) Outputs added in v0.3.1

func (ctrl *IntDoublerController) Outputs() []controller.Output

Outputs implements controller.Controller interface.

func (*IntDoublerController) Run added in v0.3.1

Run implements controller.Controller interface.

type IntResource

type IntResource = Resource[int, intSpec, *intSpec]

IntResource represents some integer value.

func NewIntResource

func NewIntResource(ns resource.Namespace, id resource.ID, value int) *IntResource

NewIntResource creates new IntResource.

type IntToStrController

type IntToStrController struct {
	SourceNamespace resource.Namespace
	TargetNamespace resource.Namespace
}

IntToStrController converts IntResource to StrResource.

func (*IntToStrController) Inputs

func (ctrl *IntToStrController) Inputs() []controller.Input

Inputs implements controller.Controller interface.

func (*IntToStrController) Name

func (ctrl *IntToStrController) Name() string

Name implements controller.Controller interface.

func (*IntToStrController) Outputs

func (ctrl *IntToStrController) Outputs() []controller.Output

Outputs implements controller.Controller interface.

func (*IntToStrController) Run

Run implements controller.Controller interface.

type IntegerResource

type IntegerResource interface {
	Value() int
	SetValue(int)
}

IntegerResource is implemented by resources holding ints.

type MetricsController added in v0.3.15

type MetricsController struct {
	ControllerName  string
	SourceNamespace resource.Namespace
	TargetNamespace resource.Namespace
}

MetricsController is a controller which does operations to facilitate testing of controller runtime metrics.

func (*MetricsController) Inputs added in v0.3.15

func (ctrl *MetricsController) Inputs() []controller.Input

Inputs implements controller.Controller interface.

func (*MetricsController) Name added in v0.3.15

func (ctrl *MetricsController) Name() string

Name implements controller.Controller interface.

func (*MetricsController) Outputs added in v0.3.15

func (ctrl *MetricsController) Outputs() []controller.Output

Outputs implements controller.Controller interface.

func (*MetricsController) Run added in v0.3.15

Run implements controller.Controller interface.

type ModifyWithResultController added in v0.3.14

type ModifyWithResultController struct {
	SourceNamespace resource.Namespace
	TargetNamespace resource.Namespace
}

ModifyWithResultController doubles IntResource.

func (*ModifyWithResultController) Inputs added in v0.3.14

func (ctrl *ModifyWithResultController) Inputs() []controller.Input

Inputs implements controller.Controller interface.

func (*ModifyWithResultController) Name added in v0.3.14

func (ctrl *ModifyWithResultController) Name() string

Name implements controller.Controller interface.

func (*ModifyWithResultController) Outputs added in v0.3.14

func (ctrl *ModifyWithResultController) Outputs() []controller.Output

Outputs implements controller.Controller interface.

func (*ModifyWithResultController) Run added in v0.3.14

Run implements controller.Controller interface.

type QFailingController added in v0.4.0

type QFailingController struct {
	SourceNamespace resource.Namespace
	TargetNamespace resource.Namespace
}

QFailingController fails in different ways.

If not failing, it copies source to destination.

func (*QFailingController) MapInput added in v0.4.0

MapInput implements controller.QController interface.

func (*QFailingController) Name added in v0.4.0

func (ctrl *QFailingController) Name() string

Name implements controller.QController interface.

func (*QFailingController) Reconcile added in v0.4.0

Reconcile implements controller.QController interface.

func (*QFailingController) Settings added in v0.4.0

func (ctrl *QFailingController) Settings() controller.QSettings

Settings implements controller.QController interface.

type QIntToStrController added in v0.4.0

type QIntToStrController struct {
	SourceNamespace resource.Namespace
	TargetNamespace resource.Namespace
	ShutdownCalled  bool
}

QIntToStrController converts IntResource to StrResource as a QController.

func (*QIntToStrController) MapInput added in v0.4.0

MapInput implements controller.QController interface.

func (*QIntToStrController) Name added in v0.4.0

func (ctrl *QIntToStrController) Name() string

Name implements controller.QController interface.

func (*QIntToStrController) Reconcile added in v0.4.0

Reconcile implements controller.QController interface.

func (*QIntToStrController) Settings added in v0.4.0

func (ctrl *QIntToStrController) Settings() controller.QSettings

Settings implements controller.QController interface.

type QIntToStrSleepingController added in v0.4.0

type QIntToStrSleepingController struct {
	SourceNamespace resource.Namespace
	TargetNamespace resource.Namespace
}

QIntToStrSleepingController converts IntResource to StrResource as a QController sleeping source seconds.

func (*QIntToStrSleepingController) MapInput added in v0.4.0

MapInput implements controller.QController interface.

func (*QIntToStrSleepingController) Name added in v0.4.0

func (ctrl *QIntToStrSleepingController) Name() string

Name implements controller.QController interface.

func (*QIntToStrSleepingController) Reconcile added in v0.4.0

Reconcile implements controller.QController interface.

func (*QIntToStrSleepingController) Settings added in v0.4.0

Settings implements controller.QController interface.

type Resource

type Resource[T any, S Spec[T], SS SpecPtr[T, S]] struct {
	// contains filtered or unexported fields
}

Resource represents some T value.

func NewResource

func NewResource[T any, S Spec[T], SS SpecPtr[T, S]](md resource.Metadata, value T) *Resource[T, S, SS]

NewResource creates new Resource.

func (*Resource[T, S, SS]) DeepCopy

func (r *Resource[T, S, SS]) DeepCopy() resource.Resource

DeepCopy implements resource.Resource.

func (*Resource[T, S, SS]) Metadata

func (r *Resource[T, S, SS]) Metadata() *resource.Metadata

Metadata implements resource.Resource.

func (*Resource[T, S, SS]) SetValue

func (r *Resource[T, S, SS]) SetValue(v T)

SetValue set spec with provided value.

func (*Resource[T, S, SS]) Spec

func (r *Resource[T, S, SS]) Spec() any

Spec implements resource.Resource.

func (*Resource[T, S, SS]) UnmarshalProto

func (r *Resource[T, S, SS]) UnmarshalProto(md *resource.Metadata, protoSpec []byte) error

UnmarshalProto implements protobuf.ResourceUnmarshaler.

func (*Resource[T, S, SS]) Value

func (r *Resource[T, S, SS]) Value() T

Value returns a value inside the spec.

type RuntimeSuite

type RuntimeSuite struct {
	suite.Suite

	State state.State

	Runtime controller.Engine

	SetupRuntime    func()
	TearDownRuntime func()

	MetricsReadCacheEnabled bool
	// contains filtered or unexported fields
}

RuntimeSuite ...

func (*RuntimeSuite) SetupTest

func (suite *RuntimeSuite) SetupTest()

SetupTest ...

func (*RuntimeSuite) TearDownTest

func (suite *RuntimeSuite) TearDownTest()

TearDownTest ...

func (*RuntimeSuite) TestCascadingSumControllers

func (suite *RuntimeSuite) TestCascadingSumControllers()

TestCascadingSumControllers ...

func (*RuntimeSuite) TestControllerRuntimeMetrics added in v0.3.15

func (suite *RuntimeSuite) TestControllerRuntimeMetrics()

TestControllerRuntimeMetrics ...

func (*RuntimeSuite) TestFailingController

func (suite *RuntimeSuite) TestFailingController()

TestFailingController ...

func (*RuntimeSuite) TestIntDoublerController added in v0.3.1

func (suite *RuntimeSuite) TestIntDoublerController()

TestIntDoublerController ...

func (*RuntimeSuite) TestIntToStrControllers

func (suite *RuntimeSuite) TestIntToStrControllers()

TestIntToStrControllers ...

func (*RuntimeSuite) TestIntToStrToSentenceControllers

func (suite *RuntimeSuite) TestIntToStrToSentenceControllers()

TestIntToStrToSentenceControllers ...

func (*RuntimeSuite) TestModifyWithResultController added in v0.3.14

func (suite *RuntimeSuite) TestModifyWithResultController()

TestModifyWithResultController ...

func (*RuntimeSuite) TestNoControllers

func (suite *RuntimeSuite) TestNoControllers()

TestNoControllers ...

func (*RuntimeSuite) TestPanickingController added in v0.2.1

func (suite *RuntimeSuite) TestPanickingController()

TestPanickingController ...

func (*RuntimeSuite) TestQFailingController added in v0.4.0

func (suite *RuntimeSuite) TestQFailingController()

TestQFailingController ...

func (*RuntimeSuite) TestQIntToStrController added in v0.4.0

func (suite *RuntimeSuite) TestQIntToStrController()

TestQIntToStrController ...

func (*RuntimeSuite) TestQIntToStrSleepingController added in v0.4.0

func (suite *RuntimeSuite) TestQIntToStrSleepingController()

TestQIntToStrSleepingController ...

func (*RuntimeSuite) TestSumControllers

func (suite *RuntimeSuite) TestSumControllers()

TestSumControllers ...

func (*RuntimeSuite) TestSumControllersFiltered

func (suite *RuntimeSuite) TestSumControllersFiltered()

TestSumControllersFiltered ...

type SentenceResource

type SentenceResource = Resource[string, sentenceSpec, *sentenceSpec]

SentenceResource represents some string value.

func NewSentenceResource

func NewSentenceResource(ns resource.Namespace, id resource.ID, value string) *SentenceResource

NewSentenceResource creates new SentenceResource.

type Spec

type Spec[T any] interface {
	Value() T
}

Spec requires spec to have a set of Get methods.

type SpecPtr

type SpecPtr[T, S any] interface {
	*S
	Spec[T]
	FromProto([]byte)
	SetValue(T)
}

SpecPtr requires Spec to be a pointer and have a set of methods.

type StrResource

type StrResource = Resource[string, strSpec, *strSpec]

StrResource represents some string value.

func NewStrResource

func NewStrResource(ns resource.Namespace, id resource.ID, value string) *StrResource

NewStrResource creates new StrResource.

type StrToSentenceController

type StrToSentenceController struct {
	SourceNamespace resource.Namespace
	TargetNamespace resource.Namespace
}

StrToSentenceController converts StrResource to SentenceResource.

func (*StrToSentenceController) Inputs

func (ctrl *StrToSentenceController) Inputs() []controller.Input

Inputs implements controller.Controller interface.

func (*StrToSentenceController) Name

func (ctrl *StrToSentenceController) Name() string

Name implements controller.Controller interface.

func (*StrToSentenceController) Outputs

func (ctrl *StrToSentenceController) Outputs() []controller.Output

Outputs implements controller.Controller interface.

func (*StrToSentenceController) Run

Run implements controller.Controller interface.

type StringResource

type StringResource interface {
	Value() string
	SetValue(string)
}

StringResource is implemented by resources holding strings.

type SumController

type SumController struct {
	SourceNamespace  resource.Namespace
	TargetNamespace  resource.Namespace
	TargetID         resource.ID
	ControllerName   string
	SourceLabelQuery resource.LabelQuery
}

SumController calculates sum of IntResources into new IntResource.

func (*SumController) Inputs

func (ctrl *SumController) Inputs() []controller.Input

Inputs implements controller.Controller interface.

func (*SumController) Name

func (ctrl *SumController) Name() string

Name implements controller.Controller interface.

func (*SumController) Outputs

func (ctrl *SumController) Outputs() []controller.Output

Outputs implements controller.Controller interface.

func (*SumController) Run

Run implements controller.Controller interface.

type ValueGetSet

type ValueGetSet[T any] struct {
	// contains filtered or unexported fields
}

ValueGetSet is a basic building block for IntegerResource and StringResource implementations.

func (*ValueGetSet[T]) SetValue

func (s *ValueGetSet[T]) SetValue(t T)

func (ValueGetSet[T]) Value

func (s ValueGetSet[T]) Value() T

Jump to

Keyboard shortcuts

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