metabasetest

package
v1.79.3 Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: AGPL-3.0 Imports: 22 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 require.TestingT, 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 DefaultTimeDiff added in v1.56.1

func DefaultTimeDiff() cmp.Option

DefaultTimeDiff is the central place to adjust test sql "timeout" (accepted diff between start and end of the test).

func RandEncryptedKeyAndNonce added in v1.57.8

func RandEncryptedKeyAndNonce(position int) metabase.EncryptedKeyAndNonce

RandEncryptedKeyAndNonce generates random segment metadata.

func RandObjectKey added in v1.51.1

func RandObjectKey() metabase.ObjectKey

RandObjectKey returns a random object key.

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.

func RunWithConfig added in v1.42.2

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

RunWithConfig runs tests with specific metabase configuration.

func RunWithConfigAndMigration added in v1.57.1

func RunWithConfigAndMigration(t *testing.T, config metabase.Config, fn func(ctx *testcontext.Context, t *testing.T, db *metabase.DB), migration func(ctx context.Context, db *metabase.DB) error)

RunWithConfigAndMigration runs tests with specific metabase configuration and migration type.

func SegmentsToRaw added in v1.51.1

func SegmentsToRaw(segments []metabase.Segment) []metabase.RawSegment

SegmentsToRaw converts a slice of Segment to a slice of RawSegment.

Types

type BeginCopyObject added in v1.50.1

type BeginCopyObject struct {
	Opts     metabase.BeginCopyObject
	Result   metabase.BeginCopyObjectResult
	ErrClass *errs.Class
	ErrText  string
}

BeginCopyObject is for testing metabase.BeginCopyObject.

func (BeginCopyObject) Check added in v1.50.1

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

Check runs the test.

type BeginMoveObject added in v1.39.4

type BeginMoveObject struct {
	Opts     metabase.BeginMoveObject
	Result   metabase.BeginMoveObjectResult
	ErrClass *errs.Class
	ErrText  string
}

BeginMoveObject is for testing metabase.BeginMoveObject.

func (BeginMoveObject) Check added in v1.39.4

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

Check runs the test.

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

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 require.TestingT, 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 CollectBucketTallies added in v1.66.1

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

CollectBucketTallies is for testing metabase.CollectBucketTallies.

func (CollectBucketTallies) Check added in v1.66.1

func (step CollectBucketTallies) 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

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 require.TestingT, db *metabase.DB)

Check runs the test.

type CreateObjectCopy added in v1.50.1

type CreateObjectCopy struct {
	OriginalObject metabase.Object
	// if empty, creates fake segments if necessary
	OriginalSegments []metabase.Segment
	FinishObject     *metabase.FinishCopyObject
	CopyObjectStream *metabase.ObjectStream
}

CreateObjectCopy is for testing object copy.

func (CreateObjectCopy) Run added in v1.50.1

func (cc CreateObjectCopy) Run(ctx *testcontext.Context, t testing.TB, db *metabase.DB) (copyObj metabase.Object, expectedOriginalSegments []metabase.RawSegment, expectedCopySegments []metabase.RawSegment)

Run creates the copy.

type CreateTestObject

type CreateTestObject struct {
	BeginObjectExactVersion *metabase.BeginObjectExactVersion
	CommitObject            *metabase.CommitObject
	CreateSegment           func(object metabase.Object, index int) metabase.Segment
}

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, []metabase.Segment)

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 DeleteObjectLastCommitted added in v1.63.1

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

DeleteObjectLastCommitted is for testing metabase.DeleteObjectLastCommitted.

func (DeleteObjectLastCommitted) Check added in v1.63.1

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 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 FinishCopyObject added in v1.50.1

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

FinishCopyObject is for testing metabase.FinishCopyObject.

func (FinishCopyObject) Check added in v1.50.1

Check runs the test.

type FinishMoveObject added in v1.40.3

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

FinishMoveObject is for testing metabase.FinishMoveObject.

func (FinishMoveObject) Check added in v1.40.3

func (step FinishMoveObject) 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 GetObjectLastCommitted added in v1.62.1

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

GetObjectLastCommitted is for testing metabase.GetObjectLastCommitted.

func (GetObjectLastCommitted) Check added in v1.62.1

func (step GetObjectLastCommitted) 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 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 ListObjects added in v1.65.1

type ListObjects struct {
	Opts     metabase.ListObjects
	Result   metabase.ListObjectsResult
	ErrClass *errs.Class
	ErrText  string
}

ListObjects is for testing metabase.ListObjects.

func (ListObjects) Check added in v1.65.1

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

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 ListVerifySegments added in v1.64.1

type ListVerifySegments struct {
	Opts     metabase.ListVerifySegments
	Result   metabase.ListVerifySegmentsResult
	ErrClass *errs.Class
	ErrText  string
}

ListVerifySegments is for testing metabase.ListVerifySegments.

func (ListVerifySegments) Check added in v1.64.1

func (step ListVerifySegments) 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