Documentation ¶
Overview ¶
Package conformance implements tests which verify conformance of the implementation with the spec.
Index ¶
- Constants
- type FailingController
- type IntResource
- type IntToStrController
- type IntegerResource
- type Resource
- func (r *Resource[T, S, SS]) DeepCopy() resource.Resource
- func (r *Resource[T, S, SS]) Metadata() *resource.Metadata
- func (r *Resource[T, S, SS]) SetValue(v T)
- func (r *Resource[T, S, SS]) Spec() interface{}
- func (r *Resource[T, S, SS]) UnmarshalProto(md *resource.Metadata, protoSpec []byte) error
- func (r *Resource[T, S, SS]) Value() T
- type RuntimeSuite
- func (suite *RuntimeSuite) SetupTest()
- func (suite *RuntimeSuite) TearDownTest()
- func (suite *RuntimeSuite) TestCascadingSumControllers()
- func (suite *RuntimeSuite) TestFailingController()
- func (suite *RuntimeSuite) TestIntToStrControllers()
- func (suite *RuntimeSuite) TestIntToStrToSentenceControllers()
- func (suite *RuntimeSuite) TestNoControllers()
- func (suite *RuntimeSuite) TestPanickingController()
- func (suite *RuntimeSuite) TestSumControllers()
- func (suite *RuntimeSuite) TestSumControllersFiltered()
- type SentenceResource
- type Spec
- type SpecPtr
- type StrResource
- type StrToSentenceController
- type StringResource
- type SumController
- type ValueGetSet
Constants ¶
const IntResourceType = resource.Type("test/int")
IntResourceType is the type of IntResource.
const SentenceResourceType = resource.Type("test/sentence")
SentenceResourceType is the type of SentenceResource.
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 ¶
func (ctrl *FailingController) Run(ctx context.Context, r controller.Runtime, logger *zap.Logger) error
Run implements controller.Controller interface.
type IntResource ¶
IntResource represents some integer value.
func NewIntResource ¶
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 ¶
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]) 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 ¶
UnmarshalProto implements protobuf.ResourceUnmarshaler.
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) 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) TestPanickingController ¶ added in v0.2.1
func (suite *RuntimeSuite) TestPanickingController()
TestPanickingController ...
func (*RuntimeSuite) TestSumControllers ¶
func (suite *RuntimeSuite) TestSumControllers()
TestSumControllers ...
func (*RuntimeSuite) TestSumControllersFiltered ¶
func (suite *RuntimeSuite) TestSumControllersFiltered()
TestSumControllersFiltered ...
type SentenceResource ¶
SentenceResource represents some string value.
func NewSentenceResource ¶
NewSentenceResource creates new SentenceResource.
type Spec ¶
type Spec[T any] interface { Value() T }
Spec requires spec to have a set of Get methods.
type StrResource ¶
StrResource represents some string value.
func NewStrResource ¶
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 ¶
func (ctrl *StrToSentenceController) Run(ctx context.Context, r controller.Runtime, logger *zap.Logger) error
Run implements controller.Controller interface.
type StringResource ¶
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