testutil

package
v1.31.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBranchID = graveler.BranchID("main")

Variables

This section is empty.

Functions

func NewCommittedValueIteratorFake

func NewCommittedValueIteratorFake(records []committed.Record) *committedValueIteratorFake

func NewDiffIter

func NewDiffIter(records []graveler.Diff) *diffIter

func NewFakeBranchIteratorFactory added in v0.43.0

func NewFakeBranchIteratorFactory(data []*graveler.BranchRecord) func() graveler.BranchIterator

func NewValueIteratorFake

func NewValueIteratorFake(records []graveler.ValueRecord) graveler.ValueIterator

Types

type AddedCommitData

type AddedCommitData struct {
	Committer   string
	Message     string
	MetaRangeID graveler.MetaRangeID
	Parents     graveler.CommitParents
	Metadata    graveler.Metadata
}

type AppliedData

type AppliedData struct {
	Values      graveler.ValueIterator
	MetaRangeID graveler.MetaRangeID
}

type CommittedFake

type CommittedFake struct {
	ValuesByKey   map[string]*graveler.Value
	ValueIterator graveler.ValueIterator
	Values        map[string]graveler.ValueIterator
	DiffIterator  graveler.DiffIterator
	Err           error
	MetaRangeID   graveler.MetaRangeID
	RangeInfo     graveler.RangeInfo
	DiffSummary   graveler.DiffSummary
	AppliedData   AppliedData
}

func (*CommittedFake) Commit added in v0.58.0

func (*CommittedFake) GetMetaRange

func (*CommittedFake) GetRange

func (*CommittedFake) GetRangeIDByKey added in v0.98.0

func (*CommittedFake) Import added in v0.105.0

func (*CommittedFake) WriteMetaRangeByIterator added in v0.63.0

func (*CommittedFake) WriteRange added in v0.63.0

type DRV added in v0.40.0

type DRV struct {
	R *committed.RangeDiff
	V *graveler.Diff
}

type FakeBranchIterator added in v0.43.0

type FakeBranchIterator struct {
	Data  []*graveler.BranchRecord
	Index int
}

func NewFakeBranchIterator added in v0.43.0

func NewFakeBranchIterator(data []*graveler.BranchRecord) *FakeBranchIterator

func (*FakeBranchIterator) Close added in v0.43.0

func (m *FakeBranchIterator) Close()

func (*FakeBranchIterator) Err added in v0.43.0

func (m *FakeBranchIterator) Err() error

func (*FakeBranchIterator) Next added in v0.43.0

func (m *FakeBranchIterator) Next() bool

func (*FakeBranchIterator) SeekGE added in v0.43.0

func (m *FakeBranchIterator) SeekGE(id graveler.BranchID)

func (*FakeBranchIterator) Value added in v0.43.0

type FakeCommitIterator added in v0.45.1

type FakeCommitIterator struct {
	Data  []*graveler.CommitRecord
	Index int
}

func NewFakeCommitIterator added in v0.45.1

func NewFakeCommitIterator(data []*graveler.CommitRecord) *FakeCommitIterator

func (*FakeCommitIterator) Close added in v0.45.1

func (m *FakeCommitIterator) Close()

func (*FakeCommitIterator) Err added in v0.45.1

func (m *FakeCommitIterator) Err() error

func (*FakeCommitIterator) Next added in v0.45.1

func (m *FakeCommitIterator) Next() bool

func (*FakeCommitIterator) SeekGE added in v0.45.1

func (m *FakeCommitIterator) SeekGE(id graveler.CommitID)

func (*FakeCommitIterator) Value added in v0.45.1

type FakeDiffIterator added in v0.40.0

type FakeDiffIterator struct {
	DRV []DRV
	// contains filtered or unexported fields
}

func (*FakeDiffIterator) AddRange added in v0.40.0

func (*FakeDiffIterator) AddValueRecords added in v0.40.0

func (i *FakeDiffIterator) AddValueRecords(vs ...*graveler.Diff) *FakeDiffIterator

func (*FakeDiffIterator) Close added in v0.40.0

func (i *FakeDiffIterator) Close()

func (*FakeDiffIterator) Err added in v0.40.0

func (i *FakeDiffIterator) Err() error

func (*FakeDiffIterator) Next added in v0.40.0

func (i *FakeDiffIterator) Next() bool

func (*FakeDiffIterator) NextRange added in v0.40.0

func (i *FakeDiffIterator) NextRange() bool

func (*FakeDiffIterator) ReadsByRange added in v0.40.0

func (i *FakeDiffIterator) ReadsByRange() []int

ReadsByRange returns the number of Next operations performed inside each range

func (*FakeDiffIterator) SeekGE added in v0.40.0

func (i *FakeDiffIterator) SeekGE(id graveler.Key)

func (*FakeDiffIterator) SetErr added in v0.40.0

func (i *FakeDiffIterator) SetErr(err error)

func (*FakeDiffIterator) Value added in v0.40.0

type FakeIterator

type FakeIterator struct {
	RV []RV
	// contains filtered or unexported fields
}

func NewFakeIterator

func NewFakeIterator() *FakeIterator

func (*FakeIterator) AddRange

func (i *FakeIterator) AddRange(p *committed.Range) *FakeIterator

func (*FakeIterator) AddValueRecords

func (i *FakeIterator) AddValueRecords(vs ...*graveler.ValueRecord) *FakeIterator

func (*FakeIterator) Close

func (i *FakeIterator) Close()

func (*FakeIterator) Err

func (i *FakeIterator) Err() error

func (*FakeIterator) Next

func (i *FakeIterator) Next() bool

func (*FakeIterator) NextRange

func (i *FakeIterator) NextRange() bool

func (*FakeIterator) ReadsByRange

