daggerkit

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package daggerkit provides adapters to convert real Dagger types to interfaces, mirroring internal/pipelines/dagger_adapter.go.

Package daggerkit provides interfaces for Dagger types to enable mocking in provider unit tests, mirroring internal/pipelines/dagger_interfaces.go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DaggerAdapter

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

DaggerAdapter adapts a real *dagger.Client to DaggerClient.

func (*DaggerAdapter) CacheVolume

func (a *DaggerAdapter) CacheVolume(name string) DaggerCacheVolume

func (*DaggerAdapter) Container

func (a *DaggerAdapter) Container() DaggerContainer

func (*DaggerAdapter) GetRealClient

func (a *DaggerAdapter) GetRealClient() *dagger.Client

GetRealClient returns the underlying real Dagger client for use with shared functions.

func (*DaggerAdapter) Host

func (a *DaggerAdapter) Host() DaggerHost

type DaggerCacheVolume

type DaggerCacheVolume interface {
}

DaggerCacheVolume interface abstracts the dagger.CacheVolume to enable mocking.

type DaggerCacheVolumeAdapter

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

DaggerCacheVolumeAdapter adapts a real *dagger.CacheVolume to DaggerCacheVolume.

type DaggerClient

type DaggerClient interface {
	Container() DaggerContainer
	Host() DaggerHost
	CacheVolume(string) DaggerCacheVolume
	// GetRealClient returns the underlying real Dagger client (only for adapters)
	GetRealClient() *dagger.Client
}

DaggerClient interface abstracts the dagger.Client to enable mocking.

func NewDaggerAdapter

func NewDaggerAdapter(client *dagger.Client) DaggerClient

NewDaggerAdapter creates a new adapter for a real Dagger client.

type DaggerContainer

type DaggerContainer interface {
	From(string) DaggerContainer
	WithMountedDirectory(string, DaggerDirectory) DaggerContainer
	WithMountedCache(string, DaggerCacheVolume) DaggerContainer
	WithWorkdir(string) DaggerContainer
	WithEnvVariable(string, string) DaggerContainer
	WithExec([]string, DaggerContainerWithExecOpts) DaggerContainer
	WithNewFile(string, string) DaggerContainer
	WithDirectory(string, DaggerDirectory) DaggerContainer
	WithEntrypoint([]string) DaggerContainer
	// WithRegistryAuth and WithUnixSocket take *dagger.Secret/*dagger.Socket
	// directly rather than a wrapping interface, same rationale as
	// DaggerHost.UnixSocket above.
	WithRegistryAuth(string, string, *dagger.Secret) DaggerContainer
	WithUnixSocket(string, *dagger.Socket) DaggerContainer
	File(string) DaggerFile
	Directory(string) DaggerDirectory
	Sync(context.Context) (DaggerContainer, error)
	Stdout(context.Context) (string, error)
	Stderr(context.Context) (string, error)
	Publish(context.Context, string) (string, error)
	// GetRealContainer returns the underlying real Dagger container (only for adapters)
	GetRealContainer() *dagger.Container
}

DaggerContainer interface abstracts the dagger.Container to enable mocking.

type DaggerContainerAdapter

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

DaggerContainerAdapter adapts a real *dagger.Container to DaggerContainer.

func (*DaggerContainerAdapter) Directory

func (a *DaggerContainerAdapter) Directory(path string) DaggerDirectory

func (*DaggerContainerAdapter) File

func (*DaggerContainerAdapter) From

func (*DaggerContainerAdapter) GetRealContainer

func (a *DaggerContainerAdapter) GetRealContainer() *dagger.Container

GetRealContainer returns the underlying real Dagger container for use with shared functions.

func (*DaggerContainerAdapter) Publish

func (a *DaggerContainerAdapter) Publish(ctx context.Context, address string) (string, error)

func (*DaggerContainerAdapter) Stderr

func (*DaggerContainerAdapter) Stdout

func (*DaggerContainerAdapter) Sync

func (*DaggerContainerAdapter) WithDirectory

