Documentation ¶
Overview ¶
Package test provides utilities for testing the //pkg/aspect code.
Index ¶
- func NewErrEval() expr.Evaluator
- func NewFakeEval(body EvalBody) expr.Evaluator
- func NewIDEval() expr.Evaluator
- type Bag
- func (t *Bag) Bool(name string) (bool, bool)
- func (t *Bag) Bytes(name string) ([]uint8, bool)
- func (t *Bag) DebugString() string
- func (t *Bag) Duration(name string) (time.Duration, bool)
- func (t *Bag) Float64(name string) (float64, bool)
- func (t *Bag) Int64(name string) (int64, bool)
- func (t *Bag) String(name string) (string, bool)
- func (t *Bag) StringMap(name string) (map[string]string, bool)
- func (t *Bag) Time(name string) (time.Time, bool)
- type DescriptorFinder
- func (d *DescriptorFinder) GetAttribute(name string) *cfgpb.AttributeManifest_AttributeInfo
- func (d *DescriptorFinder) GetLog(name string) *dpb.LogEntryDescriptor
- func (d *DescriptorFinder) GetMetric(name string) *dpb.MetricDescriptor
- func (d *DescriptorFinder) GetMonitoredResource(name string) *dpb.MonitoredResourceDescriptor
- func (d *DescriptorFinder) GetPrincipal(name string) *dpb.PrincipalDescriptor
- func (d *DescriptorFinder) GetQuota(name string) *dpb.QuotaDescriptor
- type Env
- type EvalBody
- type Logger
- func (t *Logger) Close() error
- func (t *Logger) DefaultConfig() adapter.Config
- func (t *Logger) Description() string
- func (t *Logger) Log(l []adapter.LogEntry) error
- func (t *Logger) LogAccess(l []adapter.LogEntry) error
- func (t *Logger) Name() string
- func (t *Logger) NewAccessLogsAspect(adapter.Env, adapter.Config) (adapter.AccessLogsAspect, error)
- func (t *Logger) NewApplicationLogsAspect(adapter.Env, adapter.Config) (adapter.ApplicationLogsAspect, error)
- func (t *Logger) ValidateConfig(c adapter.Config) (ce *adapter.ConfigErrors)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewErrEval ¶
NewErrEval constructs a new Evaluator that always returns an error.
func NewFakeEval ¶
NewFakeEval constructs a new Evaluator with the provided body.
Types ¶
type Bag ¶
Bag is a test version of attribute.Bag
func (*Bag) DebugString ¶
DebugString returns the empty string. TODO: use attribute.GetMutableBagForTest
type DescriptorFinder ¶
type DescriptorFinder struct {
// contains filtered or unexported fields
}
DescriptorFinder implements the descriptor.Finder interface more simply than the real object (namely in that it doesn't require synthesizing a config, and will panic when used incorrectly).
func NewDescriptorFinder ¶
func NewDescriptorFinder(desc map[string]interface{}) *DescriptorFinder
NewDescriptorFinder returns a DescriptorFinder that will return values from desc when queried.
func (*DescriptorFinder) GetAttribute ¶
func (d *DescriptorFinder) GetAttribute(name string) *cfgpb.AttributeManifest_AttributeInfo
GetAttribute returns the AttributeDescriptor named 'name' or nil if it does not exist in the map.
func (*DescriptorFinder) GetLog ¶
func (d *DescriptorFinder) GetLog(name string) *dpb.LogEntryDescriptor
GetLog returns the LogEntryDescriptor named 'name' or nil if it does not exist in the map.
func (*DescriptorFinder) GetMetric ¶
func (d *DescriptorFinder) GetMetric(name string) *dpb.MetricDescriptor
GetMetric returns the MetricDescriptor named 'name' or nil if it does not exist in the map.
func (*DescriptorFinder) GetMonitoredResource ¶
func (d *DescriptorFinder) GetMonitoredResource(name string) *dpb.MonitoredResourceDescriptor
GetMonitoredResource returns the MonitoredResourceDescriptor named 'name' or nil if it does not exist in the map.
func (*DescriptorFinder) GetPrincipal ¶
func (d *DescriptorFinder) GetPrincipal(name string) *dpb.PrincipalDescriptor
GetPrincipal returns the PrincipalDescriptor named 'name' or nil if it does not exist in the map.
func (*DescriptorFinder) GetQuota ¶
func (d *DescriptorFinder) GetQuota(name string) *dpb.QuotaDescriptor
GetQuota returns the QuotaDescriptor named 'name' or nil if it does not exist in the map.
type EvalBody ¶
EvalBody is a function that will be executed when expr.Evaluator.Eval and expr.Evaluator.EvalString are called.
type Logger ¶
type Logger struct { adapter.AccessLogsBuilder adapter.ApplicationLogsBuilder DefaultCfg config.AspectParams EntryCount int Logs []adapter.LogEntry AccessLogs []adapter.LogEntry ErrOnNewAspect bool ErrOnLog bool Closed bool }
Logger is a test struct that implements the application-logs and access-logs aspects.
func (*Logger) DefaultConfig ¶
DefaultConfig returns a default configuration struct for this adapter.
func (*Logger) Description ¶
Description returns a user-friendly description of this builder.
func (*Logger) NewAccessLogsAspect ¶
NewAccessLogsAspect returns a new instance of the accessLogger aspect.
func (*Logger) NewApplicationLogsAspect ¶
func (t *Logger) NewApplicationLogsAspect(adapter.Env, adapter.Config) (adapter.ApplicationLogsAspect, error)
NewApplicationLogsAspect returns a new instance of the Logger aspect.
func (*Logger) ValidateConfig ¶
func (t *Logger) ValidateConfig(c adapter.Config) (ce *adapter.ConfigErrors)
ValidateConfig determines whether the given configuration meets all correctness requirements.