func (i *FakeIterator) ReadsByRange() []int

ReadsByRange returns the number of Next operations performed inside each range

func (*FakeIterator) SeekGE

func (i *FakeIterator) SeekGE(id graveler.Key)

func (*FakeIterator) SetErr

func (i *FakeIterator) SetErr(err error)

func (*FakeIterator) Value

type GravelerTest added in v0.85.0

type GravelerTest struct {
	Controller               *gomock.Controller
	CommittedManager         *mock.MockCommittedManager
	RefManager               *mock.MockRefManager
	StagingManager           *mock.MockStagingManager
	ProtectedBranchesManager *mock.MockProtectedBranchesManager
	GarbageCollectionManager *mock.MockGarbageCollectionManager
	KVStore                  *kvmock.MockStore
	Sut                      *graveler.Graveler
}

func InitGravelerTest added in v0.85.0

func InitGravelerTest(t *testing.T) *GravelerTest

type MetaRangeFake

type MetaRangeFake struct {
	// contains filtered or unexported fields
}

func (*MetaRangeFake) ID

type ProtectedBranchesManagerFake added in v0.52.0

type ProtectedBranchesManagerFake struct {
	graveler.ProtectedBranchesManager
	// contains filtered or unexported fields
}

func NewProtectedBranchesManagerFake added in v0.52.0

func NewProtectedBranchesManagerFake(protectedBranches ...string) *ProtectedBranchesManagerFake

func (ProtectedBranchesManagerFake) IsBlocked added in v0.52.0

type RV

type RV struct {
	R *committed.Range
	V *graveler.ValueRecord
}

type RefsFake

type RefsFake struct {
	ListRepositoriesRes graveler.RepositoryIterator
	ListBranchesRes     graveler.BranchIterator
	ListCommitsRes      graveler.CommitIterator
	Refs                map[graveler.Ref]*graveler.ResolvedRef
	ListTagsRes         graveler.TagIterator
	CommitIter          graveler.CommitIterator
	RefType             graveler.ReferenceType
	Branch              *graveler.Branch
	TagCommitID         *graveler.CommitID
	Err                 error
	CommitErr           error
	UpdateErr           error
	AddedCommit         AddedCommitData
	CommitID            graveler.CommitID
	Commits             map[graveler.CommitID]*graveler.Commit
	StagingToken        graveler.StagingToken
	SealedTokens        []graveler.StagingToken
	BaseMetaRangeID     graveler.MetaRangeID
}

func (*RefsFake) AddCommit

func (*RefsFake) BranchUpdate added in v0.70.0

func (*RefsFake) CreateBareRepository

func (*RefsFake) CreateBranch added in v0.54.0

func (*RefsFake) CreateCommitRecord added in v1.9.0

func (*RefsFake) CreateRepository

func (m *RefsFake) CreateRepository(_ context.Context, repositoryID graveler.RepositoryID, repository graveler.Repository) (*graveler.RepositoryRecord, error)

func (*RefsFake) DeleteBranch

func (*RefsFake) DeleteExpiredImports added in v0.102.0

func (m *RefsFake) DeleteExpiredImports(context.Context, *graveler.RepositoryRecord) error

func (*RefsFake) DeleteRepository

func (*RefsFake) DeleteTag

func (*RefsFake) FillGenerations added in v0.41.1

func (m *RefsFake) FillGenerations(_ context.Context, _ *graveler.RepositoryRecord) error

func (*RefsFake) FindMergeBase

func (*RefsFake) GCBranchIterator added in v0.70.0

func (*RefsFake) GCCommitIterator added in v0.70.0

func (*RefsFake) GetCommit

func (*RefsFake) GetCommitByPrefix added in v0.69.1

func (*RefsFake) GetRepository

func (m *RefsFake) GetRepository(_ context.Context, repositoryID graveler.RepositoryID) (*graveler.RepositoryRecord, error)

func (*RefsFake) GetRepositoryMetadata added in v0.104.0

func (m *RefsFake) GetRepositoryMetadata(_ context.Context, _ graveler.RepositoryID) (graveler.RepositoryMetadata, error)

func (*RefsFake) ListCommits

func (*RefsFake) ListRepositories

func (m *RefsFake) ListRepositories(context.Context) (graveler.RepositoryIterator, error)

func (*RefsFake) ParseRef added in v0.44.1

func (m *RefsFake) ParseRef(ref graveler.Ref) (graveler.RawRef, error)

func (*RefsFake) RemoveCommit added in v0.70.0

func (m *RefsFake) RemoveCommit(_ context.Context, _ *graveler.RepositoryRecord, commitID graveler.CommitID) error

func (*RefsFake) ResolveRawRef added in v0.44.1

func (*RefsFake) SetRepositoryMetadata added in v0.104.0

func (*RefsFake) VerifyLinkAddress added in v0.90.0

func (m *RefsFake) VerifyLinkAddress(_ context.Context, _ *graveler.RepositoryRecord, _ string) error

type StagingFake

type StagingFake struct {
	Err                error
	DropErr            error // specific error for drop call
	Value              *graveler.Value
	ValueIterator      graveler.ValueIterator
	Values             map[string]map[string]*graveler.Value
	LastSetValueRecord *graveler.ValueRecord
	LastRemovedKey     graveler.Key
	DropCalled         bool
	SetErr             error
	UpdateErr          error
}

func (*StagingFake) Drop

func (*StagingFake) DropAsync added in v0.70.1

func (s *StagingFake) DropAsync(ctx context.Context, st graveler.StagingToken) error

func (*StagingFake) DropByPrefix

func (*StagingFake) DropKey

func (*StagingFake) Get

func (*StagingFake) List

func (*StagingFake) Set

func (*StagingFake) Update added in v0.70.0

Jump to

Keyboard shortcuts

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