metabasetest

package
v1.34.2 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultEncryption = storj.EncryptionParameters{
	CipherSuite: storj.EncAESGCM,
	BlockSize:   29 * 256,
}

DefaultEncryption contains default encryption parameters.

View Source
var DefaultRedundancy = storj.RedundancyScheme{
	Algorithm:      storj.ReedSolomon,
	ShareSize:      2048,
	RequiredShares: 1,
	RepairShares:   1,
	OptimalShares:  1,
	TotalShares:    1,
}

DefaultRedundancy contains default redundancy scheme.

Functions

func Bench

func Bench(b *testing.B, fn func(ctx *testcontext.Context, b *testing.B, db *metabase.DB))

Bench runs benchmark for all configured databases.

func CreateExpiredObject

func CreateExpiredObject(ctx *testcontext.Context, t *testing.T, db *metabase.DB, obj metabase.ObjectStream, numberOfSegments byte, expiresAt time.Time) metabase.Object

CreateExpiredObject creates a new committed expired object with the specified number of segments.

func CreateFullObjectsWithKeys

func CreateFullObjectsWithKeys(ctx *testcontext.Context, t *testing.T, db *metabase.DB, projectID uuid.UUID, bucketName string, keys []metabase.ObjectKey) map[metabase.ObjectKey]metabase.LoopObjectEntry

CreateFullObjectsWithKeys creates multiple objects with the specified keys.

func CreateObject

func CreateObject(ctx *testcontext.Context, t *testing.T, db *metabase.DB, obj metabase.ObjectStream, numberOfSegments byte) metabase.Object

CreateObject creates a new committed object with the specified number of segments.

func CreatePendingObject

func CreatePendingObject(ctx *testcontext.Context, t *testing.T, db *metabase.DB, obj metabase.ObjectStream, numberOfSegments byte)

CreatePendingObject creates a new pending object with the specified number of segments.

func DefaultRawSegment added in v1.30.1

func DefaultRawSegment(obj metabase.ObjectStream, segmentPosition metabase.SegmentPosition) metabase.RawSegment

DefaultRawSegment returns default raw segment.

func RandObjectStream

func RandObjectStream() metabase.ObjectStream

RandObjectStream returns a random object stream.

func Run

func Run(t *testing.T, fn func(ctx *testcontext.Context, t *testing.T, db *metabase.DB))

Run runs tests against all configured databases.

Types

type BeginObjectExactVersion

type BeginObjectExactVersion struct {
	Opts     metabase.BeginObjectExactVersion
	Version  metabase.Version
	ErrClass *errs.Class
	ErrText  string
}

BeginObjectExactVersion is for testing metabase.BeginObjectExactVersion.

func (BeginObjectExactVersion) Check

func (step BeginObjectExactVersion) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

type BeginObjectNextVersion

type BeginObjectNextVersion struct {
	Opts     metabase.BeginObjectNextVersion
	Version  metabase.Version
	ErrClass *errs.Class
	ErrText  string
}

BeginObjectNextVersion is for testing metabase.BeginObjectNextVersion.

func (BeginObjectNextVersion) Check

func (step BeginObjectNextVersion) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

type BeginSegment

type BeginSegment struct {
	Opts     metabase.BeginSegment
	ErrClass *errs.Class
	ErrText  string
}

BeginSegment is for testing metabase.BeginSegment.

func (BeginSegment) Check

func (step BeginSegment) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

type BucketEmpty

type BucketEmpty struct {
	Opts     metabase.BucketEmpty
	Result   bool
	ErrClass *errs.Class
	ErrText  string
}

BucketEmpty is for testing metabase.BucketEmpty.

func (BucketEmpty) Check

func (step BucketEmpty) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

type CommitInlineSegment

type CommitInlineSegment struct {
	Opts     metabase.CommitInlineSegment
	ErrClass *errs.Class
	ErrText  string
}

CommitInlineSegment is for testing metabase.CommitInlineSegment.

func (CommitInlineSegment) Check

func (step CommitInlineSegment) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

type CommitObject

type CommitObject struct {
	Opts     metabase.CommitObject
	ErrClass *errs.Class
	ErrText  string
}

CommitObject is for testing metabase.CommitObject.

func (CommitObject) Check

func (step CommitObject) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB) metabase.Object

Check runs the test.

type CommitObjectWithSegments

type CommitObjectWithSegments struct {
	Opts     metabase.CommitObjectWithSegments
	Deleted  []metabase.DeletedSegmentInfo
	ErrClass *errs.Class
	ErrText  string
}