func (a *DaggerContainerAdapter) WithDirectory(path string, dir DaggerDirectory) DaggerContainer

func (*DaggerContainerAdapter) WithEntrypoint

func (a *DaggerContainerAdapter) WithEntrypoint(args []string) DaggerContainer

func (*DaggerContainerAdapter) WithEnvVariable

func (a *DaggerContainerAdapter) WithEnvVariable(name, value string) DaggerContainer

func (*DaggerContainerAdapter) WithExec

func (*DaggerContainerAdapter) WithMountedCache

func (a *DaggerContainerAdapter) WithMountedCache(path string, cache DaggerCacheVolume) DaggerContainer

func (*DaggerContainerAdapter) WithMountedDirectory

func (a *DaggerContainerAdapter) WithMountedDirectory(path string, dir DaggerDirectory) DaggerContainer

func (*DaggerContainerAdapter) WithNewFile

func (a *DaggerContainerAdapter) WithNewFile(path, contents string) DaggerContainer

func (*DaggerContainerAdapter) WithRegistryAuth

func (a *DaggerContainerAdapter) WithRegistryAuth(address, username string, secret *dagger.Secret) DaggerContainer

func (*DaggerContainerAdapter) WithUnixSocket

func (a *DaggerContainerAdapter) WithUnixSocket(path string, socket *dagger.Socket) DaggerContainer

func (*DaggerContainerAdapter) WithWorkdir

func (a *DaggerContainerAdapter) WithWorkdir(path string) DaggerContainer

type DaggerContainerWithExecOpts

type DaggerContainerWithExecOpts struct {
	RedirectStdout string
}

DaggerContainerWithExecOpts represents options for container exec operations.

type DaggerDirectory

type DaggerDirectory interface {
	File(string) DaggerFile
	// GetRealDirectory returns the underlying real Dagger directory (only for adapters)
	GetRealDirectory() *dagger.Directory
}

DaggerDirectory interface abstracts the dagger.Directory to enable mocking.

func NewDaggerDirectoryAdapter

func NewDaggerDirectoryAdapter(directory *dagger.Directory) DaggerDirectory

