mocks

package
v0.3.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DownloadCall

type DownloadCall struct {
	Bucket string
	Key    string
}

type LogEntry

type LogEntry struct {
	Level  string
	Format string
	Args   []interface{}
}

type MkdirCall

type MkdirCall struct {
	Path string
	Perm int
}

type MockArchiver

type MockArchiver struct {
	TarGzError   error
	UnTarGzError error
	TarGzCalls   []TarGzCall
	UnTarGzCalls []UnTarGzCall
}

MockArchiver implements Archiver for testing

func NewMockArchiver

func NewMockArchiver() *MockArchiver

NewMockArchiver creates a new mock archiver

func (*MockArchiver) TarGz

func (m *MockArchiver) TarGz(destination string, sources []string) error

TarGz mocks creating a tar.gz archive

func (*MockArchiver) UnTarGz

func (m *MockArchiver) UnTarGz(source, destination string) error

UnTarGz mocks extracting a tar.gz archive

type MockConsulClient

type MockConsulClient struct {
	KeyData        consulapi.KVPairs
	PQData         []*consulapi.PreparedQueryDefinition
	ACLData        []*consulapi.ACLEntry
	KeyError       error
	PQError        error
	ACLError       error
	ACLDisabled    bool
	PutKVError     error
	CreatePQError  error
	CreateACLError error
}

MockConsulClient implements ConsulClient for testing

func NewMockConsulClient

func NewMockConsulClient() *MockConsulClient

NewMockConsulClient creates a new mock consul client

func (*MockConsulClient) CreateACL

func (m *MockConsulClient) CreateACL(acl *consulapi.ACLEntry) error

CreateACL mocks creating an ACL

func (*MockConsulClient) CreatePQ

CreatePQ mocks creating a prepared query

func (*MockConsulClient) ListACLs

func (m *MockConsulClient) ListACLs() ([]*consulapi.ACLEntry, error)

ListACLs returns mock ACL data

func (*MockConsulClient) ListKeys

func (m *MockConsulClient) ListKeys() (consulapi.KVPairs, error)

ListKeys returns mock key data

func (*MockConsulClient) ListPQs

ListPQs returns mock prepared query data

func (*MockConsulClient) PutKV

func (m *MockConsulClient) PutKV(key string, value []byte) error

PutKV mocks putting a key-value pair

type MockFileSystem

type MockFileSystem struct {
	Files       map[string][]byte
	Dirs        map[string]bool
	WriteError  error
	ReadError   error
	MkdirError  error
	RemoveError error
	WriteCalls  []WriteCall
	ReadCalls   []string
	MkdirCalls  []MkdirCall
	RemoveCalls []string
}

MockFileSystem implements FileSystem for testing

func NewMockFileSystem

func NewMockFileSystem() *MockFileSystem

NewMockFileSystem creates a new mock filesystem

func (*MockFileSystem) MkdirAll

func (m *MockFileSystem) MkdirAll(path string, perm int) error

MkdirAll mocks creating directories

func (*MockFileSystem) ReadFile

func (m *MockFileSystem) ReadFile(filename string) ([]byte, error)

ReadFile mocks reading a file

func (*MockFileSystem) Remove

func (m *MockFileSystem) Remove(path string) error

Remove mocks removing a file

func (*MockFileSystem) RemoveAll

func (m *MockFileSystem) RemoveAll(path string) error

RemoveAll mocks removing a directory

func (*MockFileSystem) WriteFile

func (m *MockFileSystem) WriteFile(filename string, data []byte, perm int) error

WriteFile mocks writing a file

type MockLogger

type MockLogger struct {
	LogEntries  []LogEntry
	ShouldFatal bool
	FatalCalled bool
}

MockLogger implements Logger for testing

func NewMockLogger

func NewMockLogger() *MockLogger

NewMockLogger creates a new mock logger

func (*MockLogger) Fatal

func (m *MockLogger) Fatal(args ...interface{})

Fatal mocks fatal logging

func (*MockLogger) Fatalf

func (m *MockLogger) Fatalf(format string, args ...interface{})

Fatalf mocks fatal logging with format

func (*MockLogger) Print

func (m *MockLogger) Print(args ...interface{})

Print mocks logging

func (*MockLogger) Printf

func (m *MockLogger) Printf(format string, args ...interface{})

Printf mocks formatted logging

type MockStorageClient

type MockStorageClient struct {
	Data          map[string][]byte
	UploadError   error
	DownloadError error
	UploadCalls   []UploadCall
	DownloadCalls []DownloadCall
}

MockStorageClient implements StorageClient for testing

func NewMockStorageClient

func NewMockStorageClient() *MockStorageClient

NewMockStorageClient creates a new mock storage client

func (*MockStorageClient) Download

func (m *MockStorageClient) Download(bucket, key string) ([]byte, error)

Download mocks downloading data

func (*MockStorageClient) Upload

func (m *MockStorageClient) Upload(bucket, key string, data []byte) error

Upload mocks uploading data

type TarGzCall

type TarGzCall struct {
	Destination string
	Sources     []string
}

type UnTarGzCall

type UnTarGzCall struct {
	Source      string
	Destination string
}

type UploadCall

type UploadCall struct {
	Bucket string
	Key    string
	Data   []byte
}

type WriteCall

type WriteCall struct {
	Filename string
	Data     []byte
	Perm     int
}

Jump to

Keyboard shortcuts

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