CommitObjectWithSegments is for testing metabase.CommitObjectWithSegments.

func (CommitObjectWithSegments) Check

Check runs the test.

type CommitSegment

type CommitSegment struct {
	Opts     metabase.CommitSegment
	ErrClass *errs.Class
	ErrText  string
}

CommitSegment is for testing metabase.CommitSegment.

func (CommitSegment) Check

func (step CommitSegment) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

type CreateTestObject

type CreateTestObject struct {
	BeginObjectExactVersion *metabase.BeginObjectExactVersion
	CommitObject            *metabase.CommitObject
}

CreateTestObject is for testing metabase.CreateTestObject.

func (CreateTestObject) Run

func (co CreateTestObject) Run(ctx *testcontext.Context, t testing.TB, db *metabase.DB, obj metabase.ObjectStream, numberOfSegments byte) metabase.Object

Run runs the test.

type DeleteAll

type DeleteAll struct{}

DeleteAll deletes all data from metabase.

func (DeleteAll) Check

func (step DeleteAll) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

type DeleteBucketObjects

type DeleteBucketObjects struct {
	Opts     metabase.DeleteBucketObjects
	Deleted  int64
	ErrClass *errs.Class
	ErrText  string
}

DeleteBucketObjects is for testing metabase.DeleteBucketObjects.

func (DeleteBucketObjects) Check

func (step DeleteBucketObjects) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

type DeleteExpiredObjects

type DeleteExpiredObjects struct {
	Opts metabase.DeleteExpiredObjects

	ErrClass *errs.Class
	ErrText  string
}

DeleteExpiredObjects is for testing metabase.DeleteExpiredObjects.

func (DeleteExpiredObjects) Check

func (step DeleteExpiredObjects) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

type DeleteObjectAnyStatusAllVersions

type DeleteObjectAnyStatusAllVersions struct {
	Opts     metabase.DeleteObjectAnyStatusAllVersions
	Result   metabase.DeleteObjectResult
	ErrClass *errs.Class
	ErrText  string
}

DeleteObjectAnyStatusAllVersions is for testing metabase.DeleteObjectAnyStatusAllVersions.

func (DeleteObjectAnyStatusAllVersions) Check

Check runs the test.

type DeleteObjectExactVersion

type DeleteObjectExactVersion struct {
	Opts     metabase.DeleteObjectExactVersion
	Result   metabase.DeleteObjectResult
	ErrClass *errs.Class
	ErrText  string
}

DeleteObjectExactVersion is for testing metabase.DeleteObjectExactVersion.

func (DeleteObjectExactVersion) Check

Check runs the test.

type DeleteObjectLatestVersion

type DeleteObjectLatestVersion struct {
	Opts     metabase.DeleteObjectLatestVersion
	Result   metabase.DeleteObjectResult
	ErrClass *errs.Class
	ErrText  string
}

DeleteObjectLatestVersion is for testing metabase.DeleteObjectLatestVersion.

func (DeleteObjectLatestVersion) Check

Check runs the test.

type DeleteObjectsAllVersions

type DeleteObjectsAllVersions struct {
	Opts     metabase.DeleteObjectsAllVersions
	Result   metabase.DeleteObjectResult
	ErrClass *errs.Class
	ErrText  string
}

DeleteObjectsAllVersions is for testing metabase.DeleteObjectsAllVersions.

func (DeleteObjectsAllVersions) Check

Check runs the test.

type DeletePart added in v1.30.1

type DeletePart struct {
	Opts     metabase.DeletePart
	Result   []metabase.DeletedSegmentInfo
	ErrClass *errs.Class
	ErrText  string
}

DeletePart is for testing metabase.DeletePart.

func (DeletePart) Check added in v1.30.1

func (step DeletePart) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

type DeletePendingObject

type DeletePendingObject struct {
	Opts     metabase.DeletePendingObject
	Result   metabase.DeleteObjectResult
	ErrClass *errs.Class
	ErrText  string
}

DeletePendingObject is for testing metabase.DeletePendingObject.

func (DeletePendingObject) Check

func (step DeletePendingObject) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

type DeleteZombieObjects added in v1.30.1

type DeleteZombieObjects struct {
	Opts metabase.DeleteZombieObjects

	ErrClass *errs.Class
	ErrText  string
}

DeleteZombieObjects is for testing metabase.DeleteZombieObjects.

func (DeleteZombieObjects) Check added in v1.30.1

func (step DeleteZombieObjects) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

type EnsureNodeAliases