NewDaggerDirectoryAdapter wraps a real *dagger.Directory as a DaggerDirectory, needed to feed a caller-supplied concrete Directory (e.g. a provider's public Build(source *dagger.Directory) parameter) into interface-typed methods such as DaggerContainer.WithMountedDirectory.

type DaggerDirectoryAdapter

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

DaggerDirectoryAdapter adapts a real *dagger.Directory to DaggerDirectory.

func (*DaggerDirectoryAdapter) File

func (*DaggerDirectoryAdapter) GetRealDirectory

func (a *DaggerDirectoryAdapter) GetRealDirectory() *dagger.Directory

GetRealDirectory returns the underlying real Dagger directory for use with shared functions.

type DaggerFile

type DaggerFile interface {
	Contents(context.Context) (string, error)
}

DaggerFile interface abstracts the dagger.File to enable mocking.

type DaggerFileAdapter

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

DaggerFileAdapter adapts a real *dagger.File to DaggerFile.

func (*DaggerFileAdapter) Contents

func (a *DaggerFileAdapter) Contents(ctx context.Context) (string, error)

type DaggerHost

type DaggerHost interface {
	// UnixSocket returns *dagger.Socket directly rather than a wrapping
	// interface: callers only ever pass it through opaquely to
	// DaggerContainer.WithUnixSocket, never call a method on it.
	UnixSocket(string) *dagger.Socket
}

DaggerHost interface abstracts the dagger.Host to enable mocking.

type DaggerHostAdapter

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

DaggerHostAdapter adapts a real *dagger.Host to DaggerHost.

func (*DaggerHostAdapter) UnixSocket

func (a *DaggerHostAdapter) UnixSocket(path string) *dagger.Socket

type MockDaggerCacheVolume

type MockDaggerCacheVolume struct {
	mock.Mock
}

MockDaggerCacheVolume implements DaggerCacheVolume using testify's mock package.

type MockDaggerClient

type MockDaggerClient struct {
	mock.Mock
}

MockDaggerClient implements DaggerClient using testify's mock package.

func (*MockDaggerClient) CacheVolume

func (m *MockDaggerClient) CacheVolume(name string) DaggerCacheVolume

func (*MockDaggerClient) Container

func (m *MockDaggerClient) Container() DaggerContainer

func (*MockDaggerClient) GetRealClient

func (m *MockDaggerClient) GetRealClient() *dagger.Client

func (*MockDaggerClient) Host

func (m *MockDaggerClient) Host() DaggerHost

type MockDaggerContainer

type MockDaggerContainer struct {
	mock.Mock
}

MockDaggerContainer implements DaggerContainer using testify's mock package.

func (*MockDaggerContainer) Directory

func (m *MockDaggerContainer) Directory(path string) DaggerDirectory

func (*MockDaggerContainer) File

func (m *MockDaggerContainer) File(path string) DaggerFile

func (*MockDaggerContainer) From

func (*MockDaggerContainer) GetRealContainer

func (m *MockDaggerContainer) GetRealContainer() *dagger.Container

func (*MockDaggerContainer) Publish

func (m *MockDaggerContainer) Publish(ctx context.Context, address string) (string, error)

func (*MockDaggerContainer) Stderr

func (m *MockDaggerContainer) Stderr(ctx context.Context) (string, error)

func (*MockDaggerContainer) Stdout

func (m *MockDaggerContainer) Stdout(ctx context.Context) (string, error)

func (*MockDaggerContainer) Sync

func (*MockDaggerContainer) WithDirectory

func (m *MockDaggerContainer) WithDirectory(path string, dir DaggerDirectory) DaggerContainer

func (*MockDaggerContainer) WithEntrypoint

func (m *MockDaggerContainer) WithEntrypoint(execArgs []string) DaggerContainer

func (*MockDaggerContainer) WithEnvVariable

func (m *MockDaggerContainer) WithEnvVariable(name, value string) DaggerContainer

func (*MockDaggerContainer) WithExec

func (*MockDaggerContainer) WithMountedCache

func (m *MockDaggerContainer) WithMountedCache(path string, cache DaggerCacheVolume) DaggerContainer

func (*MockDaggerContainer) WithMountedDirectory

func (m *MockDaggerContainer) WithMountedDirectory(path string, dir DaggerDirectory) DaggerContainer

func (*MockDaggerContainer) WithNewFile

func (m *MockDaggerContainer) WithNewFile(path, contents string) DaggerContainer

func (*MockDaggerContainer) WithRegistryAuth

func (m *MockDaggerContainer) WithRegistryAuth(address, username string, secret *dagger.Secret) DaggerContainer

func (*MockDaggerContainer) WithUnixSocket

func (m *MockDaggerContainer) WithUnixSocket(path string, socket *dagger.Socket) DaggerContainer

func (*MockDaggerContainer) WithWorkdir

func (m *MockDaggerContainer) WithWorkdir(path string) DaggerContainer

type MockDaggerDirectory

type MockDaggerDirectory struct {
	mock.Mock
}

MockDaggerDirectory implements DaggerDirectory using testify's mock package.

func (*MockDaggerDirectory) File

func (m *MockDaggerDirectory) File(path string) DaggerFile

func (*MockDaggerDirectory) GetRealDirectory

func (m *MockDaggerDirectory) GetRealDirectory() *dagger.Directory

type MockDaggerFile

type MockDaggerFile struct {
	mock.Mock
}

MockDaggerFile implements DaggerFile using testify's mock package.

func (*MockDaggerFile) Contents

func (m *MockDaggerFile) Contents(ctx context.Context) (string, error)

type MockDaggerHost

type MockDaggerHost struct {
	mock.Mock
}

MockDaggerHost implements DaggerHost using testify's mock package.

func (*MockDaggerHost) UnixSocket

func (m *MockDaggerHost) UnixSocket(path string) *dagger.Socket

Jump to

Keyboard shortcuts

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