Documentation
¶
Overview ¶
Package testutil defines helpers for Syncbase tests.
Index ¶
- Variables
- func CheckExec(t testing.TB, ctx *context.T, db syncbase.DatabaseHandle, q string, ...)
- func CheckExecError(t testing.TB, ctx *context.T, db syncbase.DatabaseHandle, q string, ...)
- func CheckScan(t testing.TB, ctx *context.T, c syncbase.Collection, r syncbase.RowRange, ...)
- func CheckWatch(t testing.TB, wstream syncbase.WatchStream, changes []WatchChangeTest)
- func CreateCollection(t testing.TB, ctx *context.T, d syncbase.Database, name string) syncbase.Collection
- func CreateDatabase(t testing.TB, ctx *context.T, s syncbase.Service, name string) syncbase.Database
- func CxId(name string) wire.Id
- func DbId(name string) wire.Id
- func DefaultPerms(patterns ...string) access.Permissions
- func DefaultSchema(version int32) *syncbase.Schema
- func Fatal(t testing.TB, args ...interface{})
- func Fatalf(t testing.TB, format string, args ...interface{})
- func NewCtx(ctx *context.T, rootp security.Principal, suffix string) *context.T
- func ScanMatches(ctx *context.T, c syncbase.Collection, r syncbase.RowRange, wantKeys []string, ...) error
- func SetupOrDie(perms access.Permissions) (clientCtx *context.T, serverName string, cleanup func())
- func SetupOrDieCustom(clientSuffix, serverSuffix string, perms access.Permissions) (ctx, clientCtx *context.T, serverName string, rootp security.Principal, ...)
- func TestCreate(t *testing.T, ctx *context.T, i interface{})
- func TestCreateNameValidation(t *testing.T, ctx *context.T, i interface{}, okNames, notOkNames []string)
- func TestDestroy(t *testing.T, ctx *context.T, i interface{})
- func TestListChildIds(t *testing.T, ctx *context.T, i interface{}, blessings, names []string)
- func TestPerms(t *testing.T, ctx *context.T, ac util.AccessController)
- func WatchChangeEq(got *syncbase.WatchChange, want *WatchChangeTest) (eq bool)
- type WatchChangeTest
Constants ¶
This section is empty.
Variables ¶
var ( OkAppUserBlessings []string = validBlessingPatterns NotOkAppUserBlessings []string = concat(universallyInvalidNames, invalidBlessingPatterns, longNames) OkDbCxNames []string = validIdentifiers NotOkDbCxNames []string = concat(universallyInvalidNames, longNames, invalidIdentifiers) )
var ( OkRowKeys []string = concat(validIdentifiers, invalidIdentifiers, longNames) NotOkRowKeys []string = universallyInvalidNames )
Functions ¶
func CheckExecError ¶
func CheckWatch ¶
func CheckWatch(t testing.TB, wstream syncbase.WatchStream, changes []WatchChangeTest)
CheckWatch checks that the sequence of elements from the watch stream starts with the given slice of watch changes.
func CreateCollection ¶
func CreateDatabase ¶
func DbId ¶
TODO(sadovsky): Standardize on a small set of constants and helper functions to share across all Syncbase tests. Currently, our 'featuretests' tests use a different set of helpers from our other unit tests.
func DefaultPerms ¶
func DefaultPerms(patterns ...string) access.Permissions
func DefaultSchema ¶
func NewCtx ¶
Creates a new context object with blessing "root:<suffix>", configured to present this blessing when acting as a server as well as when acting as a client and talking to a server that presents a blessing rooted at "root". TODO(sadovsky): Switch unit tests to v23test.Shell, then delete this.
func ScanMatches ¶
func SetupOrDie ¶
func SetupOrDie(perms access.Permissions) (clientCtx *context.T, serverName string, cleanup func())
TODO(sadovsky): Drop the 'perms' argument. The only client that passes non-nil, syncgroup_test.go, should use SetupOrDieCustom instead.
func SetupOrDieCustom ¶
func SetupOrDieCustom(clientSuffix, serverSuffix string, perms access.Permissions) (ctx, clientCtx *context.T, serverName string, rootp security.Principal, cleanup func())
TODO(sadovsky): Switch unit tests to v23test.Shell, then delete this.
func TestCreate ¶
TestCreate tests that object creation works as expected.
func TestCreateNameValidation ¶
func TestCreateNameValidation(t *testing.T, ctx *context.T, i interface{}, okNames, notOkNames []string)
Tests that Create() checks name validity.
func TestDestroy ¶
TestDestroy tests that object destruction works as expected.
func TestListChildIds ¶
func TestPerms ¶
TestPerms tests that {Set,Get}Permissions work as expected. TODO(sadovsky): All Vanadium {Set,Get}Permissions tests ought to share this test implementation. :) Mirrors v.io/groups/x/ref/services/groups/internal/server/server_test.go.
func WatchChangeEq ¶
func WatchChangeEq(got *syncbase.WatchChange, want *WatchChangeTest) (eq bool)
WatchChangeEq returns whether *want and *got represent the same value.
Types ¶
type WatchChangeTest ¶
type WatchChangeTest struct { syncbase.WatchChange ValueBytes *vom.RawBytes }
A WatchChangeTest is a syncbase.WatchChange that has a public ValueBytes field, to allow tests to set it.