type EnsureNodeAliases struct {
	Opts metabase.EnsureNodeAliases

	ErrClass *errs.Class
	ErrText  string
}

EnsureNodeAliases is for testing metabase.EnsureNodeAliases.

func (EnsureNodeAliases) Check

func (step EnsureNodeAliases) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

type GetLatestObjectLastSegment

type GetLatestObjectLastSegment struct {
	Opts     metabase.GetLatestObjectLastSegment
	Result   metabase.Segment
	ErrClass *errs.Class
	ErrText  string
}

GetLatestObjectLastSegment is for testing metabase.GetLatestObjectLastSegment.

func (GetLatestObjectLastSegment) Check

Check runs the test.

type GetObjectExactVersion

type GetObjectExactVersion struct {
	Opts     metabase.GetObjectExactVersion
	Result   metabase.Object
	ErrClass *errs.Class
	ErrText  string
}

GetObjectExactVersion is for testing metabase.GetObjectExactVersion.

func (GetObjectExactVersion) Check

func (step GetObjectExactVersion) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

type GetObjectLatestVersion

type GetObjectLatestVersion struct {
	Opts     metabase.GetObjectLatestVersion
	Result   metabase.Object
	ErrClass *errs.Class
	ErrText  string
}

GetObjectLatestVersion is for testing metabase.GetObjectLatestVersion.

func (GetObjectLatestVersion) Check

func (step GetObjectLatestVersion) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

type GetSegmentByLocation

type GetSegmentByLocation struct {
	Opts     metabase.GetSegmentByLocation
	Result   metabase.Segment
	ErrClass *errs.Class
	ErrText  string
}

GetSegmentByLocation is for testing metabase.GetSegmentByLocation.

func (GetSegmentByLocation) Check

func (step GetSegmentByLocation) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

type GetSegmentByOffset

type GetSegmentByOffset struct {
	Opts     metabase.GetSegmentByOffset
	Result   metabase.Segment
	ErrClass *errs.Class
	ErrText  string
}

GetSegmentByOffset is for testing metabase.GetSegmentByOffset.

func (GetSegmentByOffset) Check

func (step GetSegmentByOffset) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

type GetSegmentByPosition

type GetSegmentByPosition struct {
	Opts     metabase.GetSegmentByPosition
	Result   metabase.Segment
	ErrClass *errs.Class
	ErrText  string
}

GetSegmentByPosition is for testing metabase.GetSegmentByPosition.

func (GetSegmentByPosition) Check

func (step GetSegmentByPosition) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

type GetStreamPieceCountByNodeID

type GetStreamPieceCountByNodeID struct {
	Opts     metabase.GetStreamPieceCountByNodeID
	Result   map[storj.NodeID]int64
	ErrClass *errs.Class
	ErrText  string
}

GetStreamPieceCountByNodeID is for testing metabase.GetStreamPieceCountByNodeID.

func (GetStreamPieceCountByNodeID) Check

Check runs the test.

type GetTableStats added in v1.32.2

type GetTableStats struct {
	Opts     metabase.GetTableStats
	Result   metabase.TableStats
	ErrClass *errs.Class
	ErrText  string
}

GetTableStats is for testing metabase.GetTableStats.

func (GetTableStats) Check added in v1.32.2

Check runs the test.

type InvalidObjectLocation

type InvalidObjectLocation struct {
	Name           string
	ObjectLocation metabase.ObjectLocation
	ErrClass       *errs.Class
	ErrText        string
}

InvalidObjectLocation contains info about an invalid object location.

func InvalidObjectLocations

func InvalidObjectLocations(base metabase.ObjectLocation) []InvalidObjectLocation

InvalidObjectLocations returns a list of invalid object locations.

type InvalidObjectStream

type InvalidObjectStream struct {
	Name         string
	ObjectStream metabase.ObjectStream
	ErrClass     *errs.Class
	ErrText      string
}

InvalidObjectStream contains info about an invalid stream.

func InvalidObjectStreams

func InvalidObjectStreams(base metabase.ObjectStream) []InvalidObjectStream

InvalidObjectStreams returns a list of invalid object streams.

type InvalidSegmentLocation

type InvalidSegmentLocation struct {
	Name            string
	SegmentLocation metabase.SegmentLocation
	ErrClass        *errs.Class
	ErrText         string
}

InvalidSegmentLocation contains info about an invalid segment location.

func InvalidSegmentLocations

func InvalidSegmentLocations(base metabase.SegmentLocation) []InvalidSegmentLocation

InvalidSegmentLocations returns a list of invalid segment locations.

