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 ¶
- type DaggerAdapter
- type DaggerCacheVolume
- type DaggerCacheVolumeAdapter
- type DaggerClient
- type DaggerContainer
- type DaggerContainerAdapter
- func (a *DaggerContainerAdapter) Directory(path string) DaggerDirectory
- func (a *DaggerContainerAdapter) File(path string) DaggerFile
- func (a *DaggerContainerAdapter) From(image string) DaggerContainer
- func (a *DaggerContainerAdapter) GetRealContainer() *dagger.Container
- func (a *DaggerContainerAdapter) Publish(ctx context.Context, address string) (string, error)
- func (a *DaggerContainerAdapter) Stderr(ctx context.Context) (string, error)
- func (a *DaggerContainerAdapter) Stdout(ctx context.Context) (string, error)
- func (a *DaggerContainerAdapter) Sync(ctx context.Context) (DaggerContainer, error)
- func (a *DaggerContainerAdapter) WithDirectory(path string, dir DaggerDirectory) DaggerContainer
- func (a *DaggerContainerAdapter) WithEntrypoint(args []string) DaggerContainer
- func (a *DaggerContainerAdapter) WithEnvVariable(name, value string) DaggerContainer
- func (a *DaggerContainerAdapter) WithExec(args []string, opts DaggerContainerWithExecOpts) DaggerContainer
- func (a *DaggerContainerAdapter) WithMountedCache(path string, cache DaggerCacheVolume) DaggerContainer
- func (a *DaggerContainerAdapter) WithMountedDirectory(path string, dir DaggerDirectory) DaggerContainer
- func (a *DaggerContainerAdapter) WithNewFile(path, contents string) DaggerContainer
- func (a *DaggerContainerAdapter) WithRegistryAuth(address, username string, secret *dagger.Secret) DaggerContainer
- func (a *DaggerContainerAdapter) WithUnixSocket(path string, socket *dagger.Socket) DaggerContainer
- func (a *DaggerContainerAdapter) WithWorkdir(path string) DaggerContainer
- type DaggerContainerWithExecOpts
- type DaggerDirectory
- type DaggerDirectoryAdapter
- type DaggerFile
- type DaggerFileAdapter
- type DaggerHost
- type DaggerHostAdapter
- type MockDaggerCacheVolume
- type MockDaggerClient
- type MockDaggerContainer
- func (m *MockDaggerContainer) Directory(path string) DaggerDirectory
- func (m *MockDaggerContainer) File(path string) DaggerFile
- func (m *MockDaggerContainer) From(image string) DaggerContainer
- func (m *MockDaggerContainer) GetRealContainer() *dagger.Container
- func (m *MockDaggerContainer) Publish(ctx context.Context, address string) (string, error)
- func (m *MockDaggerContainer) Stderr(ctx context.Context) (string, error)
- func (m *MockDaggerContainer) Stdout(ctx context.Context) (string, error)
- func (m *MockDaggerContainer) Sync(ctx context.Context) (DaggerContainer, error)
- func (m *MockDaggerContainer) WithDirectory(path string, dir DaggerDirectory) DaggerContainer
- func (m *MockDaggerContainer) WithEntrypoint(execArgs []string) DaggerContainer
- func (m *MockDaggerContainer) WithEnvVariable(name, value string) DaggerContainer
- func (m *MockDaggerContainer) WithExec(execArgs []string, opts DaggerContainerWithExecOpts) DaggerContainer
- func (m *MockDaggerContainer) WithMountedCache(path string, cache DaggerCacheVolume) DaggerContainer
- func (m *MockDaggerContainer) WithMountedDirectory(path string, dir DaggerDirectory) DaggerContainer
- func (m *MockDaggerContainer) WithNewFile(path, contents string) DaggerContainer
- func (m *MockDaggerContainer) WithRegistryAuth(address, username string, secret *dagger.Secret) DaggerContainer
- func (m *MockDaggerContainer) WithUnixSocket(path string, socket *dagger.Socket) DaggerContainer
- func (m *MockDaggerContainer) WithWorkdir(path string) DaggerContainer
- type MockDaggerDirectory
- type MockDaggerFile
- type MockDaggerHost
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 (a *DaggerContainerAdapter) File(path string) DaggerFile
func (*DaggerContainerAdapter) From ¶
func (a *DaggerContainerAdapter) From(image string) DaggerContainer
func (*DaggerContainerAdapter) GetRealContainer ¶
func (a *DaggerContainerAdapter) GetRealContainer() *dagger.Container
GetRealContainer returns the underlying real Dagger container for use with shared functions.
func (*DaggerContainerAdapter) Stderr ¶
func (a *DaggerContainerAdapter) Stderr(ctx context.Context) (string, error)
func (*DaggerContainerAdapter) Stdout ¶
func (a *DaggerContainerAdapter) Stdout(ctx context.Context) (string, error)
func (*DaggerContainerAdapter) Sync ¶
func (a *DaggerContainerAdapter) Sync(ctx context.Context) (DaggerContainer, error)
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 (a *DaggerContainerAdapter) WithExec(args []string, opts DaggerContainerWithExecOpts) DaggerContainer
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 (a *DaggerDirectoryAdapter) File(path string) DaggerFile
func (*DaggerDirectoryAdapter) GetRealDirectory ¶
func (a *DaggerDirectoryAdapter) GetRealDirectory() *dagger.Directory
GetRealDirectory returns the underlying real Dagger directory for use with shared functions.
type DaggerFile ¶
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.
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 ¶
MockDaggerCacheVolume implements DaggerCacheVolume using testify's mock package.
type MockDaggerClient ¶
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 ¶
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 (m *MockDaggerContainer) From(image string) DaggerContainer
func (*MockDaggerContainer) GetRealContainer ¶
func (m *MockDaggerContainer) GetRealContainer() *dagger.Container
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 (m *MockDaggerContainer) Sync(ctx context.Context) (DaggerContainer, error)
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 (m *MockDaggerContainer) WithExec(execArgs []string, opts DaggerContainerWithExecOpts) DaggerContainer
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 ¶
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 ¶
MockDaggerFile implements DaggerFile using testify's mock package.
type MockDaggerHost ¶
MockDaggerHost implements DaggerHost using testify's mock package.
func (*MockDaggerHost) UnixSocket ¶
func (m *MockDaggerHost) UnixSocket(path string) *dagger.Socket