xtesting

package
v1.8.2-0...-f7776fc Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: GPL-2.0, GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package xtesting provides infrastructure for ZODB testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DrvTestEmptyDB

func DrvTestEmptyDB(t *testing.T, zdrv zodb.IStorageDriver)

DrvTestEmptyDB verifies that zdrv works correctly on empty database.

func DrvTestLoad

func DrvTestLoad(t *testing.T, zdrv zodb.IStorageDriver, txnvOk []Txn, bugv ...string)

DrvTestLoad verifies that zdrv implements Load correctly.

txnvOk is what data to expect to be in the database.

func DrvTestWatch

func DrvTestWatch(t *testing.T, zurl string, zdrvOpen zodb.DriverOpener)

DrvTestWatch verifies that storage driver watcher can observe commits done from outside.

func FatalIf

func FatalIf(t *testing.T) func(error)

FatalIf(t) returns function f(err), which call t.Fatal if err != nil.

func NeedPy

func NeedPy(t testing.TB, modules ...string)

NeedPy skips current test if python and specified modules are not available.

For example

xtesting.NeedPy(t)

would check for python presence, and

xtesting.NeedPy(t, "ZODB", "golang.strconv")

would check if all python and ZODB and golang.strconv python modules are available.

func ZPyCommitRaw

func ZPyCommitRaw(zurl string, at zodb.Tid, objv ...ZRawObject) (_ zodb.Tid, err error)

ZPyCommitRaw commits new transaction into database @ zurl with raw data specified by objv.

Nil data means "delete object". The commit is performed via zodbtools/py.

func ZPyRestore

func ZPyRestore(zurl string, zin string) (tidv []zodb.Tid, err error)

ZPyRestore restores transactions specified by zin in zodbdump format.

The restore is performed via zodbtools/py.

Types

type Txn

type Txn struct {
	Header *zodb.TxnInfo
	Data   []*zodb.DataInfo
}

Txn represents one transaction.

func LoadDBHistory

func LoadDBHistory(zurl string) (_ []Txn, err error)

LoadDBHistory loads whole content of a ZODB database.

it returns full history of all transactions with committed data.

type ZRawObject

type ZRawObject struct {
	Oid  zodb.Oid
	Data []byte // raw serialized zodb data
}

ZRawObject represents raw ZODB object state.

Jump to

Keyboard shortcuts

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