type IterateCollector

type IterateCollector []metabase.ObjectEntry

IterateCollector is for testing metabase.IterateCollector.

func (*IterateCollector) Add

Add adds object entries from iterator to the collection.

type IterateLoopObjects

type IterateLoopObjects struct {
	Opts metabase.IterateLoopObjects

	Result   []metabase.LoopObjectEntry
	ErrClass *errs.Class
	ErrText  string
}

IterateLoopObjects is for testing metabase.IterateLoopObjects.

func (IterateLoopObjects) Check

func (step IterateLoopObjects) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

type IterateLoopSegments added in v1.31.1

type IterateLoopSegments struct {
	Opts     metabase.IterateLoopSegments
	Result   []metabase.LoopSegmentEntry
	ErrClass *errs.Class
	ErrText  string
}

IterateLoopSegments is for testing metabase.IterateLoopSegments.

func (IterateLoopSegments) Check added in v1.31.1

func (step IterateLoopSegments) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

type IterateLoopStreams

type IterateLoopStreams struct {
	Opts     metabase.IterateLoopStreams
	Result   map[uuid.UUID][]metabase.LoopSegmentEntry
	ErrClass *errs.Class
	ErrText  string
}

IterateLoopStreams is for testing metabase.IterateLoopStreams.

func (IterateLoopStreams) Check

func (step IterateLoopStreams) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

type IterateObjects

type IterateObjects struct {
	Opts metabase.IterateObjects

	Result   []metabase.ObjectEntry
	ErrClass *errs.Class
	ErrText  string
}

IterateObjects is for testing metabase.IterateObjects.

func (IterateObjects) Check

func (step IterateObjects) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

type IterateObjectsWithStatus

type IterateObjectsWithStatus struct {
	Opts metabase.IterateObjectsWithStatus

	Result   []metabase.ObjectEntry
	ErrClass *errs.Class
	ErrText  string
}

IterateObjectsWithStatus is for testing metabase.IterateObjectsWithStatus.

func (IterateObjectsWithStatus) Check

Check runs the test.

type IteratePendingObjectsByKey

type IteratePendingObjectsByKey struct {
	Opts metabase.IteratePendingObjectsByKey

	Result   []metabase.ObjectEntry
	ErrClass *errs.Class
	ErrText  string
}

IteratePendingObjectsByKey is for testing metabase.IteratePendingObjectsByKey.

func (IteratePendingObjectsByKey) Check

Check runs the test.

type ListNodeAliases

type ListNodeAliases struct {
	ErrClass *errs.Class
	ErrText  string
}

ListNodeAliases is for testing metabase.ListNodeAliases.

func (ListNodeAliases) Check

Check runs the test.

type ListSegments

type ListSegments struct {
	Opts     metabase.ListSegments
	Result   metabase.ListSegmentsResult
	ErrClass *errs.Class
	ErrText  string
}

ListSegments is for testing metabase.ListSegments.

func (ListSegments) Check

func (step ListSegments) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

type ListStreamPositions

type ListStreamPositions struct {
	Opts     metabase.ListStreamPositions
	Result   metabase.ListStreamPositionsResult
	ErrClass *errs.Class
	ErrText  string
}

ListStreamPositions is for testing metabase.ListStreamPositions.

func (ListStreamPositions) Check

func (step ListStreamPositions) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

type LoopIterateCollector

type LoopIterateCollector []metabase.LoopObjectEntry

LoopIterateCollector is for testing metabase.LoopIterateCollector.

func (*LoopIterateCollector) Add

Add adds object entries from iterator to the collection.

type UpdateObjectMetadata

type UpdateObjectMetadata struct {
	Opts     metabase.UpdateObjectMetadata
	ErrClass *errs.Class
	ErrText  string
}

UpdateObjectMetadata is for testing metabase.UpdateObjectMetadata.

func (UpdateObjectMetadata) Check

func (step UpdateObjectMetadata) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

type UpdateSegmentPieces

type UpdateSegmentPieces struct {
	Opts     metabase.UpdateSegmentPieces
	ErrClass *errs.Class
	ErrText  string
}

UpdateSegmentPieces is for testing metabase.UpdateSegmentPieces.

func (UpdateSegmentPieces) Check

func (step UpdateSegmentPieces) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

type Verify

type Verify metabase.RawState

Verify verifies whether metabase state matches the content.

func (Verify) Check

func (step Verify) Check(ctx *testcontext.Context, t testing.TB, db *metabase.DB)

Check runs the test.

Jump to

Keyboard shortcuts

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