test

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockChunkedSyncHandler

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

MockChunkedSyncHandler implements queue.ChunkedSyncHandler for testing.

func NewMockChunkedSyncHandler

func NewMockChunkedSyncHandler() *MockChunkedSyncHandler

NewMockChunkedSyncHandler creates a new mock chunked sync handler.

func (*MockChunkedSyncHandler) CreatePartHandler

CreatePartHandler creates a new part handler for testing.

func (*MockChunkedSyncHandler) GetCompletedParts

func (m *MockChunkedSyncHandler) GetCompletedParts() []*MockPartHandler

GetCompletedParts returns all completed parts.

func (*MockChunkedSyncHandler) GetReceivedChunksCount

func (m *MockChunkedSyncHandler) GetReceivedChunksCount() int

GetReceivedChunksCount returns the total number of received chunks.

func (*MockChunkedSyncHandler) GetReceivedContexts

func (m *MockChunkedSyncHandler) GetReceivedContexts() []*queue.ChunkedSyncPartContext

GetReceivedContexts returns all received contexts.

func (*MockChunkedSyncHandler) GetReceivedFiles

func (m *MockChunkedSyncHandler) GetReceivedFiles() map[string][]byte

GetReceivedFiles returns all received files across all parts.

func (*MockChunkedSyncHandler) HandleFileChunk

func (m *MockChunkedSyncHandler) HandleFileChunk(ctx *queue.ChunkedSyncPartContext, chunk []byte) error

HandleFileChunk processes incoming file chunks for testing.

type MockChunkedSyncHandlerWithTracking

type MockChunkedSyncHandlerWithTracking struct {
	*MockChunkedSyncHandler
	// contains filtered or unexported fields
}

MockChunkedSyncHandlerWithTracking extends MockChunkedSyncHandler with NewPartType call tracking.

func NewMockChunkedSyncHandlerWithTracking

func NewMockChunkedSyncHandlerWithTracking() *MockChunkedSyncHandlerWithTracking

NewMockChunkedSyncHandlerWithTracking creates a new mock handler with tracking capabilities.

func (*MockChunkedSyncHandlerWithTracking) CreatePartHandler

CreatePartHandler creates a new part handler with tracking capabilities.

func (*MockChunkedSyncHandlerWithTracking) GetNewPartTypeContexts

func (m *MockChunkedSyncHandlerWithTracking) GetNewPartTypeContexts() []*queue.ChunkedSyncPartContext

GetNewPartTypeContexts returns all contexts passed to NewPartType.

func (*MockChunkedSyncHandlerWithTracking) NewPartTypeCalled

func (m *MockChunkedSyncHandlerWithTracking) NewPartTypeCalled() bool

NewPartTypeCalled returns whether NewPartType has been called.

func (*MockChunkedSyncHandlerWithTracking) ResetNewPartTypeCalls

func (m *MockChunkedSyncHandlerWithTracking) ResetNewPartTypeCalls()

ResetNewPartTypeCalls resets the tracking state.

func (*MockChunkedSyncHandlerWithTracking) TrackNewPartType

TrackNewPartType tracks a NewPartType call.

type MockPartHandler

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

MockPartHandler implements queue.PartHandler for testing.

func (*MockPartHandler) Close

func (m *MockPartHandler) Close() error

Close marks the handler as closed.

func (*MockPartHandler) FinishSync

func (m *MockPartHandler) FinishSync() error

FinishSync marks the sync as finished and closes the handler.

func (*MockPartHandler) GetReceivedChunksCount

func (m *MockPartHandler) GetReceivedChunksCount() int

GetReceivedChunksCount returns the number of received chunks.

func (*MockPartHandler) GetReceivedFiles

func (m *MockPartHandler) GetReceivedFiles() map[string][]byte

GetReceivedFiles returns a copy of the received files.

func (*MockPartHandler) NewPartType

func (m *MockPartHandler) NewPartType(ctx *queue.ChunkedSyncPartContext) error

NewPartType marks the part as new and tracks the call.

type Setup

type Setup struct {
	Server        queue.Server
	Client        queue.Client
	Closer        run.Unit
	ChunkedClient queue.ChunkedSyncClient
	MockHandler   *MockChunkedSyncHandler
	DeferFn       func()
	NodeName      string
	NodeAddr      string
	TestGroup     run.Group
	GRPCPort      uint32
	HTTPPort      uint32
}

Setup holds the test environment configuration and components.

type TrackingSetup

type TrackingSetup struct {
	*Setup
	TrackingHandler *MockChunkedSyncHandlerWithTracking
}

TrackingSetup extends Setup with tracking capabilities.

Jump to

Keyboard shortcuts

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