testutil

package
v4.4.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package testutil contains shared test functionality

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertEmptyString

func AssertEmptyString(t *testing.T, s string)

func AssertError

func AssertError(t *testing.T, err error)

func AssertErrorMessageContains added in v4.4.0

func AssertErrorMessageContains(t *testing.T, err error, msg string, args ...interface{})

func AssertFalse

func AssertFalse(t *testing.T, b bool)

func AssertIntEqual

func AssertIntEqual(t *testing.T, ai, ei int)

func AssertLen

func AssertLen(t *testing.T, x interface{}, el int)

func AssertNeo4jError

func AssertNeo4jError(t *testing.T, err error)

func AssertNextOnlyError

func AssertNextOnlyError(t *testing.T, rec *db.Record, sum *db.Summary, err error)

func AssertNextOnlyRecord

func AssertNextOnlyRecord(t *testing.T, rec *db.Record, sum *db.Summary, err error)

func AssertNextOnlySummary

func AssertNextOnlySummary(t *testing.T, rec *db.Record, sum *db.Summary, err error)

func AssertNil

func AssertNil(t *testing.T, x interface{})

func AssertNoError

func AssertNoError(t *testing.T, err error)

func AssertNotNil

func AssertNotNil(t *testing.T, x interface{})

func AssertSameType

func AssertSameType(t *testing.T, x, y interface{})

func AssertSliceEqual

func AssertSliceEqual(t *testing.T, x, y interface{})

func AssertStringContain

func AssertStringContain(t *testing.T, s, sub string)

func AssertStringEqual

func AssertStringEqual(t *testing.T, as, es string)

func AssertStringNotEmpty

func AssertStringNotEmpty(t *testing.T, s string)

func AssertTrue

func AssertTrue(t *testing.T, b bool)

func AssertWriteSucceeds added in v4.3.4

func AssertWriteSucceeds(t *testing.T, w io.Writer, b []byte)

Types

type ConnFake

type ConnFake struct {
	Name           string
	Version        string
	Alive          bool
	Birth          time.Time
	Table          *db.RoutingTable
	Err            error
	Id             int
	TxBeginErr     error
	TxBeginHandle  db.TxHandle
	RunErr         error
	RunStream      db.StreamHandle
	RunTxErr       error
	RunTxStream    db.StreamHandle
	Nexts          []Next
	Bookm          string
	TxCommitErr    error
	TxCommitHook   func()
	TxRollbackErr  error
	ResetHook      func()
	ConsumeSum     *db.Summary
	ConsumeErr     error
	ConsumeHook    func()
	RecordedTxs    []RecordedTx // Appended to by Run/TxBegin
	BufferErr      error
	BufferHook     func()
	ForceResetHook func() error
	DatabaseName   string
}

func (*ConnFake) Birthdate

func (c *ConnFake) Birthdate() time.Time

func (*ConnFake) Bookmark

func (c *ConnFake) Bookmark() string

func (*ConnFake) Buffer

func (c *ConnFake) Buffer(streamHandle db.StreamHandle) error

func (*ConnFake) Close

func (c *ConnFake) Close()

func (*ConnFake) ConnId added in v4.4.8

func (c *ConnFake) ConnId() string

func (*ConnFake) Consume

func (c *ConnFake) Consume(streamHandle db.StreamHandle) (*db.Summary, error)

func (*ConnFake) ForceReset added in v4.2.3

func (c *ConnFake) ForceReset() error

func (*ConnFake) GetRoutingTable

func (c *ConnFake) GetRoutingTable(context map[string]string, bookmarks []string, database, impersonatedUser string) (*db.RoutingTable, error)

func (*ConnFake) IsAlive

func (c *ConnFake) IsAlive() bool

func (*ConnFake) Keys

func (c *ConnFake) Keys(streamHandle db.StreamHandle) ([]string, error)

func (*ConnFake) Next

func (c *ConnFake) Next(streamHandle db.StreamHandle) (*db.Record, *db.Summary, error)

func (*ConnFake) Reset

func (c *ConnFake) Reset()

func (*ConnFake) Run

func (c *ConnFake) Run(runCommand db.Command, txConfig db.TxConfig) (db.StreamHandle, error)

func (*ConnFake) RunTx

func (c *ConnFake) RunTx(tx db.TxHandle, runCommand db.Command) (db.StreamHandle, error)

func (*ConnFake) SelectDatabase added in v4.4.0

func (c *ConnFake) SelectDatabase(database string)

func (*ConnFake) ServerName

func (c *ConnFake) ServerName() string

func (*ConnFake) ServerVersion

func (c *ConnFake) ServerVersion() string

func (*ConnFake) SetBoltLogger added in v4.3.0

func (c *ConnFake) SetBoltLogger(_ log.BoltLogger)

func (*ConnFake) TxBegin

func (c *ConnFake) TxBegin(txConfig db.TxConfig) (db.TxHandle, error)

func (*ConnFake) TxCommit

func (c *ConnFake) TxCommit(tx db.TxHandle) error

func (*ConnFake) TxRollback

func (c *ConnFake) TxRollback(tx db.TxHandle) error

type Next

type Next struct {
	Record  *db.Record
	Summary *db.Summary
	Err     error
}

type PoolFake

type PoolFake struct {
	BorrowConn  idb.Connection
	BorrowErr   error
	ReturnHook  func()
	CleanUpHook func()
}

func (*PoolFake) Borrow

func (p *PoolFake) Borrow(ctx context.Context, serverNames []string, wait bool, _ log.BoltLogger) (idb.Connection, error)

func (*PoolFake) CleanUp

func (p *PoolFake) CleanUp()

func (*PoolFake) Return

func (p *PoolFake) Return(c idb.Connection)

type RecordedTx

type RecordedTx struct {
	Origin    string
	Mode      db.AccessMode
	Bookmarks []string
	Timeout   time.Duration
	Meta      map[string]interface{}
}

type RouterFake

type RouterFake struct {
	Invalidated            bool
	InvalidatedDb          string
	ReadersRet             []string
	ReadersHook            func(bookmarks []string, database string) ([]string, error)
	WritersRet             []string
	WritersHook            func(bookmarks []string, database string) ([]string, error)
	Err                    error
	CleanUpHook            func()
	GetNameOfDefaultDbHook func(user string) (string, error)
}

func (*RouterFake) CleanUp

func (r *RouterFake) CleanUp()

func (*RouterFake) GetNameOfDefaultDatabase added in v4.4.0

func (r *RouterFake) GetNameOfDefaultDatabase(ctx context.Context, bookmarks []string, user string, boltLogger log.BoltLogger) (string, error)

func (*RouterFake) Invalidate

func (r *RouterFake) Invalidate(database string)

func (*RouterFake) Readers

func (r *RouterFake) Readers(ctx context.Context, bookmarks []string, database string, log log.BoltLogger) ([]string, error)

func (*RouterFake) Writers

func (r *RouterFake) Writers(ctx context.Context, bookmarks []string, database string, log log.BoltLogger) ([]string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL