Documentation ¶
Index ¶
- Constants
- func DisableStackLog()
- func EnableStackLog()
- func TstStartup(t *testing.T, schema, config string) (*TstSrv, *Session)
- func TstStartupMultipleSchemas(t *testing.T, schemaDefs []TestSchema, config string) (*TstSrv, *Session)
- func TstStartupMultipleSchemasWithCustomAuth(t *testing.T, schemaDefs []TestSchema, config string, a auth.Auther, ...) (*TstSrv, *Session)
- func TstStartupSchemaDir(t *testing.T, schemaDir, config, capabilities string) (*TstSrv, *Session)
- func TstStartupWithCapabilities(t *testing.T, schema, config, caps string) (*TstSrv, *Session)
- func TstStartupWithCustomAuth(t *testing.T, schema, config string, a auth.Auther, ...) (*TstSrv, *Session)
- func ValidateChanged(t *testing.T, sess *Session, ctx *configd.Context, exp bool)
- func ValidateCommit(t *testing.T, sess *Session, ctx *configd.Context, expPass bool, ...)
- func ValidateCommitMultipleOutput(t *testing.T, sess *Session, ctx *configd.Context, expPass bool, expCfg string, ...)
- func ValidateCommitWithDebug(t *testing.T, sess *Session, ctx *configd.Context, expPass bool, expCfg string, ...)
- func ValidateDelete(t *testing.T, sess *Session, ctx *configd.Context, path []string, exp bool)
- func ValidateDeleteTable(t *testing.T, sess *Session, ctx *configd.Context, tbl []ValidateOpTbl)
- func ValidateExists(t *testing.T, sess *Session, ctx *configd.Context, path []string, exp bool)
- func ValidateOperationTable(t *testing.T, sess *Session, ctx *configd.Context, tbl []ValidateOpTbl, ...)
- func ValidateSessOpOutput(t *testing.T, sess *Session, ctx *configd.Context, exp bool, expOut string, ...)
- func ValidateSet(t *testing.T, sess *Session, ctx *configd.Context, path []string, exp bool)
- func ValidateSetPath(t *testing.T, sess *Session, ctx *configd.Context, path []string, exp bool)
- func ValidateSetPathTable(t *testing.T, sess *Session, ctx *configd.Context, tbl []ValidateOpTbl)
- func ValidateSetTable(t *testing.T, sess *Session, ctx *configd.Context, tbl []ValidateOpTbl)
- func ValidateShow(t *testing.T, sess *Session, ctx *configd.Context, path []string, ...)
- func ValidateShowContains(t *testing.T, sess *Session, ctx *configd.Context, path []string, ...)
- func ValidateShowWithDefaults(t *testing.T, sess *Session, ctx *configd.Context, path []string, ...)
- func ValidateStatus(t *testing.T, sess *Session, ctx *configd.Context, exp ValidateStatusTbl)
- func ValidateTestSchemaSnippet(t *testing.T, schema string) (schema.ModelSet, schema.ModelSet, error)
- type NameDef
- type Operation
- type SessOp
- type TestSchema
- type TestSpec
- func (ts *TestSpec) CheckCompLogEntries(name, filter string, entries ...schema.TestLogEntry)
- func (ts *TestSpec) ClearCompLogEntries()
- func (ts *TestSpec) GetCompMgr() schema.ComponentManager
- func (ts *TestSpec) Init() (*TstSrv, *Session)
- func (ts *TestSpec) SetAuther(auther auth.Auther, isConfigdUser bool, inSecretsGroup bool) *TestSpec
- func (ts *TestSpec) SetCapabilities(caps string) *TestSpec
- func (ts *TestSpec) SetComponents(msName string, comps []string) *TestSpec
- func (ts *TestSpec) SetConfig(config string) *TestSpec
- func (ts *TestSpec) SetCurrentState(model, stateJson string)
- func (ts *TestSpec) SetSchemaDefs(schemaDefs []TestSchema) *TestSpec
- func (ts *TestSpec) SetSchemaDefsByRef(schemaDefs []*TestSchema) *TestSpec
- func (ts *TestSpec) SetSchemaDir(schemaDir string) *TestSpec
- func (ts *TestSpec) SetSessionMgrLog(smgrLog *bytes.Buffer) *TestSpec
- func (ts *TestSpec) SetSingleSchema(singleSchema string) *TestSpec
- type TstSrv
- type ValidateOpTbl
- type ValidateStatusTbl
Constants ¶
const ( SetPass = false SetFail = true CommitPass = true CommitFail = false )
For some operations, 'false' indicates pass, whereas in others, 'true' does. Hide this mess with some enumerated values.
const ( NotConfigdUser = false ConfigdUser = true NotInSecretsGroup = false InSecretsGroup = true )
const ( CommitDebugOff = false CommitDebugOn = true NoCfgCheck = false CfgCheck = true )
Variables ¶
This section is empty.
Functions ¶
func DisableStackLog ¶
func DisableStackLog()
func EnableStackLog ¶
func EnableStackLog()
func TstStartup ¶
Test startup with default authentication settings
func TstStartupMultipleSchemas ¶
func TstStartupMultipleSchemas( t *testing.T, schemaDefs []TestSchema, config string, ) (*TstSrv, *Session)
func TstStartupSchemaDir ¶
func TstStartupWithCapabilities ¶
Test startup with default authentication settings
func ValidateChanged ¶
func ValidateCommit ¶
func ValidateCommitWithDebug ¶
func ValidateDelete ¶
exp is whether we expect an error or not (i.e., true means expect error)
func ValidateDeleteTable ¶
func ValidateDeleteTable(t *testing.T, sess *Session, ctx *configd.Context, tbl []ValidateOpTbl)
func ValidateExists ¶
func ValidateOperationTable ¶
func ValidateSessOpOutput ¶
func ValidateSessOpOutput(t *testing.T, sess *Session, ctx *configd.Context, exp bool, expOut string, op SessOp)
Do a session operation and validate the output received againt the expected output
func ValidateSet ¶
func ValidateSetPath ¶
exp is whether we expect an error or not (i.e., true means expect error)
func ValidateSetPathTable ¶
func ValidateSetPathTable(t *testing.T, sess *Session, ctx *configd.Context, tbl []ValidateOpTbl)
func ValidateSetTable ¶
func ValidateSetTable(t *testing.T, sess *Session, ctx *configd.Context, tbl []ValidateOpTbl)
func ValidateShow ¶
func ValidateShowContains ¶
func ValidateStatus ¶
func ValidateStatus(t *testing.T, sess *Session, ctx *configd.Context, exp ValidateStatusTbl)
Types ¶
type TestSchema ¶
type TestSchema struct { Name NameDef Imports []NameDef Includes []string BelongsTo NameDef Prefix string SchemaSnippet string }
Used for creating tests with multiple modules without resorting to reading them in from file as this means you can't read the schema and the test together easily.
func NewTestSchema ¶
func NewTestSchema(namespace, prefix string) *TestSchema
func (*TestSchema) AddBelongsTo ¶
func (ts *TestSchema) AddBelongsTo(namespace, prefix string) *TestSchema
func (*TestSchema) AddImport ¶
func (ts *TestSchema) AddImport(namespace, prefix string) *TestSchema
func (*TestSchema) AddInclude ¶
func (ts *TestSchema) AddInclude(module string) *TestSchema
func (*TestSchema) AddSchemaSnippet ¶
func (ts *TestSchema) AddSchemaSnippet(snippet string) *TestSchema
type TestSpec ¶
type TestSpec struct {
// contains filtered or unexported fields
}
func NewTestSpec ¶
func (*TestSpec) CheckCompLogEntries ¶
func (ts *TestSpec) CheckCompLogEntries( name, filter string, entries ...schema.TestLogEntry, )
Checks exact match for number and order of entries, after filtering for given specific type of log entry (eg SetRunning)
func (*TestSpec) ClearCompLogEntries ¶
func (ts *TestSpec) ClearCompLogEntries()
func (*TestSpec) GetCompMgr ¶
func (ts *TestSpec) GetCompMgr() schema.ComponentManager
func (*TestSpec) SetCapabilities ¶
func (*TestSpec) SetComponents ¶
func (*TestSpec) SetCurrentState ¶
func (*TestSpec) SetSchemaDefs ¶
func (ts *TestSpec) SetSchemaDefs(schemaDefs []TestSchema) *TestSpec
func (*TestSpec) SetSchemaDefsByRef ¶
func (ts *TestSpec) SetSchemaDefsByRef(schemaDefs []*TestSchema) *TestSpec
When we have created schemaDefs using NewTestSchema, it is easier to pass by reference.
func (*TestSpec) SetSchemaDir ¶
func (*TestSpec) SetSessionMgrLog ¶
func (*TestSpec) SetSingleSchema ¶
type TstSrv ¶
type TstSrv struct { Ms schema.ModelSet MsFull schema.ModelSet Smgr *SessionMgr Cmgr *CommitMgr Auth auth.Auther Dlog *log.Logger Elog *log.Logger Wlog *log.Logger Ctx *configd.Context // contains filtered or unexported fields }
loosely modelled on Srv from configd/server/server.go
type ValidateOpTbl ¶
type ValidateOpTbl struct { Description string Path []string Value string Result bool // result of commit if requested, otherwise, set/delete }
func NewValOpTblEntry ¶
func NewValOpTblEntry( desc string, path []string, value string, result bool) ValidateOpTbl
type ValidateStatusTbl ¶
type ValidateStatusTbl struct { Path []string Status rpc.NodeStatus Err bool }
func NewValStatusTblEntry ¶
func NewValStatusTblEntry( path []string, status rpc.NodeStatus, err bool) ValidateStatusTbl