conformance

package
v0.3.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2023 License: MPL-2.0 Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
	// 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

func (ctrl *FailingController) Run(ctx context.Context, r controller.Runtime, logger *zap.Logger) error

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

func (ctrl *IntToStrController) Run(ctx context.Context, r controller.Runtime, logger *zap.Logger) error

Run implements controller.Controller interface.

type IntegerResource

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

IntegerResource is implemented by resources holding ints.

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() interface{}

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()
	// 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) TestFailingController

func (suite *RuntimeSuite) TestFailingController()

TestFailingController ...

func (*RuntimeSuite) TestIntToStrControllers

func (suite *RuntimeSuite) TestIntToStrControllers()

TestIntToStrControllers ...

func (*RuntimeSuite) TestIntToStrToSentenceControllers

func (suite *RuntimeSuite) TestIntToStrToSentenceControllers()

TestIntToStrToSentenceControllers ...

func (*RuntimeSuite) TestNoControllers

func (suite *RuntimeSuite) TestNoControllers()

TestNoControllers ...

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

func (ctrl *SumController) Run(ctx context.Context, r controller.Runtime, logger *zap.Logger) error

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