Documentation ¶
Index ¶
- Variables
- func BuildAdapters(l *Logger, settings ...FakeAdapterSettings) map[string]*adapter.Info
- func BuildTemplates(l *Logger, settings ...FakeTemplateSettings) map[string]*template.Info
- func JoinConfigs(configs ...string) string
- type FakeAdapterSettings
- type FakeEnv
- type FakeHandler
- type FakeHandlerBuilder
- type FakeTemplateSettings
- type Logger
Constants ¶
This section is empty.
Variables ¶
var FqnACheck1 = "hcheck1.acheck.istio-system"
FqnACheck1 is the fully qualified name of HandlerH1.
var FqnAQuota1 = "hquota1.aquota.istio-system"
FqnAQuota1 is the fully qualified name of HandlerAReport1.
var FqnAReport1 = "hreport1.areport.istio-system"
FqnAReport1 is the fully qualified name of HandlerAReport1.
var FqnI1 = "icheck1.tcheck.istio-system"
FqnI1 is the fully qualified name for I1.
var HandlerACheck1 = `
apiVersion: "config.istio.io/v1alpha2"
kind: acheck
metadata:
name: hcheck1
namespace: istio-system
spec:
`
HandlerACheck1 is a handler of type acheck with name hcheck1.
var HandlerACheck2 = `
apiVersion: "config.istio.io/v1alpha2"
kind: acheck
metadata:
name: hcheck2
namespace: istio-system
spec:
`
HandlerACheck2 is a handler of type acheck with name hcheck2.
var HandlerACheck3NS2 = `
apiVersion: "config.istio.io/v1alpha2"
kind: acheck
metadata:
name: hcheck3
namespace: ns2
spec:
`
HandlerACheck3NS2 is a handler in namespace NS2.
var HandlerAPA1 = `
apiVersion: "config.istio.io/v1alpha2"
kind: apa
metadata:
name: hapa1
namespace: istio-system
spec:
`
HandlerAPA1 is an APA handler.
var HandlerAQuota1 = `
apiVersion: "config.istio.io/v1alpha2"
kind: aquota
metadata:
name: hquota1
namespace: istio-system
spec:
`
HandlerAQuota1 is a handler of type aquota with name hquota1.
var HandlerAReport1 = `
apiVersion: "config.istio.io/v1alpha2"
kind: areport
metadata:
name: hreport1
namespace: istio-system
spec:
`
HandlerAReport1 is a handler of type acheck with name hreport1.
var InstanceAPA1 = `
apiVersion: "config.istio.io/v1alpha2"
kind: tapa
metadata:
name: iapa1
namespace: istio-system
spec:
`
InstanceAPA1 is an APA instance
var InstanceAPA1WithSpec = `` /* 192-byte string literal not displayed */
InstanceAPA1WithSpec has a spec with expressions
var InstanceCheck1 = `
apiVersion: "config.istio.io/v1alpha2"
kind: tcheck
metadata:
name: icheck1
namespace: istio-system
spec:
`
InstanceCheck1 is a standard testing instance for template tcheck.
var InstanceCheck1WithSpec = `` /* 130-byte string literal not displayed */
InstanceCheck1WithSpec has a spec with expressions
var InstanceCheck2 = `
apiVersion: "config.istio.io/v1alpha2"
kind: tcheck
metadata:
name: icheck2
namespace: istio-system
spec:
`
InstanceCheck2 is another instance.
var InstanceCheck3 = `
apiVersion: "config.istio.io/v1alpha2"
kind: tcheck
metadata:
name: icheck3
namespace: istio-system
spec:
`
InstanceCheck3 is another instance.
var InstanceCheck4NS2 = `
apiVersion: "config.istio.io/v1alpha2"
kind: tcheck
metadata:
name: icheck4
namespace: ns2
spec:
`
InstanceCheck4NS2 is in the ns2 namespace
var InstanceHalt1 = `
apiVersion: "config.istio.io/v1alpha2"
kind: thalt
metadata:
name: ihalt1
namespace: istio-system
spec:
`
InstanceHalt1 is a standard testing instance.
var InstanceQuota1 = `
apiVersion: "config.istio.io/v1alpha2"
kind: tquota
metadata:
name: iquota1
namespace: istio-system
spec:
`
InstanceQuota1 is a standard testing instance for template tquota.
var InstanceQuota1WithSpec = `` /* 130-byte string literal not displayed */
InstanceQuota1WithSpec has a spec with expressions
var InstanceQuota2 = `
apiVersion: "config.istio.io/v1alpha2"
kind: tquota
metadata:
name: iquota2
namespace: istio-system
spec:
`
InstanceQuota2 is a copy of InstanceQuota1 with a different name.
var InstanceReport1 = `
apiVersion: "config.istio.io/v1alpha2"
kind: treport
metadata:
name: ireport1
namespace: istio-system
spec:
`
InstanceReport1 is a standard testing instance for template treport.
var InstanceReport1WithSpec = `` /* 132-byte string literal not displayed */
InstanceReport1WithSpec has a spec with expressions
var InstanceReport2 = `
apiVersion: "config.istio.io/v1alpha2"
kind: treport
metadata:
name: ireport2
namespace: istio-system
spec:
`
InstanceReport2 is a standard testing instance for template treport.
var Rule4CheckAndHalt = `` /* 236-byte string literal not displayed */
Rule4CheckAndHalt has two instances that goes to the same adapter, but have different templates.
var RuleApa1 = `` /* 186-byte string literal not displayed */
RuleApa1 is a rule that target APA.
var RuleCheck1 = `` /* 197-byte string literal not displayed */
RuleCheck1 is a standard testing instance config with name R1. It references I1 and H1.
var RuleCheck1TrueCondition = `` /* 216-byte string literal not displayed */
RuleCheck1TrueCondition is a standard testing instance config with name R1. It references I1 and H1.
var RuleCheck1WithBadCondition = `` /* 224-byte string literal not displayed */
RuleCheck1WithBadCondition has a parseable but not compilable condition
var RuleCheck1WithBadHandler = `` /* 207-byte string literal not displayed */
RuleCheck1WithBadHandler is a standard testing rule config with a bad handler name.
var RuleCheck1WithInstance1And2 = `` /* 231-byte string literal not displayed */
RuleCheck1WithInstance1And2 has instances icheck1 & icheck2.
var RuleCheck1WithInstance1And2WithMatchClause = `` /* 272-byte string literal not displayed */
RuleCheck1WithInstance1And2WithMatchClause is Rule Check1 with a conditional.
var RuleCheck1WithMatchClause = `` /* 238-byte string literal not displayed */
RuleCheck1WithMatchClause is Rule Check1 with a conditional.
var RuleCheck1WithNonBooleanCondition = `` /* 226-byte string literal not displayed */
RuleCheck1WithNonBooleanCondition has a non-boolean condition.
var RuleCheck2WithHandler2AndInstance2 = `` /* 197-byte string literal not displayed */
RuleCheck2WithHandler2AndInstance2 references hcheck2 and icheck2.
var RuleCheck2WithInstance1AndHandler = `` /* 197-byte string literal not displayed */
RuleCheck2WithInstance1AndHandler is Rule Check1 with a different name.
var RuleCheck2WithInstance2And3 = `` /* 231-byte string literal not displayed */
RuleCheck2WithInstance2And3 references instances icheck2 and icheck2.
var RuleCheck2WithInstance2And3WithMatchClause = `` /* 275-byte string literal not displayed */
RuleCheck2WithInstance2And3WithMatchClause is RuleCheck2WithInstance2And3 with a conditional.
var RuleCheck3NS2 = `` /* 179-byte string literal not displayed */
RuleCheck3NS2 is check rule in namespace NS2
var RuleQuota1 = `` /* 197-byte string literal not displayed */
RuleQuota1 is a standard testing instance config with name rquota1. It references I1 and H1.
var RuleQuota2 = `` /* 197-byte string literal not displayed */
RuleQuota2 references iquota1 and hquota1.
var RuleReport1 = `` /* 202-byte string literal not displayed */
RuleReport1 is a standard testing instance config with name rreport1. It references I1 and H1.
var RuleReport1And2 = `` /* 238-byte string literal not displayed */
RuleReport1And2 is a standard testing instance config with name rreport1.
var ServiceConfig = `` /* 464-byte string literal not displayed */
ServiceConfig is a standard service config.
Functions ¶
func BuildAdapters ¶
func BuildAdapters(l *Logger, settings ...FakeAdapterSettings) map[string]*adapter.Info
BuildAdapters builds a standard set of testing adapters. The supplied settings is used to override behavior.
func BuildTemplates ¶
func BuildTemplates(l *Logger, settings ...FakeTemplateSettings) map[string]*template.Info
BuildTemplates builds a standard set of testing templates. The supplied settings is used to override behavior.
func JoinConfigs ¶
JoinConfigs is a utility for joining various pieces of config for consumption by store code.
Types ¶
type FakeAdapterSettings ¶
type FakeAdapterSettings struct { Name string PanicAtSetAdapterConfig bool PanicData interface{} PanicAtValidate bool ErrorAtValidate bool ErrorAtBuild bool PanicAtBuild bool NilBuilder bool NilHandlerAtBuild bool ErrorAtHandlerClose bool PanicAtHandlerClose bool SpawnDaemon bool SpawnWorker bool CloseGoRoutines bool SupportedTemplates []string }
FakeAdapterSettings describes the behavior of a fake adapter.
type FakeEnv ¶
type FakeEnv struct { }
FakeEnv is a dummy implementation of adapter.Env
func (*FakeEnv) ScheduleDaemon ¶
func (f *FakeEnv) ScheduleDaemon(fn adapter.DaemonFunc)
ScheduleDaemon is an implementation of adapter.Env.ScheduleDaemon.
func (*FakeEnv) ScheduleWork ¶
ScheduleWork is an implementation of adapter.Env.ScheduleWork.
type FakeHandler ¶
type FakeHandler struct {
// contains filtered or unexported fields
}
FakeHandler is a fake implementation of adapter.Handler.
func (*FakeHandler) Close ¶
func (f *FakeHandler) Close() error
Close is an implementation of adapter.Handler.Close.
type FakeHandlerBuilder ¶
type FakeHandlerBuilder struct {
// contains filtered or unexported fields
}
FakeHandlerBuilder is a fake of HandlerBuilder.
func (*FakeHandlerBuilder) SetAdapterConfig ¶
func (f *FakeHandlerBuilder) SetAdapterConfig(cfg adapter.Config)
SetAdapterConfig is an implementation of HandlerBuilder.SetAdapterConfig.
func (*FakeHandlerBuilder) Validate ¶
func (f *FakeHandlerBuilder) Validate() *adapter.ConfigErrors
Validate is an implementation of HandlerBuilder.Validate.
type FakeTemplateSettings ¶
type FakeTemplateSettings struct { Name string ErrorAtCreateInstance bool ErrorAtCreateInstanceBuilder bool ErrorAtCreateOutputExpressions bool ErrorAtInferType bool BuilderDoesNotSupportTemplate bool HandlerDoesNotSupportTemplate bool PanicOnDispatchCheck bool ErrorOnDispatchCheck bool PanicOnDispatchReport bool ErrorOnDispatchReport bool PanicOnDispatchQuota bool ErrorOnDispatchQuota bool PanicOnDispatchGenAttrs bool ErrorOnDispatchGenAttrs bool PanicData interface{} QuotaResults []adapter.QuotaResult CheckResults []adapter.CheckResult OutputAttrs map[string]interface{} // template will signal the receipt of an incoming dispatch on this channel ReceivedCallChannel chan struct{} // template will wait on this channel before completing the dispatch CommenceSignalChannel chan struct{} }
FakeTemplateSettings describes the behavior of a fake template.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is used to capture the events that happen within fake adapters & templates during testing.
func (*Logger) Clear ¶
func (l *Logger) Clear()
Clear the contents of this logger. Useful for reducing the event output to Write more readable tests.
func (*Logger) WriteFormat ¶
WriteFormat writes a formatted string to the log, with a prefix of name. A newline character is added.