testutils

package
v0.0.0-...-31c55af Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package testutils provides utilities for testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustNewDatastoreClientForTesting

func MustNewDatastoreClientForTesting(t *testing.T) *datastore.Client

MustNewDatastoreClientForTesting creates a new Datastore client connected to the emulator. It ensures the emulator is started and cleaned up.

func StartDatastoreEmulator

func StartDatastoreEmulator(t *testing.T)

StartDatastoreEmulator ensures the Datastore emulator is running once per test execution.

Types

type MockPublishResult

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

func (*MockPublishResult) Get

type MockPublisher

type MockPublisher struct {
	Messages []*pubsub.Message
	// contains filtered or unexported fields
}

func (*MockPublisher) Publish

type MockStorage

type MockStorage struct {
	WriteError  error            // Global error to return on WriteObject
	WriteErrors map[string]error // Per-path error to return on WriteObject
	// contains filtered or unexported fields
}

MockStorage implements osv.CloudStorage for testing.

func NewMockStorage

func NewMockStorage() *MockStorage

NewMockStorage creates a new mock storage client.

func (*MockStorage) Close

func (c *MockStorage) Close() error

func (*MockStorage) Objects

func (c *MockStorage) Objects(_ context.Context, prefix string) iter.Seq2[string, error]

func (*MockStorage) ReadObject

func (c *MockStorage) ReadObject(_ context.Context, path string) ([]byte, error)

func (*MockStorage) ReadObjectAttrs

func (c *MockStorage) ReadObjectAttrs(_ context.Context, path string) (*clients.Attrs, error)

func (*MockStorage) WriteObject

func (c *MockStorage) WriteObject(_ context.Context, path string, data []byte, opts *clients.WriteOptions) error

Jump to

Keyboard shortcuts

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